From bf6d4b331680b2b3f3976fdec0691a5d010eb5c5 Mon Sep 17 00:00:00 2001 From: Sergey Besedin Date: Sun, 14 Nov 2021 21:22:27 +0400 Subject: [PATCH] Update --- config/fd/ignore | 3 + config/htop/htoprc | 2 +- config/i3/config | 2 +- config/nvim/init.vim | 385 +++++++++++++++++++++---------------------- rgignore | 3 + 5 files changed, 196 insertions(+), 199 deletions(-) diff --git a/config/fd/ignore b/config/fd/ignore index abcf4fc..f5e9bd7 100644 --- a/config/fd/ignore +++ b/config/fd/ignore @@ -28,3 +28,6 @@ _build/ deps/ priv/static +.ccls-cache/ +.pio/ +.cache/ diff --git a/config/htop/htoprc b/config/htop/htoprc index 48ccd40..4dd7d59 100644 --- a/config/htop/htoprc +++ b/config/htop/htoprc @@ -1,7 +1,7 @@ # Beware! This file is rewritten by htop when settings are changed in the interface. # The parser is also very primitive, and not human-friendly. fields=0 48 17 18 38 39 40 2 46 47 49 1 -sort_key=47 +sort_key=46 sort_direction=1 tree_sort_key=46 tree_sort_direction=1 diff --git a/config/i3/config b/config/i3/config index 9b577d9..3f5ec73 100644 --- a/config/i3/config +++ b/config/i3/config @@ -45,8 +45,8 @@ for_window [class="(?i)discord"] move container to workspace $ws2 for_window [class="mpv"] floating enable for_window [class="(?i)zooout"] floating enable -for_window [class="(?i)qjackctl"] move container to workspace $ws7 floating enable for_window [class="(?i)cadence"] move container to workspace $ws7 floating enable +for_window [class="(?i)catia"] move container to workspace $ws7 floating enable for_window [class="(?i)reaper"] move container to workspace $ws7 for_window [class="(?i)renoise"] move container to workspace $ws7 for_window [class="(?i)uvi"] floating enable diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 8f9af74..50de171 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -30,6 +30,11 @@ Plug 'fatih/vim-go' " Plug 'digitaltoad/vim-jade' Plug 'Glench/Vim-Jinja2-Syntax' Plug 'HerringtonDarkholme/yats.vim' +Plug 'm-pilia/vim-ccls' +Plug 'm-pilia/vim-yggdrasil' + +" Zig +Plug 'ziglang/zig.vim' " Elixir Plug 'elixir-editors/vim-elixir' @@ -43,16 +48,12 @@ Plug 'scrooloose/nerdtree' Plug 'milkypostman/vim-togglelist' " l and q " Snippets -" Plug 'Shougo/neosnippet' -Plug 'Shougo/neosnippet-snippets' -Plug 'honza/vim-snippets' +Plug 'L3MON4D3/LuaSnip' " Appearance Plug 'itchyny/lightline.vim' -Plug 'maximbaz/lightline-ale' Plug 'shinchu/lightline-gruvbox.vim' - -" Plug 'ryanoasis/vim-devicons' +Plug 'spywhere/lightline-lsp' Plug 'editorconfig/editorconfig-vim' Plug 'tpope/vim-surround' @@ -63,12 +64,20 @@ Plug 'rstacruz/vim-closer' Plug 'junegunn/fzf.vim' Plug 'godlygeek/tabular' -Plug 'nathanaelkane/vim-indent-guides' -" Linters and syntax stuff -Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'w0rp/ale' -" +" LSP +Plug 'neovim/nvim-lspconfig' +Plug 'hrsh7th/cmp-nvim-lsp' +Plug 'folke/lsp-colors.nvim' + +Plug 'hrsh7th/cmp-buffer' +Plug 'hrsh7th/cmp-path' +Plug 'hrsh7th/cmp-cmdline' +Plug 'hrsh7th/nvim-cmp' + +" For luasnip users. +Plug 'saadparwaiz1/cmp_luasnip' + " Plug 'tpope/vim-dispatch' Plug 'airblade/vim-gitgutter' Plug 'tpope/vim-fugitive' @@ -90,111 +99,6 @@ set background=dark let base16colorspace=256 colorscheme base16-gruvbox-dark-hard -" NERD Commenter -" Add spaces after comment delimiters by default -" let g:NERDSpaceDelims = 1 -" Use compact syntax for prettified multi-line comments -" let g:NERDCompactSexyComs = 1 -" Align line-wise comment delimiters flush left instead of following code indentation -" let g:NERDDefaultAlign = 'left' -" Allow commenting and inverting empty lines (useful when commenting a region) -" let g:NERDCommentEmptyLines = 1 -" Enable trimming of trailing whitespace when uncommenting -" let g:NERDTrimTrailingWhitespace = 0 - -" Snipmate -" imap snipMateNextOrTrigger -" let g:snipMate = get(g:, 'snipMate', {}) " Allow for vimrc re-sourcing - -" coc.nvim -" -" Use tab for trigger completion with characters ahead and navigate. -" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. - -" inoremap -" \ pumvisible() ? "\" : -" \ check_back_space() ? "\" : -" \ coc#refresh() -" inoremap pumvisible() ? "\" : "\" -" -" function! s:check_back_space() abort -" let col = col('.') - 1 -" return !col || getline('.')[col - 1] =~# '\s' -" endfunction - -" let g:node_client_debug = 1 - -let g:coc_global_extensions = [ - \ 'coc-css', - \ 'coc-fish', - \ 'coc-html', - \ 'coc-lists', - \ 'coc-omni', - \ 'coc-sh', - \ 'coc-tsserver', - \ 'coc-eslint', - \ 'coc-docker', - \ 'coc-highlight', - \ 'coc-json', - \ 'coc-neosnippet', - \ 'coc-rust-analyzer', - \ 'coc-solargraph', - \ 'coc-yaml' - \ ] - -highlight CocErrorSign ctermfg=9 ctermbg=18 guifg=#ff0000 guibg=#3c3836 -highlight CocWarningSign ctermfg=130 ctermbg=18 guifg=#ff922b guibg=#3c3836 -highlight CocInfoSign ctermfg=11 ctermbg=18 guifg=#fab005 guibg=#3c3836 -highlight CocHintSign ctermfg=12 ctermbg=18 guifg=#15aabf guibg=#3c3836 - -" Use to trigger completion. -inoremap coc#refresh() - -" Use to confirm completion, `u` means break undo chain at current position. -" Coc only does snippet and additional edit on confirm. -" inoremap pumvisible() ? "\" : "\u\" -" Or use `complete_info` if your vim support it, like: -" inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" - -" Use `[g` and `]g` to navigate diagnostics -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" Remap keys for gotos -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) -nmap gl :CocList outline - -nnoremap s :CocSearch - -" Use K to show documentation in preview window -nnoremap K :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction - -" Highlight symbol under cursor on CursorHold -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Remap for rename current word -nmap rn (coc-rename) - -" Remap for format selected region -xmap f (coc-format-selected) -nmap f (coc-format-selected) - -" Remap for do codeAction of current line -" nmap ac (coc-codeaction) -" Fix autofix problem of current line -nmap qf (coc-fix-current) - " Required for operations modifying multiple buffers like rename. set hidden @@ -213,48 +117,171 @@ let g:neosnippet#enable_snipmate_compatibility = 1 " Tell Neosnippet about the other snippets let g:neosnippet#snippets_directory='$HOME/.config/nvim/bundle/vim-snippets/snippets' -" ALE -" let g:ale_sign_column_always = 1 -let g:ale_enabled = 1 -let g:ale_list_window_size = 3 -let g:ale_lint_on_save = 1 -let g:ale_lint_on_enter = 0 -let g:ale_lint_on_text_changed = 0 -let g:ale_lint_on_insert_leave = 0 -let g:ale_open_list = 0 -let g:ale_linters_explicit = 1 +" nvim-lspconfig -let g:ale_linters = { - \ 'ruby': ['reek'], - \ 'scss': ['stylelint'], - \ 'sass': ['stylelint'], - \ 'css': ['stylelint'], - \ 'slim': ['slimlint'], - \ } +lua << EOF +local nvim_lsp = require('lspconfig') -let g:ale_fixers = { -\ '*': ['remove_trailing_lines', 'trim_whitespace'], -\} +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +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 -" Set this variable to 1 to fix files when you save them. -let g:ale_fix_on_save = 1 + -- Enable completion triggered by + buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -" let g:ale_set_loclist = 0 -" let g:ale_set_quickfix = 1 -" let g:ale_keep_list_window_open = 1 + -- Mappings. + local opts = { noremap=true, silent=true } -" nmap (ale_previous_wrap) -" nmap (ale_next_wrap) + -- See `:help vim.lsp.*` for documentation on any of the below functions + buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) + buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) + buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) + buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) + buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) + buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) + buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) + buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) + buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) + buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) + buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) + buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) -let g:ale_set_highlights = 1 +end -let g:ale_sign_error = 'E>' -let g:ale_sign_warning = 'W>' +-- Use a loop to conveniently call 'setup' on multiple servers and +-- map buffer local keybindings when the language server attaches +local servers = { + 'eslint', + 'erlangls', + 'solargraph', + 'tsserver', + 'stylelint_lsp', + 'eslint', + 'zls', + 'ansiblels', + 'bashls', + 'ccls' +} -let g:ale_echo_msg_error_str = 'Error' -let g:ale_echo_msg_warning_str = 'Warning' -let g:ale_echo_msg_format = '[%severity%] %s [%linter%]' +-- Setup lspconfig. +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) + +for _, lsp in ipairs(servers) do + nvim_lsp[lsp].setup { + flags = { + debounce_text_changes = 150, + }, + on_attach = on_attach, + capabilities = capabilities + } +end + +nvim_lsp.elixirls.setup{ + cmd = { "elixir-ls" }, + on_attach = on_attach, + capabilities = capabilities +} + +EOF + +set completeopt=menu,menuone,noselect + +lua <'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + + [''] = + cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true + }), + + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { 'i', 's' }), + + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + + [''] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + }) + }) + + -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline('/', { + sources = { + { name = 'buffer' } + } + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }) + +EOF + +" EditorConfig let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] " FZF ripgrep @@ -266,25 +293,6 @@ silent! map :NERDTreeFind let g:NERDTreeMapActivateNode="" let g:NERDTreeMapPreview="" -" RustFmt rust -" let g:rustfmt_autosave = 1 - -" Racer -" let g:racer_experimental_completer = 1 -" au FileType rust nmap gd (rust-def) -" au FileType rust nmap gs (rust-def-split) -" au FileType rust nmap gx (rust-def-vertical) -" au FileType rust nmap gd (rust-doc) - -au BufRead,BufNewFile *.jbuilder setf ruby -au BufRead,BufNewFile *.rabl setf ruby -au BufRead,BufNewFile *.arb setf ruby -au BufRead,BufNewFile *.axlsx setf ruby -au BufRead,BufNewFile *.tag setf coffee " riotjs tags - -" silent! nmap :FufLine -" silent! nmap :FufCoverageFile -" " Lightline let g:lightline = { \ 'colorscheme': 'gruvbox', @@ -294,31 +302,28 @@ let g:lightline = { \ } let g:lightline.component_expand = { - \ 'linter_checking': 'lightline#ale#checking', - \ 'linter_warnings': 'lightline#ale#warnings', - \ 'linter_errors': 'lightline#ale#errors', - \ 'linter_ok': 'lightline#ale#ok', - \ } - -let g:lightline.component_function = { - \ 'cocstatus': 'coc#status' + \ 'linter_hints': 'lightline#lsp#hints', + \ 'linter_infos': 'lightline#lsp#infos', + \ 'linter_warnings': 'lightline#lsp#warnings', + \ 'linter_errors': 'lightline#lsp#errors', + \ 'linter_ok': 'lightline#lsp#ok', \ } let g:lightline.component_type = { - \ 'linter_checking': 'left', + \ 'linter_hints': 'right', + \ 'linter_infos': 'right', \ 'linter_warnings': 'warning', \ 'linter_errors': 'error', - \ 'linter_ok': 'left', + \ 'linter_ok': 'right', \ } let g:lightline.active = { \ 'left': [ [ 'mode', 'paste' ], - \ [ 'gitbranch', 'readonly', 'filename', 'modified' ], - \ [ 'cocstatus' ]], - \ 'right': [ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ], - \ [ 'lineinfo' ], + \ [ 'gitbranch', 'readonly', 'filename', 'modified' ]], + \ 'right': [ [ 'lineinfo' ], \ [ 'percent' ], - \ [ 'fileformat', 'fileencoding', 'filetype' ] ] + \ [ 'fileformat', 'fileencoding', 'filetype' ], + \ [ 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_hints', 'linter_ok' ]] \ } set shell=fish @@ -341,11 +346,6 @@ nnoremap ts :TestSuite " Vim gitgutter let g:gitgutter_enabled = 1 let g:gitgutter_signs = 1 -" let g:gitgutter_sign_added = ' ' -" let g:gitgutter_sign_modified = ' ' -" let g:gitgutter_sign_removed = ' ' -" let g:gitgutter_sign_removed_first_line = ' ' -" let g:gitgutter_sign_modified_removed = ' ' let g:gitgutter_sign_added = '+' let g:gitgutter_sign_modified = '~' let g:gitgutter_sign_removed = '-' @@ -442,14 +442,6 @@ let g:tagbar_type_ruby = { \ ] \} -" vim-indent-guides -" let g:indent_guides_enable_on_vim_startup = 1 -" let g:indent_guides_auto_colors = 0 -" let g:indent_guides_guide_size = 1 -" let g:indent_guides_start_level = 2 -" autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=8 -" autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=0 - " Vimwiki let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}] @@ -484,7 +476,6 @@ set updatetime=300 set hlsearch " Highlight searches set re=0 -" set ttyfast " set lazyredraw set redrawtime=1000 diff --git a/rgignore b/rgignore index 7209c1e..c90c57d 100644 --- a/rgignore +++ b/rgignore @@ -7,3 +7,6 @@ _build/ deps/ node_modules/ priv/static +.ccls-cache/ +.pio/ +.cache/