let $MYPLUGDIRECTORY = "~/.config/nvim/plugged/" "plugins call plug#begin($MYPLUGDIRECTORY) Plug 'scrooloose/nerdtree' " file tree Plug 'luochen1990/rainbow' " rainbow colored parenthesis and brakets Plug 'itchyny/lightline.vim' " statusline Plug 'preservim/nerdcommenter' " easier comment management Plug 'neoclide/coc.nvim', {'branch': 'release'} " code completion Plug 'jiangmiao/auto-pairs' " automatic pairs Plug 'machakann/vim-sandwich' " manipulate elements surrounding other elements Plug 'airblade/vim-gitgutter' " show git changes Plug 'vim-scripts/colorizer' " colorize color codes Plug 'honza/vim-snippets' " snippets Plug 'lervag/vimtex' " vimtex call plug#end() " coc plugins let g:coc_global_extensions = ['coc-snippets', 'coc-git', 'coc-vimtex'] "neovim-remote for vimtex let g:vimtex_compiler_progname = 'nvr' "vimtex let g:vimtex_view_method = 'zathura' " lightline set laststatus=2 "NERDTree autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif set nocompatible " disable compatibility to old-time vi set showmatch " show matching brackets. set mouse=v " middle-click paste with mouse set hlsearch " highlight search results set tabstop=4 " number of columns occupied by a tab character set softtabstop=4 " see multiple spaces as tabstops so does the right thing set expandtab " converts tabs to white space set shiftwidth=4 " width for autoindents set autoindent " indent a new line the same amount as the line just typed set wildmode=longest,list " get bash-like tab completions filetype plugin indent on " allows auto-indenting depending on file type syntax on " syntax highlighting let mapleader=" " " set mapleader to space let maplocalleader=" " " set localleader to space set timeoutlen=1000 " set timeout length "colors colorscheme default "extra specified colors highlight ColorColumn ctermbg=8 highlight clear SignColumn highlight GitGutterAdd ctermfg=2 highlight GitGutterChange ctermfg=3 highlight GitGutterDelete ctermfg=1 highlight LineNr ctermfg=7 highlight CursorLineNr ctermfg=7 set cc=80 " set an 80 column border for good coding style "toggle cc when reasonable augroup cctoggle autocmd! autocmd BufEnter,FocusGained * set cc=80 autocmd BufLeave,FocusLost * set cc=0 augroup END "toggle relativenumber when reasonable set number relativenumber augroup numbertoggle autocmd! autocmd BufEnter,FocusGained,InsertLeave * set relativenumber autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber augroup END "gitgutter update speed set updatetime=100 "gitgutter signs let g:gitgutter_sign_added = '+' let g:gitgutter_sign_modified = '~' let g:gitgutter_sign_removed = '-' let g:gitgutter_sign_removed_first_line = '^' "-------------------- "mappings "-------------------- "custom window ommands nnoremap wv v nnoremap ws s nnoremap wc c nnoremap wo o nnoremap h nnoremap l nnoremap j nnoremap k nnoremap öw :w nnoremap öq :q "custom tab commands nnoremap tn :tabnew "show buffers nnoremap b :buffers:buffer "reload settings nnoremap rl :source ~/.config/nvim/init.vim "NERDTree commands nnoremap nt :NERDTreeToggle nnoremap f :NERDTreeFind "symbol renaming nnoremap rn (coc-reame) " use for trigger completion and navigate to the next complete item function! s:check_back_space() abort let col = col('.')- 1 return !col || getline('.')[col - 1] =~ '\s' endfunction " Make used for trigger completion, completion confirm, snippet expand and jump like VSCode. 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 = ''