Skip to content

Instantly share code, notes, and snippets.

@DanBradbury
Last active August 29, 2015 14:18
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 DanBradbury/f04d9d3d4c0746da22b3 to your computer and use it in GitHub Desktop.
Save DanBradbury/f04d9d3d4c0746da22b3 to your computer and use it in GitHub Desktop.
minmal vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Mandatory Vim Config (passed down from da masta..)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " be iMproved, required
filetype off " required
filetype plugin indent on
filetype plugin on
autocmd filetype c,asm,python setlocal shiftwidth=4 tabstop=4 softtabstop=4
set hidden " don't unload buffer when switching away
set modeline " allow per-file settings via modeline
set exrc " enable per-directory .vimrc files
set secure " disable unsafe commands in local .vimrc files
set encoding=utf-8 fileencoding=utf-8 termencoding=utf-8 " saving and encoding
set nobackup nowritebackup noswapfile autoread " no backup or swap
set hlsearch incsearch ignorecase smartcase " search
set wildmenu " completion
set backspace=indent,eol,start " sane backspace
set mouse=a " enable mouse for all modes settings
set nomousehide " don't hide the mouse cursor while typing
set mousemodel=popup " right-click pops up context menu
set nofoldenable " I fucking hate code folding
set scrolloff=10 " scroll the window so we can always see 10 lines around the cursor
set textwidth=999 " show a vertical line at the 79th character
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Apperance & Formatting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd FileType make setlocal noexpandtab
au! FileType haml set noet
syntax on
"colorscheme molokai
set t_Co=256 " 256 colors in terminal
set shiftwidth=2 tabstop=2 softtabstop=2 expandtab autoindent
" Makefile no expandtab
set splitbelow
set splitright
set ruler " show cursor position in status bar
" set relativenumber " show relative line numbers
set number " show absolute line number of the current line
set cursorline " highlight the current line (will underline in terminal)
"set cursorcolumn " highlight the current column (some colorschemese fail to define ctermfg or fg==bg)
set printoptions=paper:letter " use letter as the print output format
set guioptions-=T " turn off GUI toolbar (icons)
set guioptions-=r " turn off GUI right scrollbar
set guioptions-=L " turn off GUI left scrollbar
set winaltkeys=no " turn off stupid fucking alt shortcuts
set laststatus=2 " always show status bar
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Personalized Vim Mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Slap dat spacebar
map <Space> <Leader>
" middle-click paste
map! <S-Insert> <MiddleMouse>
" insert binding.pry (before[bf] or after[ba]) current line
map <Leader>bf :normal $Obinding.pry<CR>
map <Leader>ba :normal $obinding.pry<CR>
" delete all characters after current cursor position
map <Leader>x :normal 300x<CR>
" jump more than usual with C-hjkl (nvim hates h apparently :| )
noremap <C-j> 5j
noremap <C-k> 5k
noremap <C-l> 10l
noremap <C-h> 10h
" works as page scrolling
noremap <D-j> 20j
noremap <D-k> 20k
map <C-\> :Ex<CR>
map <Leader>t :e term://bash<CR>
tnoremap <Esk>k :normal <C-\><C-n> <Esc>k
inoremap jk <esc>
noremap ' `
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Window & Tab Management
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <Leader>q :q<CR>
map <Leader>w :w<CR>
map <Leader>m0 :tabm0<CR>
map <Leader>m1 :tabm1<CR>
map <Leader>nt :tabedit %<CR>
" move between windows with M-hjkl (urxvt then gvim)
noremap <Esc>h <C-w>h
noremap <Esc>j <C-w>j
noremap <Esc>k <C-w>k
noremap <Esc>l <C-w>l
" create windows with ease
noremap <Leader>l <C-w>v
noremap <Leader>j <C-w>s
" move to previous/next tabs with [/]
map <Leader>[ gT
map <Leader>] gt
" + shift modifier to the above to move the tab left or right
map <Leader>{ :execute "tabmove" tabpagenr() - 2 <CR>
map <Leader>} :execute "tabmove" tabpagenr() <CR>
"shift+arrows to adjust the size of multiple windows
map <S-Left> <C-w><
map <S-Down> <C-w>-
map <S-Up> <C-w>+
map <S-Right> <C-w>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment