From 03fc8f45e6647be32f9f24d6ee5bf45c1760148e Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Wed, 19 May 2021 21:39:28 +0200 Subject: [PATCH] Migrate neovim config to lua --- .config/nvim/after/plugin/coc.vim | 139 --------------------- .config/nvim/after/plugin/commands.vim | 28 ----- .config/nvim/after/plugin/keys.vim | 162 ------------------------- .config/nvim/after/plugin/settings.vim | 32 ----- .config/nvim/coc-settings.json | 40 ------ .config/nvim/init.lua | 21 ++++ .config/nvim/init.vim | 126 ------------------- .config/nvim/lua/colorscheme.lua | 3 + .config/nvim/lua/globals.lua | 70 +++++++++++ .config/nvim/lua/keymappings.lua | 155 +++++++++++++++++++++++ .config/nvim/lua/lsp/docker-ls.lua | 6 + .config/nvim/lua/lsp/elixir-ls.lua | 10 ++ .config/nvim/lua/lsp/go-ls.lua | 7 ++ .config/nvim/lua/lsp/init.lua | 116 ++++++++++++++++++ .config/nvim/lua/lsp/json-ls.lua | 16 +++ .config/nvim/lua/lsp/julia-ls.lua | 1 + .config/nvim/lua/lsp/python-ls.lua | 22 ++++ .config/nvim/lua/lsp/terraform-ls.lua | 4 + .config/nvim/lua/plugins/compe.lua | 46 +++++++ .config/nvim/lua/plugins/telescope.lua | 71 +++++++++++ .config/nvim/lua/plugins/which-key.lua | 115 ++++++++++++++++++ .config/nvim/lua/settings.lua | 36 ++++++ 22 files changed, 699 insertions(+), 527 deletions(-) delete mode 100755 .config/nvim/after/plugin/coc.vim delete mode 100755 .config/nvim/after/plugin/commands.vim delete mode 100755 .config/nvim/after/plugin/keys.vim delete mode 100755 .config/nvim/after/plugin/settings.vim delete mode 100755 .config/nvim/coc-settings.json create mode 100644 .config/nvim/init.lua delete mode 100755 .config/nvim/init.vim create mode 100644 .config/nvim/lua/colorscheme.lua create mode 100644 .config/nvim/lua/globals.lua create mode 100644 .config/nvim/lua/keymappings.lua create mode 100644 .config/nvim/lua/lsp/docker-ls.lua create mode 100644 .config/nvim/lua/lsp/elixir-ls.lua create mode 100644 .config/nvim/lua/lsp/go-ls.lua create mode 100644 .config/nvim/lua/lsp/init.lua create mode 100644 .config/nvim/lua/lsp/json-ls.lua create mode 100644 .config/nvim/lua/lsp/julia-ls.lua create mode 100644 .config/nvim/lua/lsp/python-ls.lua create mode 100644 .config/nvim/lua/lsp/terraform-ls.lua create mode 100644 .config/nvim/lua/plugins/compe.lua create mode 100644 .config/nvim/lua/plugins/telescope.lua create mode 100644 .config/nvim/lua/plugins/which-key.lua create mode 100644 .config/nvim/lua/settings.lua diff --git a/.config/nvim/after/plugin/coc.vim b/.config/nvim/after/plugin/coc.vim deleted file mode 100755 index 349caa4..0000000 --- a/.config/nvim/after/plugin/coc.vim +++ /dev/null @@ -1,139 +0,0 @@ -" TextEdit might fail if hidden is not set. -set hidden - -" Some servers have issues with backup files, see #649. -set nobackup -set nowritebackup - -" Give more space for displaying messages. -set cmdheight=2 - -" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable -" delays and poor user experience. -set updatetime=300 - -" Don't pass messages to |ins-completion-menu|. -set shortmess+=c - -" Always show the signcolumn, otherwise it would shift the text each time -" diagnostics appear/become resolved. -if has("patch-8.1.1564") - " Recently vim can merge signcolumn and number column into one - set signcolumn=number -else - set signcolumn=yes -endif - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use tab for trigger completion with characters ahead and navigate. -" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by -" other plugin before putting this into your config. -" inoremap -" \ pumvisible() ? "\" : -" \ check_back_space() ? "\" : -" \ coc#refresh() -" inoremap pumvisible() ? "\" : "\" - -" Use to trigger completion. -if has('nvim') - inoremap coc#refresh() -else - inoremap coc#refresh() -endif - -" Use to confirm completion, `u` means break undo chain at current -" position. Coc only does snippet and additional edit on confirm. -" could be remapped by other vim plugin, try `:verbose imap `. -if exists('*complete_info') - inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" -else - inoremap pumvisible() ? "\" : "\u\" -endif - -" Use `[g` and `]g` to navigate diagnostics -" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation. -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" 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 the symbol and its references when holding the cursor. -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Symbol renaming. -nmap rn (coc-rename) - -" Formatting selected code. -xmap f (coc-format-selected) -nmap f (coc-format-selected) - -augroup mygroup - autocmd! - " Setup formatexpr specified filetype(s). - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder. - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -" Applying codeAction to the selected region. -" Example: `aap` for current paragraph -xmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" Remap keys for applying codeAction to the current buffer. -nmap ac (coc-codeaction) -" Apply AutoFix to problem on the current line. -nmap qf (coc-fix-current) - -" 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) - -" Use CTRL-S for selections ranges. -" Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver -" nmap (coc-range-select) -" xmap (coc-range-select) -" IMPORTANT: disabled because they interfere with - -" Add `:Format` command to format current buffer. -command! -nargs=0 Format :call CocAction('format') - -" Add `:Fold` command to fold current buffer. -command! -nargs=? Fold :call CocAction('fold', ) - -" Add `:OR` command for organize imports of the current buffer. -command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') - -" Add (Neo)Vim's native statusline support. -" NOTE: Please see `:h coc-status` for integrations with external plugins that -" provide custom statusline: lightline.vim, vim-airline. -" set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} -" IMPORTANT: disabled because the statusline is handled by lightline - -" Mappings for CoCList - see ./after/plugged/keys.vim diff --git a/.config/nvim/after/plugin/commands.vim b/.config/nvim/after/plugin/commands.vim deleted file mode 100755 index f8d773b..0000000 --- a/.config/nvim/after/plugin/commands.vim +++ /dev/null @@ -1,28 +0,0 @@ -" -" Commands -" - -" use fd --type f to only show files not ignored by VCS -command! ProjectFiles call fzf#run(fzf#wrap({'source': 'fd --type f'})) - - - -" -" AutoCMDs -" -" automatically go into insert mode when entering terminal -:au BufEnter * if &buftype == 'terminal' | :startinsert | endif - -" force lightline update -autocmd User CocStatusChange,CocDiagnosticChange call lightline#update() - -" tsx/jsx filetypes -autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx -autocmd BufNewFile,BufRead *.tsx set filetype=typescript.tsx -" autocmd BufNewFile,BufRead *.rs set colorcolumn=80,100 - - -" disable scrolloff in the terminal -autocmd TermOpen,TermEnter * setlocal scrolloff=0 -autocmd TermLeave * setlocal scrolloff=8 -" autocmd TermOpen * setlocal scrolloff=0 diff --git a/.config/nvim/after/plugin/keys.vim b/.config/nvim/after/plugin/keys.vim deleted file mode 100755 index a1a3c07..0000000 --- a/.config/nvim/after/plugin/keys.vim +++ /dev/null @@ -1,162 +0,0 @@ -" Keybindings -let mapleader=" " - -" use ;; for escape -" http://vim.wikia.com/wiki/Avoid_the_escape_key -inoremap ;; - -" horizontal split with new buffer -nnoremap bh :new - -" vertical split with new buffer -nnoremap bv :vnew - -" improved keyboard navigation -nnoremap h h -nnoremap j j -nnoremap k k -nnoremap l l - -" Change 2 split windows from vert to horiz or horiz to vert -map th tH -map tk tK - -" Make adjusting split sizes a bit more friendly -noremap :vertical resize +3 -noremap :vertical resize -3 -noremap :resize +3 -noremap :resize -3 - -" improved keyboard support for navigation (especially terminal) -" http://neovim.io/doc/user/nvim_terminal_emulator.html -" tnoremap -" tnoremap h -" tnoremap j -" tnoremap k -" tnoremap l -nnoremap h -nnoremap j -nnoremap k -nnoremap l - -if !exists('g:vscode') - " Auto start NERD tree when opening a directory - " autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | wincmd p | endif - - " Auto start NERD tree if no files are specified - " autocmd StdinReadPre * let s:std_in=1 - " autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | exe 'NERDTree' | endif - - " Let quit work as expected if after entering :q the only window left open is NERD Tree itself - autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif - - " Shortcut to edit THIS configuration file: (e)dit (c)onfiguration - nnoremap ec :e $MYVIMRC - - " Shortcut to source (reload) THIS configuration file after editing it: (s)ource (c)onfiguraiton - nnoremap sc :source $MYVIMRC - - " Toggle NERDTree - " Can't get by itself to work, so this works as Ctrl - space - space - " https://github.com/neovim/neovim/issues/3101 - " http://stackoverflow.com/questions/7722177/how-do-i-map-ctrl-x-ctrl-o-to-ctrl-space-in-terminal-vim#answer-24550772 - "nnoremap :NERDTreeToggle - "nmap - nnoremap :NERDTreeToggle - - " toggle tagbar - nnoremap tb :TagbarToggle - - " toggle line numbers - nnoremap n :set number! number? - - " toggle line wrap - nnoremap w :set wrap! wrap? - - " toggle buffer (switch between current and last buffer) - nnoremap bb - - " go to next buffer - nnoremap bn :bn - nnoremap :bn - - " go to previous buffer - nnoremap bp :bp - " https://github.com/neovim/neovim/issues/2048 - nnoremap :bp - - " close buffer - nnoremap bd :bd - - " kill buffer - nnoremap bk :bd! - - " list buffers - nnoremap bl :ls - " list and select buffer - nnoremap bg :ls:buffer - - " TELESCOPE - " Find files using Telescope command-line sugar. - nnoremap ff Telescope find_files - nnoremap fg Telescope live_grep - - " Maps display of current buffers - nnoremap Telescope buffers - nnoremap fb Telescope buffers - nnoremap fh Telescope help_tags - - " Telescope project - nnoremap fp :Telescope project - - let s:hidden_all = 0 - function! ToggleHiddenAll() - if s:hidden_all == 0 - let s:hidden_all = 1 - set noshowmode - set noruler - set laststatus=0 - set noshowcmd - TagbarClose - NERDTreeClose - else - let s:hidden_all = 0 - set showmode - set ruler - set laststatus=2 - set showcmd - NERDTree - " NERDTree takes focus, so move focus back to the right - " (note: "l" is lowercase L (mapped to moving right) - wincmd l - TagbarOpen - endif - endfunction - - " nnoremap h :call ToggleHiddenAll() - - nnoremap :FloatermNew --height=0.4 --width=0.98 --wintype=floating --position=bottom --autoclose=2 --title= - tnoremap :FloatermNew --height=0.4 --width=0.98 --wintype=floating --position=bottom --autoclose=2 --title= - nnoremap :FloatermPrev - tnoremap :FloatermPrev - nnoremap :FloatermNext - tnoremap :FloatermNext - inoremap :FloatermToggle - nnoremap :FloatermToggle - tnoremap :FloatermToggle - tnoremap - nnoremap :FloatermSend - vnoremap :FloatermSend - - " Automatic formatting for Julia files - autocmd FileType julia nnoremap :JuliaFormatterFormat - - " Maps quit - noremap q :q - - " Maps quit all - noremap :qa - - " Maps write - nnoremap w :w -end diff --git a/.config/nvim/after/plugin/settings.vim b/.config/nvim/after/plugin/settings.vim deleted file mode 100755 index d308649..0000000 --- a/.config/nvim/after/plugin/settings.vim +++ /dev/null @@ -1,32 +0,0 @@ -set background=dark -set clipboard+=unnamedplus -" set colorcolumn=80 -set ignorecase smartcase -set incsearch -set list listchars=tab:⇒\ ,trail:· -set mouse+=a -set noswapfile -set nowrap -set number -set relativenumber -set scrolloff=8 -set termguicolors - -" Set tabstop and shiftwidth to 4 spaces -set expandtab ts=4 sw=4 ai - -" hide mode as it's shown in lightline -set noshowmode - -syntax on - -" open new split panes to right and below (as you probably expect) -set splitright -set splitbelow - -" colorscheme nord -" colorscheme dracula -colorscheme moonlight - -" terminal disable linenumber -au TermOpen * setlocal nonumber norelativenumber diff --git a/.config/nvim/coc-settings.json b/.config/nvim/coc-settings.json deleted file mode 100755 index 6c5e5cc..0000000 --- a/.config/nvim/coc-settings.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "explorer.icon.enableNerdfont": true, - "java.format.enabled": false, - "rust-analyzer.updates.channel": "nightly", - "coc.preferences.formatOnSaveFiletypes": [ - "cs", - "html", - "java", - "javascript", - "json", - "go", - "python", - "rust", - "scala", - "typescript", - "typescript.tsx", - "typescriptreact", - "vue", - "xml" - ], - "languageserver": { - "go": { - "command": "gopls", - "rootPatterns": [ - "go.mod" - ], - "trace.server": "verbose", - "filetypes": [ - "go" - ] - } - }, - "python.formatting.provider": "black", - "python.formatting.blackArgs": [ - "--line-length", - "120" - ], - "python.linting.flake8Enabled": true, - "pyright.enable": true -} diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..7624f6a --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,21 @@ +require('globals') +require('keymappings') +require('settings') +-- Convert to lua +vim.cmd('source ~/.config/nvim/vim-plug/plugins.vim') + + +require('colorscheme') + +require('lsp') +require('lsp.docker-ls') +require('lsp.python-ls') +require('lsp.julia-ls') +require('lsp.json-ls') +require('lsp.elixir-ls') +require('lsp.go-ls') +require('lsp.terraform-ls') + +require('plugins.telescope') +require('plugins.compe') +require('plugins.which-key') diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim deleted file mode 100755 index 3c3300f..0000000 --- a/.config/nvim/init.vim +++ /dev/null @@ -1,126 +0,0 @@ - -call plug#begin() - -Plug 'airblade/vim-gitgutter' -" Plug 'andymass/vim-matchup' -Plug 'editorconfig/editorconfig-vim' - -Plug 'junegunn/vim-easy-align' - -" Multiple cursors for editing -Plug 'mg979/vim-visual-multi', {'branch': 'master'} -Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'tpope/vim-abolish' -Plug 'tpope/vim-fugitive' -Plug 'tpope/vim-surround' -Plug 'edkolev/tmuxline.vim' - -Plug 'majutsushi/tagbar' -let g:tagbar_ctags_bin = '/usr/local/bin/ctags' - -Plug 'itchyny/lightline.vim' -let g:lightline = { - \ 'colorscheme': 'challenger_deep', - \ 'active': { - \ 'left': [ [ 'mode', 'paste' ], - \ [ 'cocstatus', 'readonly', 'gitbranch', 'filename', 'modified' ] ] - \ }, - \ 'component_function': { - \ 'cocstatus': 'coc#status', - \ 'gitbranch': 'FugitiveHead', - \ }, - \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, - \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" } - \ } - -Plug 'airblade/vim-rooter' -let g:rooter_manual_only = 1 - -Plug 'justinmk/vim-sneak' -let g:sneak#label = 1 - -Plug 'machakann/vim-highlightedyank' -let g:highlightedyank_highlight_duration = 100 - -" Easy commenting for Vim -Plug 'preservim/nerdcommenter' - -" Indentation lines -Plug 'Yggdroot/indentLine' -Plug 'lukas-reineke/indent-blankline.nvim' - -" NERD Tree - tree explorer -" https://github.com/scrooloose/nerdtree -" http://usevim.com/2012/07/18/nerdtree/ -" (loaded on first invocation of the command) -Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } -Plug 'ryanoasis/vim-devicons' - -" nerdtree-git-plugin - show git status in NERD Tree -" https://github.com/Xuyuanp/nerdtree-git-plugi -Plug 'Xuyuanp/nerdtree-git-plugin' - -" Enforce editor settings -" https://github.com/editorconfig/editorconfig-vim -Plug 'editorconfig/editorconfig-vim' - -" Terminal in floating window -Plug 'voldikss/vim-floaterm' - -" Telescope fuzzy find files/grep -Plug 'nvim-lua/popup.nvim' -Plug 'nvim-lua/plenary.nvim' -Plug 'nvim-telescope/telescope.nvim' -Plug 'nvim-telescope/telescope-project.nvim' - -""""""""""""""""""""""""" -" => Language Support -""""""""""""""""""""""""" -Plug 'neoclide/jsonc.vim' - -Plug 'vim-python/python-syntax' -let g:python_highlight_all = 1 - -Plug 'JuliaEditorSupport/julia-vim' -let g:latex_to_unicode_auto = 1 - -" Formatting Julia Files -Plug 'kdheepak/JuliaFormatter.vim' - -" themes & colorschemes -Plug 'challenger-deep-theme/vim', { 'as': 'challenger-deep' } -Plug 'dracula/vim', { 'as': 'dracula' } - -Plug 'arcticicestudio/nord-vim' -let g:nord_cursor_line_number_background = 1 -let g:nord_bold = 1 -let g:nord_italic = 1 -let g:nord_italic_comments = 1 - -Plug 'shaunsingh/moonlight.nvim' - -call plug#end() - - -"""""""""""""""""""""""""""""" -" PLUGIN SETTINGS -"""""""""""""""""""""""""""""" - - -"""""""""""""""""""""""""""""" -" VIM-FLOATERM -"""""""""""""""""""""""""""""" - -let g:floaterm_open_command = 'vsplit' - -""""""""""""""""""""" -"JULIA FORMATTER -""""""""""""""""""""" - -let g:JuliaFormatter_options = { - \ 'indent' : 4, - \ 'margin' : 92, - \ 'always_for_in' : v:false, - \ 'whitespace_typedefs' : v:false, - \ 'whitespace_ops_in_indices' : v:true, - \ } diff --git a/.config/nvim/lua/colorscheme.lua b/.config/nvim/lua/colorscheme.lua new file mode 100644 index 0000000..bfd467f --- /dev/null +++ b/.config/nvim/lua/colorscheme.lua @@ -0,0 +1,3 @@ +vim.cmd('let g:nvcode_termcolors=256') + +vim.cmd('colorscheme ' .. O.colorscheme) diff --git a/.config/nvim/lua/globals.lua b/.config/nvim/lua/globals.lua new file mode 100644 index 0000000..fd0af19 --- /dev/null +++ b/.config/nvim/lua/globals.lua @@ -0,0 +1,70 @@ +O = { + auto_close_tree = 0, + auto_complete = true, + background = dark, + ignorecase = smartcase, + clipboard = unnamedplus, + incsearch = true, + termguicolors = true, + colorscheme = 'moonlight', + hidden_files = true, + wrap_lines = false, + number = true, + relative_number = true, + shell = 'zsh', + timeoutlen = 100, + number = true, + scrolloff = 8, + noshowmode = true, + splitright = true, + splitbelow = true, + + database = {save_location = '~/.config/nvcode_db', auto_execute = 1}, + python = { + linter = 'flake8', + -- @usage can be 'yapf', 'black' + formatter = 'black', + autoformat = false, + isort = false, + diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true}, + analysis = {type_checking = "basic", auto_search_paths = true, use_library_code_types = true} + }, + lua = { + -- @usage can be 'lua-format' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true} + }, + sh = { + -- @usage can be 'shellcheck' + linter = '', + -- @usage can be 'shfmt' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true} + }, + tsserver = { + -- @usage can be 'eslint' + linter = '', + -- @usage can be 'prettier' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true} + }, + json = { + -- @usage can be 'prettier' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true} + }, + clang = {diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true}}, + ruby = { + diagnostics = {virtualtext = {spacing = 0, prefix = ""}, signs = true, underline = true}, + filetypes = {'rb', 'erb', 'rakefile'} + }, + -- css = {formatter = '', autoformat = false, virtual_text = true}, + -- json = {formatter = '', autoformat = false, virtual_text = true} +} + +DATA_PATH = vim.fn.stdpath('data') +CACHE_PATH = vim.fn.stdpath('cache') diff --git a/.config/nvim/lua/keymappings.lua b/.config/nvim/lua/keymappings.lua new file mode 100644 index 0000000..e31c614 --- /dev/null +++ b/.config/nvim/lua/keymappings.lua @@ -0,0 +1,155 @@ +vim.g.mapleader = ' ' + +-- TODO find better place +vim.g.floaterm_open_command = 'vsplit' + +-- better window movement +vim.api.nvim_set_keymap('n', '', 'h', {silent = true}) +vim.api.nvim_set_keymap('n', '', 'j', {silent = true}) +vim.api.nvim_set_keymap('n', '', 'k', {silent = true}) +vim.api.nvim_set_keymap('n', '', 'l', {silent = true}) + +-- TODO fix this +-- Terminal window navigation +vim.cmd([[ + tnoremap h + tnoremap j + tnoremap k + tnoremap l + inoremap h + inoremap j + inoremap k + inoremap l + tnoremap +]]) + +-- TODO fix this +-- resize with arrows +vim.cmd([[ + nnoremap :resize -2 + nnoremap :resize +2 + nnoremap :vertical resize +2 + nnoremap :vertical resize -2 +]]) + +-- improved keyboard support for navigation (especially terminal) +vim.cmd([[ + nnoremap h h + nnoremap j j + nnoremap k k + nnoremap l l + nnoremap h + nnoremap j + nnoremap k + nnoremap l +]]) + +-- Change 2 split windows from vert to horiz or horiz to vert +vim.cmd([[ + map th tH + map tk tK +]]) + +-- Make adjusting split sizes a bit more friendly +vim.cmd([[ + noremap :vertical resize +3 + noremap :vertical resize -3 + noremap :resize +3 + noremap :resize -3 +]]) + +-- FloatTerm +vim.cmd([[ + nnoremap :FloatermNew --height=0.4 --width=0.98 --wintype=floating --position=bottom --autoclose=2 --title= + tnoremap :FloatermNew --height=0.4 --width=0.98 --wintype=floating --position=bottom --autoclose=2 --title= + nnoremap :FloatermPrev + tnoremap :FloatermPrev + nnoremap :FloatermNext + tnoremap :FloatermNext + inoremap :FloatermToggle + nnoremap :FloatermToggle + tnoremap :FloatermToggle + tnoremap + nnoremap :FloatermSend + vnoremap :FloatermSend +]]) + +-- Telescope +vim.cmd([[ + nnoremap ff Telescope find_files + nnoremap fg Telescope live_grep + + nnoremap Telescope buffers + nnoremap fb Telescope buffers + nnoremap fh Telescope help_tags +]]) + +-- better indenting +vim.api.nvim_set_keymap('v', '<', '', '>gv', {noremap = true, silent = true}) + +-- I hate escape +vim.api.nvim_set_keymap('i', 'jk', '', {noremap = true, silent = true}) +vim.api.nvim_set_keymap('i', 'kj', '', {noremap = true, silent = true}) +vim.api.nvim_set_keymap('i', 'jj', '', {noremap = true, silent = true}) + +-- Tab switch buffer +vim.api.nvim_set_keymap('n', '', ':bnext', {noremap = true, silent = true}) +vim.api.nvim_set_keymap('n', '', ':bprevious', {noremap = true, silent = true}) + +-- Move selected line / block of text in visual mode +vim.api.nvim_set_keymap('x', 'K', ':move \'<-2gv-gv', {noremap = true, silent = true}) +vim.api.nvim_set_keymap('x', 'J', ':move \'>+1gv-gv', {noremap = true, silent = true}) + + +vim.cmd([[ + if !exists('g:vscode') + " Let quit work as expected if after entering :q the only window left open is NERD Tree itself + autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + + " Toggle NERDTree + " Can't get by itself to work, so this works as Ctrl - space - space + " https://github.com/neovim/neovim/issues/3101 + " http://stackoverflow.com/questions/7722177/how-do-i-map-ctrl-x-ctrl-o-to-ctrl-space-in-terminal-vim#answer-24550772 + "nnoremap :NERDTreeToggle + "nmap + "nnoremap :NERDTreeToggle + + " toggle tagbar + nnoremap tb :TagbarToggle + + " toggle line wrap + nnoremap w :set wrap! wrap? + + " toggle buffer (switch between current and last buffer) + nnoremap bb + + " close buffer + nnoremap bd :bd + + " kill buffer + nnoremap bk :bd! + + " list buffers + nnoremap bl :ls + " list and select buffer + nnoremap bg :ls:buffer + + + + " Telescope project + nnoremap fp :Telescope project + + " Automatic formatting for Julia files + autocmd FileType julia nnoremap :JuliaFormatterFormat + + " Maps quit + noremap q :q + + " Maps quit all + noremap :qa + + " Maps write + nnoremap w :w + end +]]) diff --git a/.config/nvim/lua/lsp/docker-ls.lua b/.config/nvim/lua/lsp/docker-ls.lua new file mode 100644 index 0000000..b477a23 --- /dev/null +++ b/.config/nvim/lua/lsp/docker-ls.lua @@ -0,0 +1,6 @@ +-- npm install -g dockerfile-language-server-nodejs +require'lspconfig'.dockerls.setup { + cmd = {DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio"}, + on_attach = require'lsp'.common_on_attach, + root_dir = vim.loop.cwd +} diff --git a/.config/nvim/lua/lsp/elixir-ls.lua b/.config/nvim/lua/lsp/elixir-ls.lua new file mode 100644 index 0000000..39f6878 --- /dev/null +++ b/.config/nvim/lua/lsp/elixir-ls.lua @@ -0,0 +1,10 @@ +require'lspconfig'.elixirls.setup{ + cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh"}; +} + +-- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir) +vim.cmd([[ + au BufRead,BufNewFile *.ex,*.exs set filetype=elixir + au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir + au BufRead,BufNewFile mix.lock set filetype=elixir +]]) diff --git a/.config/nvim/lua/lsp/go-ls.lua b/.config/nvim/lua/lsp/go-ls.lua new file mode 100644 index 0000000..1311247 --- /dev/null +++ b/.config/nvim/lua/lsp/go-ls.lua @@ -0,0 +1,7 @@ +require'lspconfig'.gopls.setup{ + cmd = {DATA_PATH .. "/lspinstall/go/gopls"}, + settings = {gopls = {analyses = {unusedparams = true}, staticcheck = true}}, + root_dir = require'lspconfig'.util.root_pattern(".git","go.mod","."), + init_options = {usePlaceholders = true, completeUnimported = true}, + on_attach = require'lsp'.common_on_attach +} diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua new file mode 100644 index 0000000..20dc51c --- /dev/null +++ b/.config/nvim/lua/lsp/init.lua @@ -0,0 +1,116 @@ +-- TODO figure out why this don't work +vim.fn.sign_define( + "LspDiagnosticsSignError", + {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"} +) +vim.fn.sign_define( + "LspDiagnosticsSignWarning", + {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"} +) +vim.fn.sign_define( + "LspDiagnosticsSignHint", + {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"} +) +vim.fn.sign_define( + "LspDiagnosticsSignInformation", + {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"} +) + +vim.cmd("nnoremap gd lua vim.lsp.buf.definition()") +vim.cmd("nnoremap gD lua vim.lsp.buf.declaration()") +vim.cmd("nnoremap gr lua vim.lsp.buf.references()") +vim.cmd("nnoremap gi lua vim.lsp.buf.implementation()") +vim.cmd("nnoremap ca :Lspsaga code_action") +vim.cmd("nnoremap K :Lspsaga hover_doc") +-- vim.cmd('nnoremap lua vim.lsp.buf.signature_help()') +vim.cmd("nnoremap :Lspsaga diagnostic_jump_prev") +vim.cmd("nnoremap :Lspsaga diagnostic_jump_next") +-- -- scroll down hover doc or scroll in definition preview +-- vim.cmd("nnoremap lua require('lspsaga.action').smart_scroll_with_saga(1)") +-- -- scroll up hover doc +-- vim.cmd("nnoremap lua require('lspsaga.action').smart_scroll_with_saga(-1)") +-- vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') + +-- Set Default Prefix. +-- Note: You can set a prefix per lsp server in the lv-globals.lua file +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = { + prefix = "", + spacing = 0, + }, + signs = true, + underline = true, + } +) + +-- symbols for autocomplete +vim.lsp.protocol.CompletionItemKind = { + "  (Text) ", + "  (Method)", + "  (Function)", + "  (Constructor)", + " ﴲ (Field)", + "[] (Variable)", + "  (Class)", + " ﰮ (Interface)", + "  (Module)", + " 襁 (Property)", + "  (Unit)", + "  (Value)", + " 練 (Enum)", + "  (Keyword)", + "  (Snippet)", + "  (Color)", + "  (File)", + "  (Reference)", + "  (Folder)", + "  (EnumMember)", + " ﲀ (Constant)", + " ﳤ (Struct)", + "  (Event)", + "  (Operator)", + "  (TypeParameter)" +} + +--[[ " autoformat +autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100) +autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100) +autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]] +-- Java +-- autocmd FileType java nnoremap ca lua require('jdtls').code_action() + +local function documentHighlight(client, bufnr) + -- Set autocommands conditional on server_capabilities + if client.resolved_capabilities.document_highlight then + vim.api.nvim_exec( + [[ + hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646 + hi LspReferenceText cterm=bold ctermbg=red guibg=#464646 + hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646 + 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 +local lsp_config = {} + +function lsp_config.common_on_attach(client, bufnr) + documentHighlight(client, bufnr) +end + +function lsp_config.tsserver_on_attach(client, bufnr) + lsp_config.common_on_attach(client, bufnr) + client.resolved_capabilities.document_formatting = false +end + +-- Use a loop to conveniently both setup defined servers +-- and map buffer local keybindings when the language server attaches +-- local servers = {"pyright", "tsserver"} +-- for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup {on_attach = on_attach} end +return lsp_config diff --git a/.config/nvim/lua/lsp/json-ls.lua b/.config/nvim/lua/lsp/json-ls.lua new file mode 100644 index 0000000..952673a --- /dev/null +++ b/.config/nvim/lua/lsp/json-ls.lua @@ -0,0 +1,16 @@ +-- npm install -g vscode-json-languageserver +require'lspconfig'.jsonls.setup { + cmd = { + "node", DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js", + "--stdio" + }, + on_attach = require'lsp'.common_on_attach, + + commands = { + Format = { + function() + vim.lsp.buf.range_formatting({}, {0, 0}, {vim.fn.line("$"), 0}) + end + } + } +} diff --git a/.config/nvim/lua/lsp/julia-ls.lua b/.config/nvim/lua/lsp/julia-ls.lua new file mode 100644 index 0000000..06d1764 --- /dev/null +++ b/.config/nvim/lua/lsp/julia-ls.lua @@ -0,0 +1 @@ +require'lspconfig'.julials.setup{} diff --git a/.config/nvim/lua/lsp/python-ls.lua b/.config/nvim/lua/lsp/python-ls.lua new file mode 100644 index 0000000..f9af265 --- /dev/null +++ b/.config/nvim/lua/lsp/python-ls.lua @@ -0,0 +1,22 @@ +-- npm i -g pyright +require'lspconfig'.pyright.setup { + cmd = {DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", "--stdio"}, + on_attach = require'lsp'.common_on_attach, + handlers = { + ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = O.python.diagnostics.virtual_text, + signs = O.python.diagnostics.signs, + underline = O.python.diagnostics.underline, + update_in_insert = true + }) + }, + settings = { + python = { + analysis = { + typeCheckingMode = O.python.analysis.type_checking, + autoSearchPaths = O.python.analysis.auto_search_paths, + useLibraryCodeForTypes = O.python.analysis.use_library_code_types + } + } + } +} diff --git a/.config/nvim/lua/lsp/terraform-ls.lua b/.config/nvim/lua/lsp/terraform-ls.lua new file mode 100644 index 0000000..e90d6e7 --- /dev/null +++ b/.config/nvim/lua/lsp/terraform-ls.lua @@ -0,0 +1,4 @@ +require'lspconfig'.terraformls.setup{ + cmd = {DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve"}, + on_attach = require'lsp'.common_on_attach +} diff --git a/.config/nvim/lua/plugins/compe.lua b/.config/nvim/lua/plugins/compe.lua new file mode 100644 index 0000000..44bbefc --- /dev/null +++ b/.config/nvim/lua/plugins/compe.lua @@ -0,0 +1,46 @@ +vim.o.completeopt = "menuone,noselect" + +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 = false; + + source = { + path = true; + buffer = true; + calc = true; + vsnip = true; + nvim_lsp = true; + nvim_lua = true; + spell = true; + tags = true; + snippets_nvim = true; + treesitter = true; + }; +} + +local t = function(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) +end +_G.s_tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "" + elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then + return t "(vsnip-jump-prev)" + else + return t "" + end +end + +vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", {expr = true}) diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..89ce4db --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,71 @@ +local actions = require('telescope.actions') +-- Global remapping +------------------------------ +-- '--color=never', +require('telescope').setup { + defaults = { + find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'}, + prompt_position = "bottom", + -- prompt_prefix = " ", + prompt_prefix = " ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "descending", + layout_strategy = "horizontal", + layout_defaults = {horizontal = {mirror = false}, vertical = {mirror = false}}, + file_sorter = require'telescope.sorters'.get_fuzzy_file, + file_ignore_patterns = {}, + generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, + shorten_path = true, + winblend = 0, + width = 0.75, + preview_cutoff = 120, + results_height = 1, + results_width = 0.8, + border = {}, + borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'}, + color_devicons = true, + use_less = true, + set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil, + file_previewer = require'telescope.previewers'.vim_buffer_cat.new, + grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, + qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, + + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.smart_send_to_qflist + actions.open_qflist, + -- To disable a keymap, put [map] = false + -- So, to not map "", just put + -- [""] = false, + [""] = actions.close, + + -- Otherwise, just set the mapping to the function that you want it to be. + -- [""] = actions.select_horizontal, + + -- Add up multiple actions + [""] = actions.select_default + actions.center + + -- You can perform as many actions in a row as you like + -- [""] = actions.select_default + actions.center + my_cool_custom_action, + }, + n = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.smart_send_to_qflist + actions.open_qflist, + -- [""] = my_cool_custom_action, + } + } + }, + extensions = { + fzy_native = { + override_generic_sorter = false, + override_file_sorter = true, + } + } +} diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..c6b179f --- /dev/null +++ b/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,115 @@ +require("which-key").setup { + plugins = { + marks = true, -- shows a list of your marks on ' and ` + registers = true, -- shows your registers on " in NORMAL or in INSERT mode + -- the presets plugin, adds help for a bunch of default keybindings in Neovim + -- No actual key bindings are created + presets = { + operators = true, -- adds help for operators like d, y, ... + motions = true, -- adds help for motions + text_objects = true, -- help for text objects triggered after entering an operator + windows = true, -- default bindings on + nav = true, -- misc bindings to work with windows + z = true, -- bindings for folds, spelling and others prefixed with z + g = true -- bindings for prefixed with g + } + }, + icons = { + breadcrumb = "»", -- symbol used in the command line area that shows your active key combo + separator = "➜", -- symbol used between a key and it's label + group = "+" -- symbol prepended to a group + }, + window = { + border = "single", -- none, single, double, shadow + position = "bottom", -- bottom, top + margin = {1, 0, 1, 0}, -- extra window margin [top, right, bottom, left] + padding = {2, 2, 2, 2} -- extra window padding [top, right, bottom, left] + }, + layout = { + height = {min = 4, max = 25}, -- min and max height of the columns + width = {min = 20, max = 50}, -- min and max width of the columns + spacing = 3 -- spacing between columns + }, + hidden = {"", "", "", "", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate + show_help = true -- show help message on the command line when the popup is visible +} + +local opts = { + mode = "n", -- NORMAL mode + prefix = "", + buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings + silent = true, -- use `silent` when creating keymaps + noremap = true, -- use `noremap` when creating keymaps + nowait = false -- use `nowait` when creating keymaps +} + +-- Set leader +vim.api.nvim_set_keymap('n', '', '', {noremap = true, silent = true}) +vim.g.mapleader = ' ' + +-- explorer +vim.api.nvim_set_keymap('n', 'e', ':NERDTreeToggle', {noremap = true, silent = true}) + +-- dashboard +vim.api.nvim_set_keymap('n', ';', ':Dashboard', {noremap = true, silent = true}) + +-- TODO create entire treesitter section + +local mappings = { + ["/"] = "Comment", + ["e"] = "Explorer", + f = { + f = {":Telescope find_files", "Find File"} + }, + ["f"] = "Find File", + g = { + name = "+Git", + j = {"NextHunk", "Next Hunk"}, + k = {"PrevHunk", "Prev Hunk"}, + p = {"PreviewHunk", "Preview Hunk"}, + r = {"ResetHunk", "Reset Hunk"}, + R = {"ResetBuffer", "Reset Buffer"}, + s = {"StageHunk", "Stage Hunk"}, + u = {"UndoStageHunk", "Undo Stage Hunk"}, + o = {"Telescope git_status", "Open changed file"}, + b = {"Telescope git_branches", "Checkout branch"}, + c = {"Telescope git_commits", "Checkout commit"}, + C = {"Telescope git_bcommits", "Checkout commit(for current file)"}, + }, + l = { + name = "+LSP", + a = {"Lspsaga code_action", "Code Action"}, + A = {"Lspsaga range_code_action", "Selected Action"}, + d = {"Telescope lsp_document_diagnostics", "Document Diagnostics"}, + D = {"Telescope lsp_workspace_diagnostics", "Workspace Diagnostics"}, + f = {"LspFormatting", "Format"}, + i = {"LspInfo", "Info"}, + l = {"Lspsaga lsp_finder", "LSP Finder"}, + L = {"Lspsaga show_line_diagnostics", "Line Diagnostics"}, + p = {"Lspsaga preview_definition", "Preview Definition"}, + q = {"Telescope quickfix", "Quickfix"}, + r = {"Lspsaga rename", "Rename"}, + t = {"LspTypeDefinition", "Type Definition"}, + x = {"cclose", "Close Quickfix"}, + s = {"Telescope lsp_document_symbols", "Document Symbols"}, + S = {"Telescope lsp_workspace_symbols", "Workspace Symbols"} + }, + + s = { + name = "+Search", + b = {"Telescope git_branches", "Checkout branch"}, + c = {"Telescope colorscheme", "Colorscheme"}, + d = {"Telescope lsp_document_diagnostics", "Document Diagnostics"}, + D = {"Telescope lsp_workspace_diagnostics", "Workspace Diagnostics"}, + f = {"Telescope find_files", "Find File"}, + m = {"Telescope marks", "Marks"}, + M = {"Telescope man_pages", "Man Pages"}, + r = {"Telescope oldfiles", "Open Recent File"}, + R = {"Telescope registers", "Registers"}, + t = {"Telescope live_grep", "Text"} + }, + S = {name = "+Session", s = {"SessionSave", "Save Session"}, l = {"SessionLoad", "Load Session"}} +} + +local wk = require("which-key") +wk.register(mappings, opts) diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua new file mode 100644 index 0000000..2db2367 --- /dev/null +++ b/.config/nvim/lua/settings.lua @@ -0,0 +1,36 @@ +vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object" +vim.cmd('set shortmess+=c') -- Don't pass messages to |ins-completion-menu|. +vim.cmd('set inccommand=split') -- Make substitution work in realtime +vim.o.hidden = O.hidden_files -- Required to keep multiple buffers open multiple buffers +vim.o.title = true +TERMINAL = vim.fn.expand('$TERMINAL') +vim.cmd('let &titleold="'..TERMINAL..'"') +vim.o.titlestring="%<%F%=%l/%L - nvim" +vim.wo.wrap = O.wrap_lines -- Display long lines as just one line +vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys +vim.cmd('syntax on') -- syntax highlighting +vim.o.pumheight = 10 -- Makes popup menu smaller +vim.o.fileencoding = "utf-8" -- The encoding written to file +vim.o.cmdheight = 2 -- More space for displaying messages +vim.cmd('set colorcolumn=99999') -- fix indentline for now +vim.o.mouse = "a" -- Enable your mouse +vim.o.splitbelow = true -- Horizontal splits will automatically be below +vim.o.termguicolors = true -- set term gui colors most terminals support this +vim.o.splitright = true -- Vertical splits will automatically be to the right +vim.o.t_Co = "256" -- Support 256 colors +vim.o.conceallevel = 0 -- So that I can see `` in markdown files +vim.cmd('set ts=4') -- Insert 4 spaces for a tab +vim.cmd('set sw=4') -- Change the number of space characters inserted for indentation +vim.cmd('set expandtab') -- Converts tabs to spaces +vim.bo.smartindent = true -- Makes indenting smart +vim.wo.number = O.number -- set numbered lines +vim.wo.relativenumber = O.relative_number -- set relative number +vim.wo.cursorline = true -- Enable highlighting of the current line +vim.o.showtabline = 2 -- Always show tabs +vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore +vim.o.backup = false -- This is recommended by coc +vim.o.writebackup = false -- This is recommended by coc +vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time +vim.o.updatetime = 300 -- Faster completion +vim.o.timeoutlen = O.timeoutlen -- By default timeoutlen is 1000 ms +vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else