dotfiles.nix/configs/init.vim

41 lines
1.2 KiB
VimL

syntax on
filetype plugin indent on
set cursorline "highlight current line
set showmatch "highlight matching [{()}]
set tabstop=2 "number of visual spaces per TAB when reading
set softtabstop=2 "number of spaces per TAB when editing
set expandtab "tabs are spaces
set shiftwidth=2 "indents
set ww=<,>,[,] "wrap
set splitbelow "split underneath
set splitright "split to the right
command Mks NERDTreeClose | mksession!
command Term split | term
command Vterm vsplit | term
"save readonly
cmap w!! w !sudo tee >/dev/null %
"terminal exit
tnoremap <Esc> <C-\><C-n><CR>
"nohl
nnoremap <silent> ,<space> :nohlsearch<CR>
colorscheme tokyonight
let g:lightline = {'colorscheme': 'tokyonight'}
"cursor saving
autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
"nerdtree
"show hidden files
let NERDTreeShowHidden=1
"open on vim open
"autocmd vimenter * NERDTree
"switch to editing window
"autocmd vimenter * wincmd p
"close if only nerdtree is left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"show/hide nerdtree
nnoremap <silent> <c-b> :NERDTreeToggle<CR>