neovim: Adapt to 22.11
This commit is contained in:
parent
b6a903551e
commit
5d98924ea1
|
@ -49,19 +49,19 @@ in
|
|||
haskell-language-server
|
||||
rnix-lsp
|
||||
rust-analyzer
|
||||
# very ugly, but required to make non-yapf/autopep8 formatters work
|
||||
((python3.override {
|
||||
packageOverrides = _: prev: {
|
||||
python-lsp-server = prev.python-lsp-server.override {
|
||||
withAutopep8 = false;
|
||||
withYapf = false;
|
||||
};
|
||||
};
|
||||
}).withPackages (ps: with ps; [
|
||||
(python3.withPackages (ps: with ps; [
|
||||
pyls-isort
|
||||
#pylsp-mypy # FIXME
|
||||
pylsp-mypy
|
||||
python-lsp-black
|
||||
python-lsp-server
|
||||
|
||||
# pylsp optional dependencies
|
||||
flake8
|
||||
mccabe
|
||||
pycodestyle
|
||||
pydocstyle
|
||||
pyflakes
|
||||
pylint
|
||||
]))
|
||||
nodePackages."@tailwindcss/language-server"
|
||||
universal-ctags
|
||||
|
@ -83,7 +83,7 @@ in
|
|||
neogit
|
||||
nvim-cmp
|
||||
nvim-lspconfig
|
||||
(nvim-solarized-lua.overrideAttrs (o: o // { patches = (o.patches or [ ]) ++ [ (pkgs.fetchpatch { url = "https://github.com/sbruder/nvim-solarized-lua/commit/1de58a19498097f43f32a91038f6bc3a524e8110.patch"; sha256 = "sha256-r1Q62C7VllYIfbhsNlW26opA98PIwoPz5cvXmbpAOy0="; }) ]; }))
|
||||
nvim-solarized-lua
|
||||
nvim-treesitter
|
||||
nvim-web-devicons
|
||||
plenary-nvim
|
||||
|
@ -91,6 +91,7 @@ in
|
|||
rust-vim
|
||||
tagbar
|
||||
telescope-nvim
|
||||
telescope-ui-select-nvim
|
||||
trouble-nvim
|
||||
vim-fugitive
|
||||
vim-illuminate
|
||||
|
|
|
@ -9,7 +9,7 @@ local map = vim.api.nvim_set_keymap
|
|||
local function noremap(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true }
|
||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
vim.keymap.set(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
local function associate_filetype(glob, ft)
|
||||
|
@ -53,6 +53,7 @@ opt.shiftwidth = 0 -- shift width = tab width
|
|||
opt.joinspaces = false -- no double spaces when joining
|
||||
opt.clipboard = 'unnamedplus' -- use system clipboard
|
||||
opt.modeline = true
|
||||
opt.mouse = ''; -- I want the mouse to only interact with the terminal, not vim
|
||||
|
||||
cmd([[
|
||||
autocmd BufReadPost * if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' | exe "normal! g`\"" | endif
|
||||
|
@ -174,6 +175,7 @@ require('diffview').setup {}
|
|||
|
||||
-- Fuzzy finder/option picker
|
||||
require('telescope').setup {}
|
||||
require("telescope").load_extension("ui-select")
|
||||
|
||||
-- Completion/Snippets
|
||||
local cmp = require('cmp')
|
||||
|
@ -249,34 +251,31 @@ for type, icon in pairs({ Error = ' ', Warn = ' ', Hint = ' ', Info = '
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<cmd>lua require("telescope.builtin").lsp_definitions()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua require("telescope.builtin").lsp_implementations()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<Leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<Leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<Leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<Leader>D', '<cmd>lua require("telescope.builtin").lsp_type_definitions()<CR>', opts)
|
||||
buf_set_keymap('n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<Leader>ca', '<cmd>lua require("telescope.builtin").lsp_code_actions()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<Leader>d', '<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', '<Leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<Leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', require("telescope.builtin").lsp_definitions, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', require("telescope.builtin").lsp_implementations, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<Leader>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<Leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<Leader>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts)
|
||||
vim.keymap.set('n', '<Leader>D', require("telescope.builtin").lsp_type_definitions, opts)
|
||||
vim.keymap.set('n', '<Leader>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set('n', '<Leader>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<Leader>d', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<Leader>q', vim.diagnostic.setloclist, opts)
|
||||
vim.keymap.set('n', '<Leader>f', function() vim.lsp.buf.format{ async = true } end, opts)
|
||||
|
||||
require('illuminate').on_attach(client)
|
||||
buf_set_keymap('n', '<a-n>', '<cmd>lua require("illuminate").next_reference{wrap=true}<CR>', { noremap = true })
|
||||
buf_set_keymap('n', '<a-p>', '<cmd>lua require("illuminate").next_reference{reverse=true,wrap=true}<CR>', { noremap = true })
|
||||
vim.keymap.set('n', '<a-n>', function() require("illuminate").next_reference{wrap=true} end, opts)
|
||||
vim.keymap.set('n', '<a-p>', function() require("illuminate").next_reference{reverse=true,wrap=true} end, opts)
|
||||
end
|
||||
|
||||
lsp.gopls.setup {
|
||||
|
|
Loading…
Reference in a new issue