add lots of neovim config
This commit is contained in:
parent
9e75af3939
commit
849d209774
2 changed files with 73 additions and 2 deletions
7
home.nix
7
home.nix
|
@ -7,6 +7,7 @@
|
|||
|
||||
packages = with pkgs; [
|
||||
keepassxc
|
||||
nil
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -19,7 +20,11 @@
|
|||
vimdiffAlias = true;
|
||||
defaultEditor = true;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
mason-nvim
|
||||
nvim-lspconfig
|
||||
gruvbox-nvim
|
||||
leap-nvim
|
||||
telescope-nvim
|
||||
vim-commentary
|
||||
];
|
||||
extraLuaConfig = builtins.readFile ./neovim.lua;
|
||||
};
|
||||
|
|
68
neovim.lua
68
neovim.lua
|
@ -1 +1,67 @@
|
|||
require("mason").setup()
|
||||
--[ GLOBAL ]--
|
||||
|
||||
vim.o.background = "dark"
|
||||
vim.cmd([[colorscheme gruvbox]])
|
||||
vim.g.mapleader = ";"
|
||||
vim.o.signcolumn = "yes"
|
||||
vim.wo.number = true
|
||||
vim.wo.relativenumber = true
|
||||
vim.wo.cursorline = true
|
||||
|
||||
--[ LSPCONFIG ]--
|
||||
|
||||
local opts = { noremap=true, silent=true }
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', '<leader>d', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>h', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', '<leader>i', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<leader>s', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<leader>c', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', '<leader>fmt', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
end
|
||||
|
||||
require'lspconfig'.nil_ls.setup{ on_attach = on_attach }
|
||||
|
||||
--[ LEAP ]--
|
||||
|
||||
require('leap').add_default_mappings()
|
||||
-- Don't remap 'x' in visual mode.
|
||||
vim.keymap.del({'x', 'o'}, 'x')
|
||||
vim.keymap.del({'x', 'o'}, 'X')
|
||||
|
||||
--[ TELESCOPE ]--
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
||||
vim.keymap.set('n', '<leader>fr', builtin.lsp_references, {})
|
||||
vim.keymap.set('n', '<leader>fs', builtin.lsp_document_symbols, {})
|
||||
|
||||
require('telescope').setup{
|
||||
pickers = {
|
||||
find_files = {
|
||||
theme = "dropdown"
|
||||
},
|
||||
live_grep = {
|
||||
theme = "dropdown"
|
||||
},
|
||||
buffers = {
|
||||
theme = "dropdown"
|
||||
},
|
||||
lsp_references = {
|
||||
theme = "dropdown"
|
||||
},
|
||||
lsp_document_symbols = {
|
||||
theme = "dropdown"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
--[ COMMENTARY ]--
|
||||
vim.cmd([[autocmd FileType nix setlocal commentstring=#\ %s]])
|
||||
|
|
Reference in a new issue