neovim: Adapt to 22.11

This commit is contained in:
Simon Bruder 2022-12-10 17:16:34 +01:00
parent b6a903551e
commit 5d98924ea1
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
2 changed files with 35 additions and 35 deletions

View file

@ -49,19 +49,19 @@ in
haskell-language-server haskell-language-server
rnix-lsp rnix-lsp
rust-analyzer rust-analyzer
# very ugly, but required to make non-yapf/autopep8 formatters work (python3.withPackages (ps: with ps; [
((python3.override {
packageOverrides = _: prev: {
python-lsp-server = prev.python-lsp-server.override {
withAutopep8 = false;
withYapf = false;
};
};
}).withPackages (ps: with ps; [
pyls-isort pyls-isort
#pylsp-mypy # FIXME pylsp-mypy
python-lsp-black python-lsp-black
python-lsp-server python-lsp-server
# pylsp optional dependencies
flake8
mccabe
pycodestyle
pydocstyle
pyflakes
pylint
])) ]))
nodePackages."@tailwindcss/language-server" nodePackages."@tailwindcss/language-server"
universal-ctags universal-ctags
@ -83,7 +83,7 @@ in
neogit neogit
nvim-cmp nvim-cmp
nvim-lspconfig 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-treesitter
nvim-web-devicons nvim-web-devicons
plenary-nvim plenary-nvim
@ -91,6 +91,7 @@ in
rust-vim rust-vim
tagbar tagbar
telescope-nvim telescope-nvim
telescope-ui-select-nvim
trouble-nvim trouble-nvim
vim-fugitive vim-fugitive
vim-illuminate vim-illuminate

View file

@ -9,7 +9,7 @@ local map = vim.api.nvim_set_keymap
local function noremap(mode, lhs, rhs, opts) local function noremap(mode, lhs, rhs, opts)
local options = { noremap = true } local options = { noremap = true }
if opts then options = vim.tbl_extend('force', options, opts) end 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 end
local function associate_filetype(glob, ft) 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.joinspaces = false -- no double spaces when joining
opt.clipboard = 'unnamedplus' -- use system clipboard opt.clipboard = 'unnamedplus' -- use system clipboard
opt.modeline = true opt.modeline = true
opt.mouse = ''; -- I want the mouse to only interact with the terminal, not vim
cmd([[ cmd([[
autocmd BufReadPost * if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' | exe "normal! g`\"" | endif autocmd BufReadPost * if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' | exe "normal! g`\"" | endif
@ -174,6 +175,7 @@ require('diffview').setup {}
-- Fuzzy finder/option picker -- Fuzzy finder/option picker
require('telescope').setup {} require('telescope').setup {}
require("telescope").load_extension("ui-select")
-- Completion/Snippets -- Completion/Snippets
local cmp = require('cmp') local cmp = require('cmp')
@ -249,34 +251,31 @@ for type, icon in pairs({ Error = ' ', Warn = ' ', Hint = ' ', Info = '
end end
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
buf_set_keymap('n', 'gd', '<cmd>lua require("telescope.builtin").lsp_definitions()<CR>', opts) vim.keymap.set('n', 'gd', require("telescope.builtin").lsp_definitions, opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
buf_set_keymap('n', 'gi', '<cmd>lua require("telescope.builtin").lsp_implementations()<CR>', opts) vim.keymap.set('n', 'gi', require("telescope.builtin").lsp_implementations, opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
buf_set_keymap('n', '<Leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) vim.keymap.set('n', '<Leader>wa', vim.lsp.buf.add_workspace_folder, opts)
buf_set_keymap('n', '<Leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) vim.keymap.set('n', '<Leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
buf_set_keymap('n', '<Leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) vim.keymap.set('n', '<Leader>wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts)
buf_set_keymap('n', '<Leader>D', '<cmd>lua require("telescope.builtin").lsp_type_definitions()<CR>', opts) vim.keymap.set('n', '<Leader>D', require("telescope.builtin").lsp_type_definitions, opts)
buf_set_keymap('n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) vim.keymap.set('n', '<Leader>rn', vim.lsp.buf.rename, opts)
buf_set_keymap('n', '<Leader>ca', '<cmd>lua require("telescope.builtin").lsp_code_actions()<CR>', opts) vim.keymap.set('n', '<Leader>ca', vim.lsp.buf.code_action, opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
buf_set_keymap('n', '<Leader>d', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) vim.keymap.set('n', '<Leader>d', vim.diagnostic.open_float, opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
buf_set_keymap('n', '<Leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) vim.keymap.set('n', '<Leader>q', vim.diagnostic.setloclist, opts)
buf_set_keymap('n', '<Leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) vim.keymap.set('n', '<Leader>f', function() vim.lsp.buf.format{ async = true } end, opts)
require('illuminate').on_attach(client) require('illuminate').on_attach(client)
buf_set_keymap('n', '<a-n>', '<cmd>lua require("illuminate").next_reference{wrap=true}<CR>', { noremap = true }) vim.keymap.set('n', '<a-n>', function() require("illuminate").next_reference{wrap=true} end, opts)
buf_set_keymap('n', '<a-p>', '<cmd>lua require("illuminate").next_reference{reverse=true,wrap=true}<CR>', { noremap = true }) vim.keymap.set('n', '<a-p>', function() require("illuminate").next_reference{reverse=true,wrap=true} end, opts)
end end
lsp.gopls.setup { lsp.gopls.setup {