From 7e9d60ab13d69ec20826e26b8cd9797f824fd256 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Sun, 14 Aug 2022 09:10:05 +0200 Subject: neovim built in lsp etc --- nvim/.config/nvim/init.vim | 80 ++++++++++++++++++---------------------------- zsh/dot-zshrc | 2 +- 2 files changed, 32 insertions(+), 50 deletions(-) diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 8a9aa2b..bb42647 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -73,7 +73,7 @@ colorscheme zenburn " {{{ misc set nocompatible -" set cursorcolumn +set cursorcolumn set cursorline set foldmethod=marker set nowrap @@ -113,43 +113,6 @@ let g:airline_powerline_fonts = 1 lua require('lspconfig').hls.setup{} -" nnoremap :call LanguageClient_contextMenu() -" let g:LanguageClient_loggingFile= "~/LanguageClient.log" -" let g:LanguageClient_autoStart = 0 -" let g:LanguageClient_serverCommands = { 'haskell': ['haskell-language-server-wrapper', '--lsp'] } -" let g:LanguageClient_codeLensDisplay = { "virtualTexthl": "SpellRare" } -" let g:LanguageClient_diagnosticsDisplay = -" \ { -" \ 1: { -" \ "name": "Error", -" \ "texthl": "LanguageClientError", -" \ "signText": "x", -" \ "signTexthl": "LanguageClientErrorSign", -" \ "virtualTexthl": "SpellRare", -" \ }, -" \ 2: { -" \ "name": "Warning", -" \ "texthl": "LanguageClientError", -" \ "signText": "!", -" \ "signTexthl": "LanguageClientWarningSign", -" \ "virtualTexthl": "SpellRare", -" \ }, -" \ 3: { -" \ "name": "Information", -" \ "texthl": "LanguageClientError", -" \ "signText": "i", -" \ "signTexthl": "LanguageClientInfoSign", -" \ "virtualTexthl": "SpellRare", -" \ }, -" \ 4: { -" \ "name": "Hint", -" \ "texthl": "LanguageClientError", -" \ "signText": ">", -" \ "signTexthl": "LanguageClientInfoSign", -" \ "virtualTexthl": "SpellRare", -" \ }, -" \ } - let g:haskell_enable_quantification = 1 " to enable highlighting of `forall` let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec` let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc` @@ -209,6 +172,9 @@ nnoremap ? ?\v inoremap jk cnoremap jk +" esc in term +tnoremap + " easy editing and sourcing of vimrc " nnoremap sv :source $MYVIMRC nnoremap ev :e $MYVIMRC @@ -225,14 +191,11 @@ nnoremap h :nohlsearch " show list if multiple ctrl-] matches nnoremap g -augroup filetype_haskell - autocmd! - " autocmd Filetype haskell nnoremap :call LanguageClient#textDocument_definition() - " autocmd Filetype haskell nnoremap i :call LanguageClient#textDocument_hover() - " autocmd Filetype haskell nnoremap x :call LanguageClient#explainErrorAtPoint() - autocmd Filetype haskell setlocal softtabstop=2 - autocmd Filetype haskell setlocal shiftwidth=2 -augroup END +" misc +nmap q :call setqflist(filter(getqflist(),"v:val['type'] == 'E'")) +nnoremap cc :set invcursorcolumn +nnoremap dd :wincmd gf:Gvdiff! develop2 +nnoremap tc :tabc " ctrl-space auto complete in insert mode inoremap @@ -245,7 +208,28 @@ nmap a :Rg | " fuzzy find text in the working directory nmap c :Commands| " fuzzy find Vim commands (like Ctrl-Shift-P in Sublime/Atom/VSC) nmap t :Tags| " fuzzy find tags -nmap q :call setqflist(filter(getqflist(),"v:val['type'] == 'E'")) +" haskell specific +augroup filetype_haskell + autocmd! + autocmd Filetype haskell nnoremap :lua vim.lsp.buf.definition() + autocmd Filetype haskell nnoremap i :lua vim.lsp.buf.hover() + autocmd Filetype haskell nnoremap q :lua vim.lsp.buf.code_action() + autocmd Filetype haskell nnoremap r :lua vim.lsp.buf.references() + autocmd Filetype haskell nnoremap s :lua vim.lsp.buf.document_symbol() + autocmd Filetype haskell nnoremap S :lua vim.lsp.buf.workspace_symbol() + autocmd Filetype haskell nnoremap m :lua vim.diagnostic.open_float() + autocmd Filetype haskell nnoremap e :lua vim.diagnostic.setloclist({open = true}) + autocmd Filetype haskell nnoremap E :lua vim.diagnostic.setqflist({open = true}) + +" vim.lsp.buf.formatting() +" vim.lsp.buf.rename() ? +" print(vim.lsp.buf.server_ready()) + + " autocmd Filetype haskell nnoremap x :call LanguageClient#explainErrorAtPoint() + autocmd Filetype haskell setlocal softtabstop=2 + autocmd Filetype haskell setlocal shiftwidth=2 +augroup END + " }}} hi DiffAdd ctermfg=none ctermbg=23 @@ -253,8 +237,6 @@ hi DiffDelete ctermfg=none ctermbg=52 hi DiffChange ctermfg=none ctermbg=236 hi DiffText ctermfg=none ctermbg=94 -nnoremap dd :wincmd gf:Gvdiff! develop2 -nnoremap tc :tabc " write current file as superuser cmap w!! SudoWrite diff --git a/zsh/dot-zshrc b/zsh/dot-zshrc index 66133d9..ee472f1 100644 --- a/zsh/dot-zshrc +++ b/zsh/dot-zshrc @@ -229,4 +229,4 @@ eval "$(direnv hook zsh)" cd $HOME -if [ -e /home/miguel/.nix-profile/etc/profile.d/nix.sh ]; then . /home/miguel/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer +# if [ -e /home/miguel/.nix-profile/etc/profile.d/nix.sh ]; then . /home/miguel/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer -- cgit v1.2.3