diff options
Diffstat (limited to '.vimrc')
-rw-r--r-- | .vimrc | 147 |
1 files changed, 147 insertions, 0 deletions
@@ -0,0 +1,147 @@ +" Pathogen runtime +execute pathogen#infect() +call pathogen#helptags() + +colorscheme desert +" URL: http://vim.wikia.com/wiki/Example_vimrc +" Authors: http://vim.wikia.com/wiki/Vim_on_Freenode +set nocompatible +filetype indent plugin on +filetype plugin on +syntax on +set list +set number +set hidden +set wildmenu +set showcmd +set hlsearch +set smartcase +" Allow backspacing over autoindent, line breaks and start of insert action +set backspace=indent,eol,start +set smartindent +set nostartofline +" Display the cursor position on the last line of the screen or in the status +" line of a window +set ruler +set confirm +set visualbell +set mouse=a +"set cmdheight=2 +"set laststatus=2 +" Quickly time out on keycodes, but never time out on mappings +set notimeout ttimeout ttimeoutlen=200 +set spell + +"------------------------------------------------------------ +"----- CUSTOM MAPPINGS +" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy, +" which is the default +map Y y$ +" Map <C-L> (redraw screen) to also turn off search highlighting until the +" next search +nnoremap <C-L> :nohl<CR><C-L> + +" From https://github.com/theicfire/dotfiles/blob/master/vim/.vimrc +" With a map leader it's possible to do extra key combinations +" like <leader>w saves the current file +let mapleader = " " +" auto indent for brackets +inoremap {<CR> {<CR>}<Esc>O +" paste from outside buffer (i.e. outside of vim) +nnoremap <leader>p :set paste<CR>"+p:set nopaste<CR> +vnoremap <leader>p <Esc>:set paste<CR>gv"+p:set nopaste<CR> +" copy to outside buffer +vnoremap <leader>y "+y +" select all +nnoremap <leader>a ggVG +" paste from 0 register +" Useful because `d` overwrites the <quote> register +nnoremap <leader>P "0p +vnoremap <leader>P "0p + +" Easy quoting from: +" https://stackoverflow.com/questions/2147875/what-vim-commands-can-be-used-to-quote-unquote-words +:nnoremap <leader>qq ciW""<Esc>P +:nnoremap <leader>'' ciW''<Esc>P + +" remove scratch preview from autocomplete +set completeopt-=preview + + +" ------------------------------------------------------------ +" ----- PLUGIN SETTINGS + +let g:python3_host_prog = '/usr/bin/python3' +" Start NERDTree when Vim is started without file arguments. +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * + \ if (argc() == 0 && !exists('s:std_in') || isdirectory(argv(1)) ) | + \ NERDTree | + \ endif + +" https://techstructiveblog.hashnode.dev/vim-nerdtree +augroup DIRCHANGE + au! + autocmd DirChanged global :NERDTreeCWD +augroup END + +autocmd BufEnter NERD_tree_* | execute 'normal R' +au CursorHold * if exists("t:NerdTreeBufName") | call <SNR>15_refreshRoot() | endif + +let g:syntastic_shell = "/usr/bin/fish" +let g:syntastic_always_populate_loc_list = 0 +let g:syntastic_auto_loc_list = 0 +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 +let g:syntastic_enable_signs = 1 +let g:syntastic_enable_highlighting = 1 +let g:syntastic_python_checkers = ['flake8'] + +" Best AirlineTheme +set t_Co=256 +let g:airline_theme = 'dark_minimal' +let g:airline_left_sep = '>' +let g:airline_detect_spell = 1 +let g:airline_powerline_fonts = 1 +let g:airline#extensions#nerdtree_statusline = 1 +let g:airline#extensions#syntastic#enabled = 1 +let g:airline#extensions#branch#enabled = 1 +let g:airline_section_z = airline#section#create(['%3v', 'linenr', 'maxlinenr']) + +"------------------------------------------------------------ +" ----- DEFAULT SPACING/INDENTATION OPTIONS +" Indent with spaces by default like a sane person +set shiftwidth=4 +set softtabstop=4 +set expandtab +set textwidth=72 + +" ------------------------------------------------------------ +" ----- FILE TYPE CONFIGS + +set fileformat=unix + +" Enable x86 custom highlight, turn off syntax crap +au BufNewFile,BufRead *.asm + \ set syntax=nasm | + \ let g:syntastic_check_on_open=0 | + \ let g:syntastic_enable_signs=0 | + \ let g:syntastic_enable_highlighting=0 + +" auto PEP8 for python +au BufNewFile,BufRead *.py + \ set tabstop=4 | + \ set softtabstop=4 | + \ set shiftwidth=4 | + +" 8 spaces for c, per Linus +au BufNewFile,BufRead *.c + \ set tabstop=8 | + \ set softtabstop=8 | + \ set shiftwidth=8 | + \ set cindent | + +" For the one absolute mad lad +au BufNewFile,BufRead Makefile + \set noexpandtab + |