From 779dc64034cc0d272ec6cd4f918cff60d8fab0b6 Mon Sep 17 00:00:00 2001 From: Ruben Dahl Date: Sat, 21 Jan 2023 17:09:36 +0100 Subject: [PATCH] Updated vimrc --- .vimrc | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/.vimrc b/.vimrc index a8ce2e4..b02a1a2 100644 --- a/.vimrc +++ b/.vimrc @@ -1,4 +1,4 @@ -" set cursorline +set cursorline set wildmenu set incsearch set hlsearch @@ -28,17 +28,27 @@ Plugin 'tiagofumo/vim-nerdtree-syntax-highlight' Plugin 'ryanoasis/vim-devicons' Plugin 'airblade/vim-gitgutter' Plugin 'ctrlpvim/ctrlp.vim' -Plugin 'preservim/nerdcommenter' +Plugin 'tpope/vim-commentary' Plugin 'HerringtonDarkholme/yats.vim' Plugin 'mhinz/vim-startify' Plugin 'sbdchd/neoformat' Plugin 'Raimondi/delimitMate' Plugin 'itchyny/lightline.vim' -Plugin 'github/copilot.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 indent on +filetype plugin on +filetype indent on " Opens NERDTree when a directory is opened autocmd StdinReadPre * let s:std_in=1 @@ -92,7 +102,7 @@ let g:NERDDefaultAlign = 'left' let g:NERDAltDelims_java = 1 " Add your own custom formats or override the defaults -let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } +" let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } " Allow commenting and inverting empty lines (useful when commenting a region) let g:NERDCommentEmptyLines = 1 @@ -119,12 +129,18 @@ function! FormatOnSave() let l:formatdiff = 1 pyf ~/.local/bin/clang-format.py endfunction -autocmd BufWritePre *.h,*.cc,*.cpp,*.c call FormatOnSave() +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() ? "\" : "\" @@ -132,14 +148,20 @@ noremap j (v:count == 0 ? 'gj' : 'j') noremap k (v:count == 0 ? 'gk' : 'k') map :NERDTreeToggle inoremap jk -vmap NERDCommenterToggle -nmap NERDCommenterToggle +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 @@ -155,9 +177,8 @@ let g:onedark_hide_endofbuffer = 1 let g:onedark_termcolors = 256 let g:onedark_terminal_italics = 1 -let g:lightline = { - \ 'colorscheme': 'onedark', - \ } +au BufNewFile,BufRead *.c,*.cc,*.h,*.vim call rainbow#load() +" au FileType c,cpp,vim call rainbow#load() " Python tab fix function! s:fixtab() @@ -166,7 +187,15 @@ function! s:fixtab() retab endfunction -command FixTab :call s:fixtab() +command! FixTab :call s:fixtab() syntax on -colorscheme onedark +" colorscheme onedark +" colorscheme jellybeans +" colorscheme gruvbox +" colorscheme kolor +colorscheme edge + +let g:lightline = { + \ 'colorscheme': g:colors_name, + \ }