-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.lua
More file actions
125 lines (106 loc) · 3.52 KB
/
init.lua
File metadata and controls
125 lines (106 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
-- @title Neovim init.lua
-- @author Thomas Nichols <thomas@nexus10.com>
-- @date 2023-03-08
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'nvim-lua/popup.nvim'
use 'nvim-lua/plenary.nvim'
use 'nvim-telescope/telescope.nvim'
use 'sudormrfbin/cheatsheet.nvim'
use 'nvim-lua/completion-nvim'
use 'kdheepak/JuliaFormatter.vim'
use {'neoclide/coc.nvim', branch = 'release'}
use 'williamboman/mason.nvim'
require('mason').setup()
use 'williamboman/mason-lspconfig.nvim'
use 'simrat39/rust-tools.nvim'
use 'sharkdp/fd' -- disable if unused
use 'tpope/vim-fugitive'
use 'tpope/vim-dispatch'
use "hrsh7th/cmp-buffer"
use "hrsh7th/cmp-nvim-lsp"
use "hrsh7th/cmp-nvim-lsp-signature-help"
use "hrsh7th/cmp-nvim-lua"
use "hrsh7th/cmp-path"
use "hrsh7th/cmp-vsnip"
use "hrsh7th/nvim-cmp"
use "hrsh7th/vim-vsnip"
-- Rust --
local rt = require("rust-tools")
rt.setup({
server = {
on_attach = function(_, bufnr)
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
end,
},
})
-- Completion Plugin Setup
local cmp = require'cmp'
cmp.setup({
-- Enable LSP snippets
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
-- Add tab support
['<S-Tab>'] = cmp.mapping.select_prev_item(),
['<Tab>'] = cmp.mapping.select_next_item(),
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
})
},
-- Installed sources:
sources = {
{ name = 'path' }, -- file paths
{ name = 'nvim_lsp', keyword_length = 3 }, -- from language server
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
{ name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
{ name = 'buffer', keyword_length = 2 }, -- source current buffer
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
{ name = 'calc'}, -- source for math calculation
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
fields = {'menu', 'abbr', 'kind'},
format = function(entry, item)
local menu_icon ={
nvim_lsp = 'λ',
vsnip = '⋗',
buffer = 'Ω',
path = '🖫',
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
})
-- Julia --
-- TODO
-- WIP migration from vimrc --
--
--[[
" let g:diagnostic_auto_popup_while_jump = 0
" let g:diagnostic_enable_virtual_text = 0
" let g:diagnostic_enable_underline = 0
" let g:completion_timer_cycle = 200 "default value is 80
" nnoremap <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR>
" nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
" nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>
" nnoremap <silent> g0 <cmd>lua vim.lsp.buf.document_symbol()<CR>
--]]
end)