diff --git a/neovim/.config/nvim/init.vim b/neovim/.config/nvim/init.vim new file mode 100644 index 0000000..6f3a6ea --- /dev/null +++ b/neovim/.config/nvim/init.vim @@ -0,0 +1,111 @@ +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 + +call plug#end() + +"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 +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 + +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() diff --git a/neovim/.config/nvim/plugged/auto-pairs b/neovim/.config/nvim/plugged/auto-pairs new file mode 160000 index 0000000..39f06b8 --- /dev/null +++ b/neovim/.config/nvim/plugged/auto-pairs @@ -0,0 +1 @@ +Subproject commit 39f06b873a8449af8ff6a3eee716d3da14d63a76 diff --git a/neovim/.config/nvim/plugged/coc.nvim b/neovim/.config/nvim/plugged/coc.nvim new file mode 160000 index 0000000..d3e40ce --- /dev/null +++ b/neovim/.config/nvim/plugged/coc.nvim @@ -0,0 +1 @@ +Subproject commit d3e40ceabd76323c07434fc2711521cc8bb2d028 diff --git a/neovim/.config/nvim/plugged/colorizer b/neovim/.config/nvim/plugged/colorizer new file mode 160000 index 0000000..5fd7d90 --- /dev/null +++ b/neovim/.config/nvim/plugged/colorizer @@ -0,0 +1 @@ +Subproject commit 5fd7d909e5c06f033136bf4e079bf4ebb24d1503 diff --git a/neovim/.config/nvim/plugged/lightline.vim b/neovim/.config/nvim/plugged/lightline.vim new file mode 160000 index 0000000..8a71236 --- /dev/null +++ b/neovim/.config/nvim/plugged/lightline.vim @@ -0,0 +1 @@ +Subproject commit 8a712365f9708044667589d9fffd87a4825d29f6 diff --git a/neovim/.config/nvim/plugged/nerdcommenter b/neovim/.config/nvim/plugged/nerdcommenter new file mode 160000 index 0000000..1b53686 --- /dev/null +++ b/neovim/.config/nvim/plugged/nerdcommenter @@ -0,0 +1 @@ +Subproject commit 1b53686d5f1d1607dc67430e9243283fee3a9764 diff --git a/neovim/.config/nvim/plugged/nerdtree b/neovim/.config/nvim/plugged/nerdtree new file mode 160000 index 0000000..81f3eab --- /dev/null +++ b/neovim/.config/nvim/plugged/nerdtree @@ -0,0 +1 @@ +Subproject commit 81f3eaba295b3fceb2d032db57e5eae99ae480f8 diff --git a/neovim/.config/nvim/plugged/rainbow b/neovim/.config/nvim/plugged/rainbow new file mode 160000 index 0000000..4d15633 --- /dev/null +++ b/neovim/.config/nvim/plugged/rainbow @@ -0,0 +1 @@ +Subproject commit 4d15633cdaf61602e1d9fd216a77fc02e0881b2d diff --git a/neovim/.config/nvim/plugged/vim-gitgutter b/neovim/.config/nvim/plugged/vim-gitgutter new file mode 160000 index 0000000..9756e95 --- /dev/null +++ b/neovim/.config/nvim/plugged/vim-gitgutter @@ -0,0 +1 @@ +Subproject commit 9756e95bd596a303946a90f06f4efe51dcd57e87 diff --git a/neovim/.config/nvim/plugged/vim-sandwich b/neovim/.config/nvim/plugged/vim-sandwich new file mode 160000 index 0000000..9e6340a --- /dev/null +++ b/neovim/.config/nvim/plugged/vim-sandwich @@ -0,0 +1 @@ +Subproject commit 9e6340affe9f53c11a6975a5f50b9bf48adb692c