diff --git a/init.vim b/init.vim index 09939cc..31a3325 100644 --- a/init.vim +++ b/init.vim @@ -207,7 +207,12 @@ au Syntax * RainbowParenthesesLoadSquare au Syntax * RainbowParenthesesLoadBraces -nnoremap :Files +"nnoremap :Files +nnoremap :Telescope find_files + + +lua require('telescope').load_extension('media_files') + "map f (easymotion-bd-f) "map s (easymotion-overwin-f2) @@ -344,5 +349,19 @@ nnoremap รถ a source $VIM_ROOT/whichkeyConfig.vim -source $VIM_ROOT/lsp.vim +luafile $VIM_ROOT/lsp.lua +"source $VIM_ROOT/lsp.vim + + +" this is apparently necessary for nvim-lsp stuff +set completeopt=menuone,noselect + + +inoremap compe#complete() +inoremap compe#confirm('') +inoremap compe#close('') + + +"nnoremap lua require('lspsaga.action').smart_scroll_with_saga(1) +"nnoremap lua require('lspsaga.action').smart_scroll_with_saga(-1) diff --git a/lsp.lua b/lsp.lua new file mode 100644 index 0000000..26a1ab8 --- /dev/null +++ b/lsp.lua @@ -0,0 +1,96 @@ + + +local lsp = require('lspconfig') +local util = lsp.util +local saga = require('lspsaga') + + + + + +local on_attach = function(client, bufnr) + if client.resolved_capabilities.document_highlight then + vim.api.nvim_exec([[ + hi LspReferenceRead cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828' + hi LspReferenceText cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828' + hi LspReferenceWrite cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828' + augroup lsp_document_highlight + autocmd! * + autocmd CursorHold lua vim.lsp.buf.document_highlight() + autocmd CursorMoved lua vim.lsp.buf.clear_references() + augroup END + ]], false) + end +end + + +lsp.rust_analyzer.setup { on_attach = on_attach } +lsp.jsonls.setup { on_attach = on_attach } +lsp.vimls.setup { on_attach = on_attach } +lsp.tsserver.setup { on_attach = on_attach } +lsp.bashls.setup { on_attach = on_attach } +lsp.html.setup { on_attach = on_attach } + +lsp.denols.setup { + root_dir = lsp.util.root_pattern(".git"); + on_attach = on_attach +} + + +lsp.hls.setup { + on_attach = on_attach, + settings = { + languageServerHaskell = { + formattingProvider = "stylish-haskell" + } + } +} + + +require('compe').setup { + enabled = true; + autocomplete = true; + debug = false; + min_length = 1; + preselect = 'enable'; + throttle_time = 80; + source_timeout = 200; + incomplete_delay = 400; + max_abbr_width = 100; + max_kind_width = 100; + max_menu_width = 100; + documentation = true; + + source = { + path = true; + buffer = true; + calc = true; + nvim_lsp = true; + nvim_lua = true; + vsnip = false; + }; +} + +--vim.lsp.handlers['textDocument/codeAction'] = require('lsputil.codeAction').code_action_handler +--vim.lsp.handlers['textDocument/references'] = require('lsputil.locations').references_handler +--vim.lsp.handlers['textDocument/definition'] = require('lsputil.locations').definition_handler +--vim.lsp.handlers['textDocument/declaration'] = require('lsputil.locations').declaration_handler +--vim.lsp.handlers['textDocument/typeDefinition'] = require('lsputil.locations').typeDefinition_handler +--vim.lsp.handlers['textDocument/implementation'] = require('lsputil.locations').implementation_handler +--vim.lsp.handlers['textDocument/documentSymbol'] = require('lsputil.symbols').document_handler +--vim.lsp.handlers['workspace/symbol'] = require('lsputil.symbols').workspace_handler + + +saga.init_lsp_saga { + border_style = 1, + code_action_keys = { quit = '', exec = '' }, + rename_action_keys = { quit = '', exec = '' }, + finder_action_keys = { + quit = '', + open = '', + vsplit = 'v', + split = 'b', + scroll_up = '', + scroll_down = '' + }, +} diff --git a/plugins.vim b/plugins.vim index 87832d7..55a0280 100644 --- a/plugins.vim +++ b/plugins.vim @@ -7,6 +7,9 @@ endif call plug#begin('~/.vim/plugged') + Plug 'Olical/aniseed', { 'tag': 'v3.16.0' } + Plug 'bakpakin/fennel.vim' + Plug 'tweekmonster/startuptime.vim' Plug 'tpope/vim-repeat' @@ -57,7 +60,7 @@ call plug#begin('~/.vim/plugged') Plug 'unblevable/quick-scope' " highlight targets when pressing f Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } } " :MarkdownPreview for live markdown preview - Plug 'jiangmiao/auto-pairs' + "Plug 'jiangmiao/auto-pairs' Plug 'machakann/vim-highlightedyank' @@ -88,6 +91,9 @@ call plug#begin('~/.vim/plugged') Plug 'bhurlow/vim-parinfer' + Plug 'Olical/conjure', {'tag': 'v4.17.0'} + + " Language Plugins ----------------------------------------------------- {{{ Plug 'ziglang/zig.vim' @@ -101,7 +107,7 @@ call plug#begin('~/.vim/plugged') Plug 'ianks/vim-tsx' Plug 'leafgarland/typescript-vim' Plug 'sheerun/vim-polyglot' " Syntax highlighting for most languages - Plug 'mattn/emmet-vim' + "Plug 'mattn/emmet-vim' Plug 'udalov/kotlin-vim' @@ -119,11 +125,28 @@ call plug#begin('~/.vim/plugged') Plug 'mattn/webapi-vim' - Plug 'neoclide/coc.nvim', {'branch': 'release'} + "Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'thyrgle/vim-dyon' + Plug 'tjdevries/nlua.nvim' + Plug 'nvim-lua/completion-nvim' + "Plug 'mxw/vim-prolog' + Plug 'neovim/nvim-lspconfig' + Plug 'hrsh7th/nvim-compe' + Plug 'glepnir/lspsaga.nvim' + Plug 'cohama/lexima.vim' + + Plug 'nvim-lua/popup.nvim' + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim' + + Plug 'RishabhRD/popfix' + Plug 'RishabhRD/nvim-lsputils' + + Plug 'nvim-telescope/telescope-media-files.nvim' + " }}} call plug#end() diff --git a/whichkeyConfig.vim b/whichkeyConfig.vim index 5f825b4..b02246d 100644 --- a/whichkeyConfig.vim +++ b/whichkeyConfig.vim @@ -23,31 +23,71 @@ let g:which_key_map = { \ } \ } + "\ 's' : [ ':CocFzfList symbols' , 'list symbols' ] , " Maps for code actions +"let g:which_key_map['m'] = { + "\ 'name' : '+Code-actions' , + "\ 'd' : [ ':call luaeval("vim.lsp.buf.hover()")' , 'show documentation' ] , + "\ 'b' : [ ':Lspsaga lsp_finder' , 'find stuff' ] , + "\ 'x' : [ ':Lspsaga preview_definition' , 'Preview definition' ] , + "\ 'o' : [ ':Telescope lsp_document_symbols' , 'symbols in document' ] , + "\ 's' : [ ':Telescope lsp_workspace_symbols' , 'symbols in workspace' ] , + "\ 'g' : [ ':call luaeval("vim.lsp.buf.definition()")' , 'go to definition' ] , + "\ 't' : [ ':call luaeval("vim.lsp.buf.signature_help()")' , 'Show signature help' ] , + "\ 'i' : [ ':call luaeval("vim.lsp.buf.implementation()")' , 'show implementation' ] , + "\ 'r' : [ ':call luaeval("vim.lsp.buf.references()")' , 'show references' ] , + "\ 'n' : [ ':call luaeval("vim.lsp.buf.rename()")' , 'rename' ] , + "\ 'f' : [ ':call luaeval("vim.lsp.buf.formatting()")' , 'format file' ] , + "\ 'v' : [ ':call luaeval("vim.lsp.buf.code_action()")' , 'apply codeaction' ] , + "\ 'e' : [ ':call luaeval("vim.lsp.diagnostic.goto_next()")' , 'Jump to next error' ] , + "\ 'E' : [ ':call luaeval("vim.lsp.diagnostic.goto_prev()")' , 'Jump to previous error' ] , + "\ 'a' : [ ':call luaeval("vim.lsp.diagnostic.show_line_diagnostics()")' , 'diagnostics info' ] , + "\ } + let g:which_key_map['m'] = { - \ 'name' : '+Code-actions' , - \ 'd' : [ ':call Show_documentation()' , 'show documentation' ] , - \ 's' : [ ':CocFzfList symbols' , 'list symbols' ] , - \ 'o' : [ ':CocFzfList outline' , 'show outline' ] , - \ 'c' : [ ':CocFzfList commands' , 'show all coc-commands' ] , - \ 'g' : [ '(coc-definition)' , 'go to definition' ] , - \ 't' : [ '(coc-type-definition)' , 'show type definition' ] , - \ 'i' : [ '(coc-implementation)' , 'show implementation' ] , - \ 'r' : [ '(coc-references-used)' , 'show references' ] , - \ 'b' : [ '(coc-refactor)' , 'refactor' ] , - \ 'n' : [ '(coc-rename)' , 'rename' ] , - \ 'F' : [ '(coc-format-selected)' , 'format selection' ] , - \ 'f' : [ '(coc-format)' , 'format file' ] , - "\ 'v' : [ ':CocCommand actions.open' , 'apply codeaction' ] , - \ 'v' : [ '(coc-codeaction-cursor)', 'apply codeaction' ] , - \ 'V' : [ '(coc-codeaction-line)' , 'codeaction current line'] , - \ 'e' : [ ':CocList diagnostics' , 'list all errors' ] , - \ 'L' : [ '(coc-diagnostic-next)' , 'go to next error' ] , - \ 'H' : [ '(coc-diagnostic-prev)' , 'go to prev error' ] , - \ 'a' : [ '(coc-diagnostic-info)' , 'diagnostics info' ] , - \ 'O' : [ '(coc-openlink)' , 'open link under cursor' ] , - \} + \ 'name' : '+Code-actions' , + \ 'd' : [ ':Lspsaga hover_doc' , 'show documentation' ] , + \ 'b' : [ ':Lspsaga lsp_finder' , 'find stuff' ] , + \ 'x' : [ ':Lspsaga preview_definition' , 'Preview definition' ] , + \ 'o' : [ ':Telescope lsp_document_symbols' , 'symbols in document' ] , + \ 's' : [ ':Telescope lsp_workspace_symbols' , 'symbols in workspace' ] , + \ 'g' : [ ':call luaeval("vim.lsp.buf.definition()")' , 'go to definition' ] , + \ 't' : [ ':Lspsaga signature_help' , 'Show signature help' ] , + \ 'i' : [ ':call luaeval("vim.lsp.buf.implementation()")' , 'show implementation' ] , + \ 'r' : [ ':call luaeval("vim.lsp.buf.references()")' , 'show references' ] , + \ 'n' : [ ':Lspsaga rename' , 'rename' ] , + \ 'f' : [ ':call luaeval("vim.lsp.buf.formatting()")' , 'format file' ] , + \ 'v' : [ ':Lspsaga code_action' , 'apply codeaction' ] , + \ 'e' : [ ':call luaeval("vim.lsp.diagnostic.goto_next()")' , 'Jump to the next error' ] , + \ 'E' : [ ':Telescope lsp_workspace_diagnostics' , 'List diagnostics' ] , + \ 'a' : [ ':Lspsaga show_cursor_diagnostics' , 'Cursor diagnostics' ] , + \ 'A' : [ ':Lspsaga show_line_diagnostics' , 'Line diagnostics' ] , + \ } + +"let g:which_key_map['m'] = { + "\ 'name' : '+Code-actions' , + "\ 'd' : [ ':call Show_documentation()' , 'show documentation' ] , + "\ 's' : [ ':CocFzfList symbols' , 'list symbols' ] , + "\ 'o' : [ ':CocFzfList outline' , 'show outline' ] , + "\ 'c' : [ ':CocFzfList commands' , 'show all coc-commands' ] , + "\ 'g' : [ '(coc-definition)' , 'go to definition' ] , + "\ 't' : [ '(coc-type-definition)' , 'show type definition' ] , + "\ 'i' : [ '(coc-implementation)' , 'show implementation' ] , + "\ 'r' : [ '(coc-references-used)' , 'show references' ] , + "\ 'b' : [ '(coc-refactor)' , 'refactor' ] , + "\ 'n' : [ '(coc-rename)' , 'rename' ] , + "\ 'F' : [ '(coc-format-selected)' , 'format selection' ] , + "\ 'f' : [ '(coc-format)' , 'format file' ] , + ""\ 'v' : [ ':CocCommand actions.open' , 'apply codeaction' ] , + "\ 'v' : [ '(coc-codeaction-cursor)', 'apply codeaction' ] , + "\ 'V' : [ '(coc-codeaction-line)' , 'codeaction current line'] , + "\ 'e' : [ ':CocList diagnostics' , 'list all errors' ] , + "\ 'L' : [ '(coc-diagnostic-next)' , 'go to next error' ] , + "\ 'H' : [ '(coc-diagnostic-prev)' , 'go to prev error' ] , + "\ 'a' : [ '(coc-diagnostic-info)' , 'diagnostics info' ] , + "\ 'O' : [ '(coc-openlink)' , 'open link under cursor' ] , + "\} let g:which_key_map['f'] = { \ 'name': '+folds',