commit 7122e7194fe233480dd9ab745a2ce36755a6a9e4
parent c520767dee28f93ce4f52c24e4441fdc2f0747a8
Author: Alex Balgavy <alex@balgavy.eu>
Date: Fri, 2 Sep 2022 12:32:53 +0200
nvim: use init.lua instead of init.vim
Diffstat:
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/nvim/init.lua b/nvim/init.lua
@@ -0,0 +1,24 @@
+vim.cmd([[
+set runtimepath^=~/.vim runtimepath+=~/.vim/after
+let &packpath = &runtimepath
+source ~/.vim/vimrc
+]])
+
+local custom_lsp_attach = function(client)
+ -- See `:help nvim_buf_set_keymap()` for more information
+ vim.api.nvim_buf_set_keymap(0, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', {noremap = true})
+ vim.api.nvim_buf_set_keymap(0, 'n', '<c-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', {noremap = true})
+
+ -- Use LSP as the handler for omnifunc.
+ vim.api.nvim_buf_set_option(0, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
+
+ -- Use LSP as the handler for formatexpr.
+ vim.api.nvim_buf_set_option(0, 'formatexpr', 'v:lua.vim.lsp.formatexpr()')
+
+ -- For plugins with an `on_attach` callback, call them here. For example:
+ -- require('completion').on_attach()
+end
+
+require'lspconfig'.rust_analyzer.setup({
+ on_attach = custom_lsp_attach
+})
diff --git a/nvim/init.vim b/nvim/init.vim
@@ -1,3 +0,0 @@
-set runtimepath^=~/.vim runtimepath+=~/.vim/after
-let &packpath = &runtimepath
-source ~/.vim/vimrc