dotfiles/vimrc/.vimrc

84 lines
2.0 KiB
VimL
Raw Normal View History

2022-07-14 04:21:21 +00:00
" Set
filetype indent plugin on
" Syntax highlighting
2022-03-12 21:38:58 +00:00
syntax on
2022-07-14 04:21:21 +00:00
" Add number rows
2022-08-31 03:55:23 +00:00
set relativenumber
set scrolloff=999
2022-07-14 04:21:21 +00:00
" No swap file
set noswapfile
" Incremental search & highlight
set incsearch
set hls
" Runtime path
let $RTP=split(&runtimepath, ',')[0]
let $RC="$HOME/.vimrc"
" Set default path
set path=.,**
2022-07-31 20:13:01 +00:00
" Plugin stuff
execute pathogen#infect()
" Always show file name
set laststatus=2
2022-08-03 00:07:53 +00:00
" Enter to insert blank line below current, Shift+Enter to insert above
map <Enter> o<ESC>
map <S-Enter> O<ESC>
2022-07-31 20:13:01 +00:00
" Folding (move to python specific vim file?)
set foldmethod=indent
2022-08-31 03:55:23 +00:00
set foldnestmax=99
set foldlevelstart=99
2022-07-31 20:13:01 +00:00
nnoremap <space> za
vnoremap <space> zf
2022-08-21 00:12:35 +00:00
" F9 execute current Python file
autocmd FileType python map <buffer> <F9> :w<CR>:exec '!clear;python' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:exec '!clear;python' shellescape(@%, 1)<CR>
2022-08-23 02:59:38 +00:00
" Cycle through buffers
map [b :bp<CR>
map ]b :bn<CR>
map db :bd<CR>
" Toggle Nerd tree
map <F4> :NERDTreeToggle<CR>
" Save, Save and quit
map <F1> :w<CR>
map <F2> :wq<CR>
" Lint
autocmd FileType python map <buffer> gl :w<CR>:exec '!python -m black' shellescape(@%, 1)<CR>
2022-08-31 03:55:23 +00:00
" Automatically open NERDTree
autocmd VimEnter * NERDTree | wincmd p
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
" Open the existing NERDTree on each new tab.
autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif
2022-09-01 15:32:09 +00:00
" Show hidden
let NERDTreeShowHidden=1
" colorscheme moonfly
" colorscheme onenord
2022-09-29 01:44:12 +00:00
" colorscheme gruvbox-baby
" colorscheme tender