Neovim
This commit is contained in:
parent
c4ed1dc517
commit
90348896f9
9 changed files with 117 additions and 0 deletions
89
.config/nvim/init.vim
Normal file
89
.config/nvim/init.vim
Normal file
|
@ -0,0 +1,89 @@
|
|||
set mouse=a " Enable mouse
|
||||
set linebreak " Wrap words
|
||||
set hidden " Do not save when switching buffers
|
||||
set inccommand=nosplit " Incremental live completion
|
||||
|
||||
set ignorecase smartcase
|
||||
|
||||
set updatetime=250
|
||||
|
||||
" Show trailing spaces and tabs
|
||||
" set list listchars=lead:·,trail:·,tab:▷\
|
||||
|
||||
" exe 'set background='..readfile('/home/diablo/.theme')[0]
|
||||
"let g:rose_pine_variant="moon"
|
||||
set termguicolors
|
||||
" colorscheme rose-pine
|
||||
colorscheme selenized_bw
|
||||
|
||||
" inoremap <silent><expr> <C-o> pumvisible() ? "\<C-n>" : "\<C-x><C-o>"
|
||||
" set completeopt=menuone,noselect,preview
|
||||
" autocmd CompleteDone * silent! pclose
|
||||
|
||||
set completeopt=menu,menuone,noselect
|
||||
|
||||
lua << EOF
|
||||
local cmp = require'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-d>'] = 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({ select = true }),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
local nvim_lsp = require('lspconfig')
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
|
||||
end
|
||||
|
||||
local servers = { 'zls' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
}
|
||||
end
|
||||
EOF
|
1
.config/nvim/pack/plugins/start/cmp-buffer
Submodule
1
.config/nvim/pack/plugins/start/cmp-buffer
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 5dde5430757696be4169ad409210cf5088554ed6
|
1
.config/nvim/pack/plugins/start/cmp-nvim-lsp
Submodule
1
.config/nvim/pack/plugins/start/cmp-nvim-lsp
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 246a41c55668d5f84afcd805ee73b6e419375ae0
|
1
.config/nvim/pack/plugins/start/nvim-cmp
Submodule
1
.config/nvim/pack/plugins/start/nvim-cmp
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit cc21a61910b89422122cc0c67a8265247bd0db6a
|
1
.config/nvim/pack/plugins/start/nvim-lspconfig
Submodule
1
.config/nvim/pack/plugins/start/nvim-lspconfig
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 3a22ac6f8d87d42f89b9de791053c98b803f1b6d
|
1
.config/nvim/pack/plugins/start/vim-commentary
Submodule
1
.config/nvim/pack/plugins/start/vim-commentary
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 349340debb34f6302931f0eb7139b2c11dfdf427
|
1
.config/nvim/pack/plugins/start/vim-sleuth
Submodule
1
.config/nvim/pack/plugins/start/vim-sleuth
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 38bd4010110614822cde523ebc5724963312ab63
|
1
.config/nvim/pack/plugins/start/zig.vim
Submodule
1
.config/nvim/pack/plugins/start/zig.vim
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit fb534e7d12be7e529f79ad5ab99c08dc99f53294
|
21
.gitmodules
vendored
Normal file
21
.gitmodules
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
[submodule ".config/nvim/pack/plugins/start/cmp-buffer"]
|
||||
path = .config/nvim/pack/plugins/start/cmp-buffer
|
||||
url = https://github.com/hrsh7th/cmp-buffer
|
||||
[submodule ".config/nvim/pack/plugins/start/cmp-nvim-lsp"]
|
||||
path = .config/nvim/pack/plugins/start/cmp-nvim-lsp
|
||||
url = https://github.com/hrsh7th/cmp-nvim-lsp
|
||||
[submodule ".config/nvim/pack/plugins/start/nvim-cmp"]
|
||||
path = .config/nvim/pack/plugins/start/nvim-cmp
|
||||
url = https://github.com/hrsh7th/nvim-cmp
|
||||
[submodule ".config/nvim/pack/plugins/start/nvim-lspconfig"]
|
||||
path = .config/nvim/pack/plugins/start/nvim-lspconfig
|
||||
url = https://github.com/neovim/nvim-lspconfig
|
||||
[submodule ".config/nvim/pack/plugins/start/vim-commentary"]
|
||||
path = .config/nvim/pack/plugins/start/vim-commentary
|
||||
url = https://tpope.io/vim/commentary.git
|
||||
[submodule ".config/nvim/pack/plugins/start/vim-sleuth"]
|
||||
path = .config/nvim/pack/plugins/start/vim-sleuth
|
||||
url = https://github.com/tpope/vim-sleuth
|
||||
[submodule ".config/nvim/pack/plugins/start/zig.vim"]
|
||||
path = .config/nvim/pack/plugins/start/zig.vim
|
||||
url = https://github.com/ziglang/zig.vim
|
Loading…
Reference in a new issue