Updated vimrc

master
Ruben Dahl 2023-01-21 17:09:36 +01:00
parent 4db3b806a9
commit 779dc64034
No known key found for this signature in database
GPG Key ID: C7838D0300EDEF1B
1 changed files with 42 additions and 13 deletions

55
.vimrc
View File

@ -1,4 +1,4 @@
" set cursorline set cursorline
set wildmenu set wildmenu
set incsearch set incsearch
set hlsearch set hlsearch
@ -28,17 +28,27 @@ Plugin 'tiagofumo/vim-nerdtree-syntax-highlight'
Plugin 'ryanoasis/vim-devicons' Plugin 'ryanoasis/vim-devicons'
Plugin 'airblade/vim-gitgutter' Plugin 'airblade/vim-gitgutter'
Plugin 'ctrlpvim/ctrlp.vim' Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'preservim/nerdcommenter' Plugin 'tpope/vim-commentary'
Plugin 'HerringtonDarkholme/yats.vim' Plugin 'HerringtonDarkholme/yats.vim'
Plugin 'mhinz/vim-startify' Plugin 'mhinz/vim-startify'
Plugin 'sbdchd/neoformat' Plugin 'sbdchd/neoformat'
Plugin 'Raimondi/delimitMate' Plugin 'Raimondi/delimitMate'
Plugin 'itchyny/lightline.vim' 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() call vundle#end()
filetype plugin indent on filetype plugin on
filetype indent on
" Opens NERDTree when a directory is opened " Opens NERDTree when a directory is opened
autocmd StdinReadPre * let s:std_in=1 autocmd StdinReadPre * let s:std_in=1
@ -92,7 +102,7 @@ let g:NERDDefaultAlign = 'left'
let g:NERDAltDelims_java = 1 let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults " 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) " Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1 let g:NERDCommentEmptyLines = 1
@ -119,12 +129,18 @@ function! FormatOnSave()
let l:formatdiff = 1 let l:formatdiff = 1
pyf ~/.local/bin/clang-format.py pyf ~/.local/bin/clang-format.py
endfunction 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 autocmd BufWritePre,InsertLeave *.js Neoformat
au BufNewFile,BufRead *.ejs set filetype=html 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 <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
nnoremap <silent> K :call <SID>show_documentation()<CR> nnoremap <silent> K :call <SID>show_documentation()<CR>
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
@ -132,14 +148,20 @@ noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')
noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k') noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
map <C-n> :NERDTreeToggle<CR> map <C-n> :NERDTreeToggle<CR>
inoremap jk <ESC> inoremap jk <ESC>
vmap <C-m> <Plug>NERDCommenterToggle inoremap JK <ESC>
nmap <C-m> <Plug>NERDCommenterToggle
nnoremap <C-h> <C-w><C-h> nnoremap <C-h> <C-w><C-h>
nnoremap <C-j> <C-w><C-j> nnoremap <C-j> <C-w><C-j>
nnoremap <C-k> <C-w><C-k> nnoremap <C-k> <C-w><C-k>
nnoremap <C-l> <C-w><C-l> nnoremap <C-l> <C-w><C-l>
nnoremap ,<space> :nohlsearch<CR> nnoremap ,<space> :nohlsearch<CR>
function s:save_and_source()
exec "w | source %"
endfunction
nnoremap <F10> :call <SID>save_and_source()<CR>
inoremap <F10> <ESC>:call <SID>save_and_source()<CR>
if (has("nvim")) if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 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_termcolors = 256
let g:onedark_terminal_italics = 1 let g:onedark_terminal_italics = 1
let g:lightline = { au BufNewFile,BufRead *.c,*.cc,*.h,*.vim call rainbow#load()
\ 'colorscheme': 'onedark', " au FileType c,cpp,vim call rainbow#load()
\ }
" Python tab fix " Python tab fix
function! s:fixtab() function! s:fixtab()
@ -166,7 +187,15 @@ function! s:fixtab()
retab retab
endfunction endfunction
command FixTab :call s:fixtab() command! FixTab :call s:fixtab()
syntax on syntax on
colorscheme onedark " colorscheme onedark
" colorscheme jellybeans
" colorscheme gruvbox
" colorscheme kolor
colorscheme edge
let g:lightline = {
\ 'colorscheme': g:colors_name,
\ }