diff --git a/.vimrc b/.vimrc deleted file mode 100644 index b02a1a2..0000000 --- a/.vimrc +++ /dev/null @@ -1,201 +0,0 @@ -set cursorline -set wildmenu -set incsearch -set hlsearch -set nu rnu -set tabstop=4 -set softtabstop=4 -set shiftwidth=4 -set autoindent -set textwidth=80 -set noshowmode -set expandtab -syntax on -set nocompatible -let mapleader=" " -filetype off - -set path+=/usr/include/nodejs/src/ - -set rtp+=~/.vim/bundle/Vundle.vim -call vundle#begin() - -Plugin 'VundleVim/Vundle.vim' -Plugin 'preservim/nerdtree' -Plugin 'joshdick/onedark.vim' -Plugin 'w0rp/ale' -Plugin 'tiagofumo/vim-nerdtree-syntax-highlight' -Plugin 'ryanoasis/vim-devicons' -Plugin 'airblade/vim-gitgutter' -Plugin 'ctrlpvim/ctrlp.vim' -Plugin 'tpope/vim-commentary' -Plugin 'HerringtonDarkholme/yats.vim' -Plugin 'mhinz/vim-startify' -Plugin 'sbdchd/neoformat' -Plugin 'Raimondi/delimitMate' -Plugin 'itchyny/lightline.vim' -Plugin 'roxma/nvim-yarp' -Plugin 'ncm2/ncm2' -Plugin 'ncm2/ncm2-pyclang' -Plugin 'frazrepo/vim-rainbow' - -" colorschemes -Plugin 'nanotech/jellybeans.vim' -Plugin 'morhetz/gruvbox' -Plugin 'zeis/vim-kolor' -Plugin 'sainnhe/edge' - -call vundle#end() - -filetype plugin on -filetype indent on - -" Opens NERDTree when a directory is opened -autocmd StdinReadPre * let s:std_in=1 -autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif - -" Exit NERDTree if all files have closed -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif - -" Check if NERDTree is open or active -function! IsNERDTreeOpen() - return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1) -endfunction - -" Call NERDTreeFind if NERDTree is active, current window contains a modifiable -" file and we're not in vimdiff -function! s:synctree() - if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff - nerdtreefind - wincmd p - endif -endfunction - -function s:refresh() - if IsNERDTreeOpen() - exec "NERDTreeRefreshRoot" - exec "NERDTreeRefreshRoot" - endif -endfunction - -map :call refresh() - -set hidden -set updatetime=300 -set signcolumn=yes - -let g:NERDTreeGitStatusWithFlags = 1 -let g:NERDTreeIgnore = ['^node_modules$'] -" Create default mappings -let g:NERDCreateDefaultMappings = 1 - -" 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' - -" Set a language to use its alternate delimiters by default -let g:NERDAltDelims_java = 1 - -" Add your own custom formats or override the defaults -" let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } - -" 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 = 1 - -" Enable NERDCommenterToggle to check all selected lines is commented or not -let g:NERDToggleCheckAllLines = 1 - -let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] - -let g:ale_linters_explicit = 1 -let g:ale_linters = { 'cpp': ['g++'], 'c': ['gcc'] } -let g:ale_cpp_cc_options = "-std=c++17" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Autoformat with clang-format -function! FormatOnSave() - let l:formatdiff = 1 - pyf ~/.local/bin/clang-format.py -endfunction -autocmd BufWritePre *.h,*.hpp,*.cc,*.cpp,*.cxx,*.c++,*.c call FormatOnSave() - -autocmd BufWritePre,InsertLeave *.js Neoformat - -au BufNewFile,BufRead *.ejs set filetype=html - -au BufEnter * call ncm2#enable_for_buffer() - -set completeopt=noinsert,menuone,noselect - -let g:ncm2_pyclang#library_path='/usr/lib/x86_64-linux-gnu/libclang-14.so' - -inoremap pumvisible() ? "\" : "\u\" -nnoremap K :call show_documentation() -inoremap pumvisible() ? "\" : "\" -noremap j (v:count == 0 ? 'gj' : 'j') -noremap k (v:count == 0 ? 'gk' : 'k') -map :NERDTreeToggle -inoremap jk -inoremap JK -nnoremap -nnoremap -nnoremap -nnoremap -nnoremap , :nohlsearch - -function s:save_and_source() - exec "w | source %" -endfunction - -nnoremap :call save_and_source() -inoremap :call save_and_source() - -if (has("nvim")) - "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > - let $NVIM_TUI_ENABLE_TRUE_COLOR=1 -endif - "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > - "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > - " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > -if (has("termguicolors")) - set termguicolors -endif - -let g:onedark_hide_endofbuffer = 1 -let g:onedark_termcolors = 256 -let g:onedark_terminal_italics = 1 - -au BufNewFile,BufRead *.c,*.cc,*.h,*.vim call rainbow#load() -" au FileType c,cpp,vim call rainbow#load() - -" Python tab fix -function! s:fixtab() - set expandtab - set tabstop=4 - retab -endfunction - -command! FixTab :call s:fixtab() - -syntax on -" colorscheme onedark -" colorscheme jellybeans -" colorscheme gruvbox -" colorscheme kolor -colorscheme edge - -let g:lightline = { - \ 'colorscheme': g:colors_name, - \ } diff --git a/.vimrc b/.vimrc new file mode 120000 index 0000000..2f0f4f0 --- /dev/null +++ b/.vimrc @@ -0,0 +1 @@ +.vimrc_plug \ No newline at end of file diff --git a/.vimrc_plug b/.vimrc_plug new file mode 100644 index 0000000..02cc0a8 --- /dev/null +++ b/.vimrc_plug @@ -0,0 +1,199 @@ +set cursorline +set wildmenu +set incsearch +set hlsearch +set nu rnu +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set autoindent +set textwidth=80 +set noshowmode +set expandtab +syntax on +set nocompatible +let mapleader=" " +filetype off + +set path+=/usr/include/nodejs/src/ + +call plug#begin() + +Plug 'preservim/nerdtree' +Plug 'joshdick/onedark.vim' +Plug 'w0rp/ale' +Plug 'tiagofumo/vim-nerdtree-syntax-highlight' +Plug 'ryanoasis/vim-devicons' +Plug 'airblade/vim-gitgutter' +Plug 'ctrlpvim/ctrlp.vim' +Plug 'tpope/vim-commentary' +Plug 'HerringtonDarkholme/yats.vim' +Plug 'mhinz/vim-startify' +Plug 'sbdchd/neoformat' +Plug 'Raimondi/delimitMate' +Plug 'itchyny/lightline.vim' +Plug 'roxma/nvim-yarp' +Plug 'ncm2/ncm2' +Plug 'ncm2/ncm2-pyclang' +Plug 'frazrepo/vim-rainbow' + +" colorschemes +Plug 'nanotech/jellybeans.vim' +Plug 'morhetz/gruvbox' +Plug 'zeis/vim-kolor' +Plug 'sainnhe/edge' + +call plug#end() + +filetype plugin on +filetype indent on + +" Opens NERDTree when a directory is opened +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif + +" Exit NERDTree if all files have closed +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + +" Check if NERDTree is open or active +function! IsNERDTreeOpen() + return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1) +endfunction + +" Call NERDTreeFind if NERDTree is active, current window contains a modifiable +" file and we're not in vimdiff +function! s:synctree() + if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff + nerdtreefind + wincmd p + endif +endfunction + +function s:refresh() + if IsNERDTreeOpen() + exec "NERDTreeRefreshRoot" + exec "NERDTreeRefreshRoot" + endif +endfunction + +map :call refresh() + +set hidden +set updatetime=300 +set signcolumn=yes + +let g:NERDTreeGitStatusWithFlags = 1 +let g:NERDTreeIgnore = ['^node_modules$'] +" Create default mappings +let g:NERDCreateDefaultMappings = 1 + +" 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' + +" Set a language to use its alternate delimiters by default +let g:NERDAltDelims_java = 1 + +" Add your own custom formats or override the defaults +" let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } + +" 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 = 1 + +" Enable NERDCommenterToggle to check all selected lines is commented or not +let g:NERDToggleCheckAllLines = 1 + +let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] + +let g:ale_linters_explicit = 1 +let g:ale_linters = { 'cpp': ['g++'], 'c': ['gcc'] } +let g:ale_cpp_cc_options = "-std=c++17" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Autoformat with clang-format +function! FormatOnSave() + let l:formatdiff = 1 + pyf ~/.local/bin/clang-format.py +endfunction +autocmd BufWritePre *.h,*.hpp,*.cc,*.cpp,*.cxx,*.c++,*.c call FormatOnSave() + +autocmd BufWritePre,InsertLeave *.js Neoformat + +au BufNewFile,BufRead *.ejs set filetype=html + +au BufEnter * call ncm2#enable_for_buffer() + +set completeopt=noinsert,menuone,noselect + +let g:ncm2_pyclang#library_path='/usr/lib/x86_64-linux-gnu/libclang-14.so' + +inoremap pumvisible() ? "\" : "\u\" +nnoremap K :call show_documentation() +inoremap pumvisible() ? "\" : "\" +noremap j (v:count == 0 ? 'gj' : 'j') +noremap k (v:count == 0 ? 'gk' : 'k') +map :NERDTreeToggle +inoremap jk +inoremap JK +nnoremap +nnoremap +nnoremap +nnoremap +nnoremap , :nohlsearch + +function s:save_and_source() + exec "w | source %" +endfunction + +nnoremap :call save_and_source() +inoremap :call save_and_source() + +if (has("nvim")) + "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > + let $NVIM_TUI_ENABLE_TRUE_COLOR=1 +endif + "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > + "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > + " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > +if (has("termguicolors")) + set termguicolors +endif + +let g:onedark_hide_endofbuffer = 1 +let g:onedark_termcolors = 256 +let g:onedark_terminal_italics = 1 + +au BufNewFile,BufRead *.c,*.cc,*.h,*.vim call rainbow#load() +" au FileType c,cpp,vim call rainbow#load() + +" Python tab fix +function! s:fixtab() + set expandtab + set tabstop=4 + retab +endfunction + +command! FixTab :call s:fixtab() + +syntax on +" colorscheme onedark +" colorscheme jellybeans +" colorscheme gruvbox +" colorscheme kolor +colorscheme edge + +let g:lightline = { + \ 'colorscheme': g:colors_name, + \ } diff --git a/.vimrc_vundle b/.vimrc_vundle new file mode 100644 index 0000000..b02a1a2 --- /dev/null +++ b/.vimrc_vundle @@ -0,0 +1,201 @@ +set cursorline +set wildmenu +set incsearch +set hlsearch +set nu rnu +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set autoindent +set textwidth=80 +set noshowmode +set expandtab +syntax on +set nocompatible +let mapleader=" " +filetype off + +set path+=/usr/include/nodejs/src/ + +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() + +Plugin 'VundleVim/Vundle.vim' +Plugin 'preservim/nerdtree' +Plugin 'joshdick/onedark.vim' +Plugin 'w0rp/ale' +Plugin 'tiagofumo/vim-nerdtree-syntax-highlight' +Plugin 'ryanoasis/vim-devicons' +Plugin 'airblade/vim-gitgutter' +Plugin 'ctrlpvim/ctrlp.vim' +Plugin 'tpope/vim-commentary' +Plugin 'HerringtonDarkholme/yats.vim' +Plugin 'mhinz/vim-startify' +Plugin 'sbdchd/neoformat' +Plugin 'Raimondi/delimitMate' +Plugin 'itchyny/lightline.vim' +Plugin 'roxma/nvim-yarp' +Plugin 'ncm2/ncm2' +Plugin 'ncm2/ncm2-pyclang' +Plugin 'frazrepo/vim-rainbow' + +" colorschemes +Plugin 'nanotech/jellybeans.vim' +Plugin 'morhetz/gruvbox' +Plugin 'zeis/vim-kolor' +Plugin 'sainnhe/edge' + +call vundle#end() + +filetype plugin on +filetype indent on + +" Opens NERDTree when a directory is opened +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif + +" Exit NERDTree if all files have closed +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + +" Check if NERDTree is open or active +function! IsNERDTreeOpen() + return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1) +endfunction + +" Call NERDTreeFind if NERDTree is active, current window contains a modifiable +" file and we're not in vimdiff +function! s:synctree() + if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff + nerdtreefind + wincmd p + endif +endfunction + +function s:refresh() + if IsNERDTreeOpen() + exec "NERDTreeRefreshRoot" + exec "NERDTreeRefreshRoot" + endif +endfunction + +map :call refresh() + +set hidden +set updatetime=300 +set signcolumn=yes + +let g:NERDTreeGitStatusWithFlags = 1 +let g:NERDTreeIgnore = ['^node_modules$'] +" Create default mappings +let g:NERDCreateDefaultMappings = 1 + +" 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' + +" Set a language to use its alternate delimiters by default +let g:NERDAltDelims_java = 1 + +" Add your own custom formats or override the defaults +" let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } + +" 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 = 1 + +" Enable NERDCommenterToggle to check all selected lines is commented or not +let g:NERDToggleCheckAllLines = 1 + +let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] + +let g:ale_linters_explicit = 1 +let g:ale_linters = { 'cpp': ['g++'], 'c': ['gcc'] } +let g:ale_cpp_cc_options = "-std=c++17" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Autoformat with clang-format +function! FormatOnSave() + let l:formatdiff = 1 + pyf ~/.local/bin/clang-format.py +endfunction +autocmd BufWritePre *.h,*.hpp,*.cc,*.cpp,*.cxx,*.c++,*.c call FormatOnSave() + +autocmd BufWritePre,InsertLeave *.js Neoformat + +au BufNewFile,BufRead *.ejs set filetype=html + +au BufEnter * call ncm2#enable_for_buffer() + +set completeopt=noinsert,menuone,noselect + +let g:ncm2_pyclang#library_path='/usr/lib/x86_64-linux-gnu/libclang-14.so' + +inoremap pumvisible() ? "\" : "\u\" +nnoremap K :call show_documentation() +inoremap pumvisible() ? "\" : "\" +noremap j (v:count == 0 ? 'gj' : 'j') +noremap k (v:count == 0 ? 'gk' : 'k') +map :NERDTreeToggle +inoremap jk +inoremap JK +nnoremap +nnoremap +nnoremap +nnoremap +nnoremap , :nohlsearch + +function s:save_and_source() + exec "w | source %" +endfunction + +nnoremap :call save_and_source() +inoremap :call save_and_source() + +if (has("nvim")) + "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > + let $NVIM_TUI_ENABLE_TRUE_COLOR=1 +endif + "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > + "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > + " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > +if (has("termguicolors")) + set termguicolors +endif + +let g:onedark_hide_endofbuffer = 1 +let g:onedark_termcolors = 256 +let g:onedark_terminal_italics = 1 + +au BufNewFile,BufRead *.c,*.cc,*.h,*.vim call rainbow#load() +" au FileType c,cpp,vim call rainbow#load() + +" Python tab fix +function! s:fixtab() + set expandtab + set tabstop=4 + retab +endfunction + +command! FixTab :call s:fixtab() + +syntax on +" colorscheme onedark +" colorscheme jellybeans +" colorscheme gruvbox +" colorscheme kolor +colorscheme edge + +let g:lightline = { + \ 'colorscheme': g:colors_name, + \ } diff --git a/install-vimplug.sh b/install-vimplug.sh new file mode 100755 index 0000000..5d7de6b --- /dev/null +++ b/install-vimplug.sh @@ -0,0 +1,2 @@ +curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim