|
|
|
" Disable unused components
|
|
|
|
set nobackup
|
|
|
|
set nocompatible
|
|
|
|
|
|
|
|
" Setup paths
|
|
|
|
set viminfo+=n~/.cache/vim_history
|
|
|
|
|
|
|
|
"" General
|
|
|
|
|
|
|
|
filetype plugin on
|
|
|
|
|
|
|
|
" Behavior
|
|
|
|
set clipboard=unnamedplus
|
|
|
|
set encoding=utf-8
|
|
|
|
set fileencoding=utf-8
|
|
|
|
set hidden
|
|
|
|
|
|
|
|
set history=1000
|
|
|
|
set undolevels=1000
|
|
|
|
|
|
|
|
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc,.png,.jpg
|
|
|
|
set wildignore=*.bak,*.swp,*.o,*.info,*.aux,*.log,*.dvi,*.bbl,*.blg,*.brf,*.cb,*.ind,*.idx,*.ilg,*.inx,*.out,*.toc,*.png,*.jpg
|
|
|
|
|
|
|
|
" Editing
|
|
|
|
set number
|
|
|
|
set ruler
|
|
|
|
|
|
|
|
set background=dark
|
|
|
|
colorscheme hybrid_reverse
|
|
|
|
|
|
|
|
set cursorline
|
|
|
|
autocmd! ColorScheme * hi clear CursorLine
|
|
|
|
|
|
|
|
" Indentation
|
|
|
|
set autoindent
|
|
|
|
filetype indent on
|
|
|
|
|
|
|
|
set backspace=indent,eol,start
|
|
|
|
set shiftround
|
|
|
|
set tabstop=4
|
|
|
|
set softtabstop=4
|
|
|
|
set shiftwidth=4
|
|
|
|
|
|
|
|
" UI
|
|
|
|
set laststatus=2
|
|
|
|
set noshowmode
|
|
|
|
set nowrap
|
|
|
|
|
|
|
|
"" Plugin configuration
|
|
|
|
|
|
|
|
" lightline.vim
|
|
|
|
let g:lightline = {}
|
|
|
|
let g:lightline.colorscheme = 'Tomorrow_Night_Bright'
|
|
|
|
let g:lightline.separator = {'left': "\ue0b0", 'right': "\ue0b2"}
|
|
|
|
let g:lightline.subseparator = {'left': "\ue0b1", 'right': "\ue0b3"}
|
|
|
|
|
|
|
|
" lightline-bufferline
|
|
|
|
let g:lightline.tabline = {'left': [['buffers']], 'right': [['close']]}
|
|
|
|
let g:lightline.component_expand = {'buffers': 'lightline#bufferline#buffers'}
|
|
|
|
let g:lightline.component_type = {'buffers': 'tabsel'}
|
|
|
|
|
|
|
|
let g:lightline#bufferline#min_buffer_count = 2
|
|
|
|
|
|
|
|
" NERD Commenter
|
|
|
|
let g:NERDCommentEmptyLines=1
|
|
|
|
let g:NERDSpaceDelims=1
|
|
|
|
let g:NERDTrimTrailingWhitespace=1
|
|
|
|
|
|
|
|
" NERD Tree
|
|
|
|
let g:NERDTreeMinimalUI=1
|
|
|
|
let g:NERDTreeAutoDeleteBuffer=1
|
|
|
|
|
|
|
|
" vimtex
|
|
|
|
let g:tex_flavor = 'latex'
|
|
|
|
let g:vimtex_view_method = 'zathura'
|
|
|
|
|
|
|
|
"" Autocommands
|
|
|
|
|
|
|
|
" Remove trailing whitespace in the following filetypes
|
|
|
|
autocmd FileType c,cpp,ino,java,py,php,sh,tex autocmd BufWritePre <buffer> %s/\s\+$//e
|
|
|
|
|
|
|
|
" Close vim if only window is NERD Tree
|
|
|
|
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
|
|
|
|
|
|
|
"" Functions
|
|
|
|
|
|
|
|
function! CloseTab()
|
|
|
|
let bufNr = bufnr('%')
|
|
|
|
let nerdTreeStatus = exists('t:NERDTreeBufName') && bufwinnr(t:NERDTreeBufName) != -1
|
|
|
|
let currentFile = expand('%:t')
|
|
|
|
|
|
|
|
if nerdTreeStatus
|
|
|
|
execute "NERDTreeClose"
|
|
|
|
if currentFile !~# "NERD_tree"
|
|
|
|
execute "bw "bufNr
|
|
|
|
execute "NERDTreeToggle"
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
execute "bw "bufNr
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
"" Keybindings
|
|
|
|
|
|
|
|
" Tab/Shift+Tab functionality
|
|
|
|
nnoremap <Tab> >>_
|
|
|
|
nnoremap <S-Tab> <<_
|
|
|
|
inoremap <S-Tab> <C-D>
|
|
|
|
vnoremap <Tab> >gv
|
|
|
|
vnoremap <S-Tab> <gv
|
|
|
|
|
|
|
|
" Buffer switching
|
|
|
|
nnoremap <silent> <C-h> :bprevious<CR>
|
|
|
|
nnoremap <silent> <C-l> :bnext<CR>
|
|
|
|
nnoremap <silent> <C-w> :call CloseTab()<CR>
|
|
|
|
nmap <Leader>1 <Plug>lightline#bufferline#go(1)
|
|
|
|
|
|
|
|
" Toggle NERD Tree
|
|
|
|
nnoremap <silent> <C-t> :NERDTreeToggle<CR>
|
|
|
|
|