From 1a7be45469b00e3f8b19d84e6b8db04023e41242 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Sun, 4 Apr 2021 15:08:59 +0200 Subject: [PATCH] more cleanup --- fnl/keybinds.fnl | 9 +-- init.vim | 18 +----- lsp.lua | 96 ------------------------------ lsp.vim | 120 ------------------------------------- whichkeyConfig.vim | 143 --------------------------------------------- 5 files changed, 4 insertions(+), 382 deletions(-) delete mode 100644 lsp.lua delete mode 100644 lsp.vim delete mode 100644 whichkeyConfig.vim diff --git a/fnl/keybinds.fnl b/fnl/keybinds.fnl index 0345beb..c83aba5 100644 --- a/fnl/keybinds.fnl +++ b/fnl/keybinds.fnl @@ -71,9 +71,6 @@ (set nvim.o.timeoutlen 200) - - -; TODO -; autocmd! VimEnter * :unmap ig -; autocmd! FileType which_key) - +(nvim.command + "autocmd! VimEnter * :unmap ig + autocmd! FileType which_key") diff --git a/init.vim b/init.vim index 865045f..9951286 100644 --- a/init.vim +++ b/init.vim @@ -346,25 +346,9 @@ nnoremap รถ a -source $VIM_ROOT/whichkeyConfig.vim - -"luafile $VIM_ROOT/lsp.lua -"source $VIM_ROOT/lsp.vim +"source $VIM_ROOT/whichkeyConfig.vim let g:aniseed#env = v:true - let g:lexima_no_default_rules = v:true call lexima#set_default_rules() - -"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 deleted file mode 100644 index 26a1ab8..0000000 --- a/lsp.lua +++ /dev/null @@ -1,96 +0,0 @@ - - -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/lsp.vim b/lsp.vim deleted file mode 100644 index ed81c9b..0000000 --- a/lsp.vim +++ /dev/null @@ -1,120 +0,0 @@ -hi link haskellOperators GruvboxAqua -hi link haskellImportKeywords GruvboxPurple - - -let g:vista_default_executive = 'coc' -let g:vista_sidebar_position = 'vertical topleft' -let g:vista_sidebar_width = '50' - - -let g:coc_global_extensions = [ - \ 'coc-yank', 'coc-vimlsp', 'coc-prettier', 'coc-eslint', - \ 'coc-diagnostic', 'coc-yaml', 'coc-tsserver', - \ 'coc-json', 'coc-go', 'coc-html', 'coc-css', 'coc-clangd', - \ 'coc-actions', 'coc-yank' - \ ] - -" 'coc-rust-analyzer', - - -let g:echodoc#enable_at_startup = 1 -let g:echodoc#type = "echo" - -" vim-jsx -autocmd! BufRead,BufNewFile *.tsx setlocal syntax=javascript.jsx - - -" make emmet behave well with JSX in JS and TS files -let g:user_emmet_settings = { 'javascript': { 'extends': 'jsx' }, 'typescript': { 'extends': 'tsx' }} -let g:user_emmet_mode='n' - - -" Use to trigger completion. -inoremap coc#refresh() - - "? idk -"inoremap pumvisible() ? "\" : check_back_space() ? "\" : coc#refresh() -"inoremap pumvisible() ? "\" : "\" - - -" Show documentation for vim stuff, and run doHover otherWise -function! Show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction - - -" Show all diagnostics. -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~ '\s' -endfunction - - -"Close preview window when completion is done. -autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif - -setlocal formatprg=floskell\ --style\ chris-done - -set signcolumn=yes -set cmdheight=1 -set updatetime=300 - -" maybe helps coc? -set nobackup -set nowritebackup - - -hi CocUnderline gui=undercurl term=undercurl -hi CocErrorHighlight ctermfg=red guifg=#c4384b gui=undercurl term=undercurl -hi CocWarningHighlight ctermfg=yellow guifg=#c4ab39 gui=undercurl term=undercurl -autocmd CursorHold * silent call CocActionAsync('highlight') - -hi link CocWarningSign GruvboxYellow -hi link CocInfoSign GruvboxAqua -hi link CocHintErrorSign GruvboxBlue -hi link CocErrorSign GruvboxRed - -autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') - -" Map function and class text objects -" NOTE: Requires 'textDocument.documentSymbol' support from the language server. -xmap if (coc-funcobj-i) -omap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) - - - -" Snippet stuff {{{ - - -" Use for trigger snippet expand. -imap (coc-snippets-expand) - -" Use for select text for visual placeholder of snippet. -vmap (coc-snippets-select) - -" Use for jump to next placeholder, it's default of coc.nvim -let g:coc_snippet_next = '' - -" Use for jump to previous placeholder, it's default of coc.nvim -let g:coc_snippet_prev = '' - -" Use for both expand and jump (make expand higher priority.) -imap (coc-snippets-expand-jump) - -" Use x for convert visual selected code to snippet -xmap x (coc-convert-snippet) - -" }}} - - - diff --git a/whichkeyConfig.vim b/whichkeyConfig.vim deleted file mode 100644 index b49ea57..0000000 --- a/whichkeyConfig.vim +++ /dev/null @@ -1,143 +0,0 @@ -"nnoremap :WhichKey '' -"vnoremap :'WhichKeyVisual '' -"let g:which_key_map = {} -"call which_key#register('', "g:which_key_map") - - - - - - "\ 'h' : 'which_key_ignore', 'l' : 'which_key_ignore' , - "\ 'h' : ':bprevious', 'l' : ':bnext' , - "\ 'h' : [':BufferPrevious', 'prev buffer'], 'l' : [':BufferNext', 'next buffer'] , -"let g:which_key_map = { - "\ 'h' : [':bprevious', 'prev buffer'], 'l' : [':bnext', 'next buffer'], - "\ 'f' : 'which_key_ignore', 's': 'which_key_ignore' , - "\ 'c' : { 'name': '+comment_out' }, - "\ 'e' : { 'name': '+emmet' }, - "\ '[' : ['(YoinkPostPasteSwapBack)', 'Swap last paste backwards' ], - "\ ']' : ['(YoinkPostPasteSwapForward)', 'Swap last paste backwards' ], - "\ ':' : [':Commands' , 'Search command with fzf' ], - "\ 'z' : { 'name': '+folds', 'c': ['foldclose', 'close fold'], - "\ 'o': ['foldopen', 'open fold'] , - "\ } - "\ } - - "\ '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' ] , - "\ } - -" this is the one! -"let g:which_key_map['m'] = { - "\ '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', - "\ 'o': [ ':foldopen' , 'open fold' ] , - "\ 'n': [ ':foldclose' , 'close fold' ] , - "\ 'j': [ 'zj' , 'jump to next fold' ] , - "\ 'k': [ 'zk' , 'jump to previous fold' ] , - "\ } - - -"" mappings for view and layout -"let g:which_key_map['v'] = { - "\ 'name' : '+view-and-layout', - "\ 'n' : [':set relativenumber!' , 'toggle relative numbers' ] , - "\ 'm' : [':set nonumber! norelativenumber' , 'toggle numbers'] , - "\ 'g' : [':Goyo | set linebreak' , 'toggle focus mode' ] , - "\ 'i' : [':IndentGuidesToggle' , 'toggle indent guides' ] , - "\ } - - "" :bwipeout! bdelete! - ""\ 'b' : ['BufferPick' , 'select open buffer' ] , - ""\ 'c' : ['BufferClose', 'close open buffer' ] , - ""\ 'w' : ['BufferWipeout', 'wipeout open buffer' ] , -"let g:which_key_map['b'] = { - "\ 'name': '+buffers', - "\ 'b' : [':Buffers' , 'select open buffer' ] , - "\ 'c' : [':bdelete!', 'close open buffer' ] , - "\ 'w' : [':bwipeout!', 'wipeout open buffer' ] , - "\ } - -"let g:which_key_map['x'] = { - "\ 'name' : '+other', - "\ 'f' : ['NERDTreeToggle' , ' show file tree'], - "\ 'p' : ['FZF' , ' search file (c-v/c-x to open in split)' ] , - "\ 'h' : [':History:' , 'search command history'], - "\ 'c' : [':Commands' , 'search through commands'], - "\ 's' : ['OverCommandLine', 'Substitute with preview'], - "\ 'y' : [':CocFzfList yank', 'Show yank history'] - "\ } - -" CocList -A --normal yank needs :CocInstall coc-yank - - - -"nnoremap m :WhichKey 'm' - autocmd! VimEnter * :unmap ig - autocmd! FileType which_key - "autocmd! FileType which_key set laststatus=2 noshowmode noruler - "\| autocmd! BufLeave set laststatus=2 showmode ruler - -"set timeoutlen=200 -