Skip to content

Instantly share code, notes, and snippets.

@fboender
Created July 16, 2018 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fboender/c4e37b3652d74a38aa33929a7a783143 to your computer and use it in GitHub Desktop.
Save fboender/c4e37b3652d74a38aa33929a7a783143 to your computer and use it in GitHub Desktop.
Ferry Boender's .vimrc
"----------------------------------------------------------------------------
" Look
"----------------------------------------------------------------------------
syntax on " Syntax color highlighting powah
set nowrap " Do not wrap text at window width
set hlsearch " Highlight search matches
set laststatus=2 " Always display file status line
set number " Show line numbers.
set hidden " Allow changing buffers with changes in them
set background=dark " Dark background
set t_Co=256 " 256 colors in terminal. Requires TERM=xterm-256color
set modeline " Allow modeline for auto syntax things.
colorscheme gray " Custom color scheme
"----------------------------------------------------------------------------
" Feel
"----------------------------------------------------------------------------
set tabstop=4 " Compatible tab settings
set softtabstop=4
set shiftwidth=4
set expandtab " use spaces
set autoindent " Automatically indent new lines to previous line's indention
set foldmethod=indent " folding
set foldnestmax=2
set foldlevel=2
set foldenable
set foldignore=#/
set scrolloff=5 " Always keep 3 lines above and below cursor.
set wmnu " Show menu for tab-complete in command mode.
set ignorecase " Case insensitive on search / replace
set scs " Case sensitive search if contains upper letters.
set virtualedit=block " Allow the cursor everywhere in visual block select mode
set tags=tags;/
filetype plugin on " Enable ~/.vim/ftplugin/, for filetype-specific settings
"----------------------------------------------------------------------------
" Misc
"----------------------------------------------------------------------------
set mouse=a " Enable mouse support in console
set noswapfile " no swap files
if version >= 730
set undofile " Maintain undo history between sessions.
set undodir=~/.vim/undo
endif
set spelllang=en_gb,en_us,nl
"----------------------------------------------------------------------------
" Key bindings
"----------------------------------------------------------------------------
let mapleader = ","
" Move current line one up
map <C-k> :m-2<cr>
" Move current line one down
map <C-j> :m+1<cr>
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
nnoremap * *<C-O>
nnoremap <C-h> gT
nnoremap <C-l> gt
nnoremap <Leader>m :make<CR>
"----------------------------------------------------------------------------
" Auto commands for various languages
"----------------------------------------------------------------------------
highlight BadWhitespace ctermbg=red guibg=red
au BufNewFile,BufFilePre,BufRead *.md set filetype=markdown
au BufNewFile,BufFilePre,BufRead *.nim set filetype=nim
au BufNewFile,BufFilePre,BufRead Makefile set filetype=makefile
au FileType python,javascript match BadWhitespace /^\t\+/
au FileType python,javascript match BadWhitespace /\s\+$/
au FileType makefile set noexpandtab
"au BufNewFile,BufFilePre,BufRead Makefile set noexpandtab
"----------------------------------------------------------------------------
" Plugins
"----------------------------------------------------------------------------
" CtrlP, fuzzy opening of files when pressing ctrl-p
set rtp+=~/.vim/bundle/ctrlp.vim
nnoremap <Leader>p :CtrlPMixed<CR>
nnoremap <Leader>t :CtrlPTag<CR>
let g:ctrlp_max_files = 0 " Set no max file limit
" Tagbar, a sidebar that shows tags by scope
set rtp+=~/.vim/bundle/tagbar
nnoremap <F9> :TagbarToggle<CR>
let g:tagbar_sort=0
" NerdTree, a sidebar that show a dir tree
set rtp+=~/.vim/bundle/nerdtree
nnoremap <F8> :NERDTreeToggle<CR>
" Bexec, execute buffers and capture output into other buffer.
set rtp+=~/.vim/bundle/bexec
nmap <silent> <unique> <F5> :Bexec()<CR>
vmap <silent> <unique> <F5> :BexecVisual()<CR>
" Align, align line elements
set rtp+=~/.vim/bundle/align
" Settab, quickly set indenting settings
set rtp+=~/.vim/bundle/settab
" Zoomwin, maximize the current split buffer.
set rtp+=~/.vim/bundle/zoomwin
map <C-X> :ZoomWin<cr>
" Vimball
set rtp+=~/.vim/bundle/vimball
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment