set nocompatible so ~/.config/nvim/plugins.vim so ~/.config/nvim/word_processing.vim " --Plugin Configurations let g:go_gopls_enabled = 1 let g:go_go_fmt_command="gopls" let g:go_gopls_gofumpt=1 let g:airline#extensions#tabline#enabled = 1 let g:airline_powerline_fonts = 1 let g:svelte_indent_script = 0 let g:svelte_indent_style = 0 set title "Update title of the terminal set number "Display line numbers set relativenumber set ruler "Display cursor position set wrap "Wrap lines when they are long set scrolloff=3 "Display 3 lines around the cursor when scrolling set clipboard+=unnamedplus " use system clipboard set guicursor+=a:blinkon0 filetype on filetype plugin on filetype plugin indent on filetype indent on "--Search set ignorecase "Case insensitive search set smartcase "Just in case I still want case sensitive search "Case sensitive when there's upper case set incsearch "Incremental search set hlsearch "Highlight search results noremap // :nohls noremap ; : command WQ wq command Wq q command W w command Q w "--Beep set noerrorbells "Vim is annoying set shiftwidth=4 set tabstop=4 set scrolloff=10 set softtabstop=0 let &t_ut='' set updatetime=100 "Vim gitgutter "--My ColorScheme set background=dark set termguicolors let g:srcery_italic=1 let g:srcery_bold=1 colorscheme srcery hi Comment guifg=#b799bd ctermfg=102 hi Normal guibg=#NONE ctermbg=NONE let mapleader="," inoremap jj inoremap :call CocActionAsync('showSignatureHelp') inoremap :GoIfErrI noremap y :VCopy vnoremap y :VCopyVisual noremap w :e noremap e :CocCommand explorer --toggle noremap E :Files noremap b :Buffers nnoremap :bprev nnoremap :bnext inoremap :bprev inoremap :bnext nnoremap d :bp:bd # " (f)ind in file, (g)rep, (h)elp noremap f :tabnew:Find noremap g :GoRun noremap h :help noremap p :PrettierAsync noremap so :so ~/.config/nvim/init.vim if exists('g:started_by_firenvim') au BufEnter github.com_*.txt set filetype=markdown au BufEnter play.golang.org_*.txt set filetype=go inoremap endif autocmd FileType html,css,scss setlocal ts=4 sts=4 sw=4 expandtab autocmd FileType javascript,typescript,typescriptreact,svelte setlocal ts=2 sts=2 sw=2 expandtab autocmd FileType markdown setlocal ts=2 sts=2 sw=2 expandtab autocmd FileType sql setlocal ts=2 sts=2 sw=2 expandtab autocmd BufNewFile,BufRead .*config,*.config,config \ setlocal filetype=gitconfig autocmd BufNewFile,BufRead *.bolt \ setlocal filetype=typescript autocmd BufNewFile,BufRead *.cql \ setlocal filetype=cql autocmd BufNewFile,BufRead *.gradle,*.groovy \ setlocal filetype=groovy autocmd BufNewFile,BufRead *.osgjs,*.osgjs.gz \ setlocal filetype=json autocmd BufNewFile,BufRead *.postcss \ setlocal filetype=css autocmd BufNewFile,BufRead *.go.tpl,*.peg,*.qtpl \ setlocal syntax=go autocmd BufNewFile,BufRead *.gunk \ setlocal filetype=gunk syntax=go autocmd BufNewFile,BufRead *.gltf \ setlocal filetype=gltf syntax=json autocmd BufNewFile,BufRead *.frag \ setlocal filetype=glsl syntax=glsl " Coc.NVIM " Set internal encoding of vim, not needed on neovim, since coc.nvim using some " unicode characters in the file autoload/float.vim set encoding=utf-8 " TextEdit might fail if hidden is not set. set hidden " 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 inoremap \ pumvisible() ? coc#_select_confirm() : \ coc#expandableOrJumpable() ? \ "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : \ check_back_space() ? "\" : \ coc#refresh() function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction let g:coc_snippet_next = '' " Map for trigger completion let g:coc_snippetnext = '' inoremap coc#refresh() " Make auto-select the first completion item and notify coc.nvim to " format on enter, could be remapped by other vim plugin inoremap pumvisible() ? coc#_select_confirm() \: "\u\\=coc#on_enter()\" " 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('') elseif (coc#rpc#ready()) call CocActionAsync('doHover') else execute '!' . &keywordprg . " " . expand('') endif endfunction function! s:doHover() if coc#rpc#ready() let diagnostics = CocAction('diagnosticList') if empty(diagnostics) call CocActionAsync('doHover') return endif let file = expand('%:p') let lnum = line('.') let cnum = col('.') for v in diagnostics if v['file'] != file \ || lnum != v['lnum'] \ || cnum < v['location']['range']['start']['character'] \ || cnum > v['location']['range']['end']['character'] call CocActionAsync('doHover') return endif endfor endif endfunction " Highlight the symbol and its references when holding the cursor. autocmd CursorHold * silent call CocActionAsync('highlight') " Symbol renaming. nmap rn (coc-rename) 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 " 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) " Remap and for scroll float windows/popups. if has('nvim-0.4.0') || has('patch-8.2.0750') nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" endif " 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','')} let g:airline_theme='base16_bespin' " Mappings for CoCList " Show all diagnostics. nnoremap a :CocList diagnostics " Manage extensions. nnoremap e :CocList extensions " Show commands. nnoremap c :CocList commands " Find symbol of current document. nnoremap o :CocList outline " Search workspace symbols. nnoremap s :CocList -I symbols " Do default action for next item. nnoremap j :CocNext " Do default action for previous item. " filenames like *.xml, *.html, *.xhtml, ... " These are the file extensions where this plugin is enabled. " let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.svelte' " filenames like *.xml, *.xhtml, ... " This will make the list of non-closing tags self-closing in the specified files. " let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.svelte' " filetypes like xml, html, xhtml, ... " These are the file types where this plugin is enabled. " let g:closetag_filetypes = 'html,xhtml,phtml,svelte' " filetypes like xml, xhtml, ... " This will make the list of non-closing tags self-closing in the specified files. " let g:closetag_xhtml_filetypes = 'xhtml,jsx,svelte' " integer value [0|1] " This will make the list of non-closing tags case-sensitive (e.g. `` will be closed while `` won't.) " let g:closetag_emptyTags_caseSensitive = 1 " dict " Disables auto-close if not in a "valid" region (based on filetype) " let g:closetag_regions = { \ 'typescript.tsx': 'jsxRegion,tsxRegion', \ 'javascript.jsx': 'jsxRegion', \ 'typescriptreact': 'jsxRegion,tsxRegion', \ 'javascriptreact': 'jsxRegion', \ } " Shortcut for closing tags, default is '>' " let g:closetag_shortcut = '>' " Add > at current position without closing the current tag, default is '' " let g:closetag_close_shortcut = '>'