Skip to content

Instantly share code, notes, and snippets.

@gx86
Last active August 29, 2015 14:01
Show Gist options
  • Save gx86/0a4992dbbc1647dbe52e to your computer and use it in GitHub Desktop.
Save gx86/0a4992dbbc1647dbe52e to your computer and use it in GitHub Desktop.
My Master .vimrc file
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" .vimrc - gx86's master vimrc "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" The master option ;P
set nocompatible
"""""""""""""
" GLOBALS "
"""""""""""""
set ambiwidth=double
set autoread "autoload files that have changed
set background=dark
set cmdheight=2 "set the command height to two lines
set completeopt=longest,menuone
set cpoptions+=$
set encoding=utf-8
set fileformats=unix,dos
set foldopen=block,insert,jump,mark,percent,quickfix,search,tag,undo
set gdefault
set hidden
set history=1000
set laststatus=2
set lazyredraw "don't draw until the macros are done
set modelines=0
set number
set nrformats= "set all numbers to be treated as decimal
set pastetoggle=<F2>
set ruler
set scrolloff=3
set shellslash
set showcmd
set showfulltag
set splitright
set splitbelow
set softtabstop=2 tabstop=4 shiftwidth=2 expandtab
set ttyfast
"set textwidth=80
"set virtualedit=all
set virtualedit=block
set visualbell "set the visualbell
set wildmenu
set wrapscan "search wraps new lines
syntax enable
"""""""""""""
" PLUGINS "
"""""""""""""
let g:pathogen_disabled = []
"call add(g:pathogen_disabled, 'csscolor')
filetype off
execute pathogen#infect()
filetype plugin indent on
""""""""""""""""
" WHITESPACE "
""""""""""""""""
set backspace=indent,eol,start
set list
set listchars=""
set listchars=tab:▸\
set listchars+=trail:.
set listchars+=extends:>
set listchars+=precedes:<
set listchars+=eol:¬
set nowrap
""""""""""""
" SEARCH "
""""""""""""
set hlsearch
set incsearch
set ignorecase
set smartcase
nnoremap / /\v
vnoremap / /\v
cnoremap %s/ %s/\v
"""""""""""""""""
" OS SPECIFIC "
"""""""""""""""""
if has('unix')
set clipboard+=unamed
set directory^=~/.vim/_swap//
set backupdir^=~/.vim/_backup//
set undodir^=~/.vim/_undo//
" let g:yankring_history_dir = "~/.vim"
elseif has('win32')
set guifont=Consolas:h9:cANSI
set directory=$HOME/vimfiles/_swap
set backupdir=$HOME/vimfiles/_backup
set undodir=$HOME/vimfiles/_undo
" let g:yankring_history_dir = "$HOME/vimfiles"
elseif has('mac')
endif
""""""""""""""""""""""
" BACKUP/SWAP/UNDO "
""""""""""""""""""""""
set backup
set writebackup
set undofile
set undolevels=1000
set undoreload=10000
""""""""""""""""""
" GUI SETTINGS "
""""""""""""""""""
if has("gui_running")
setglobal guioptions-=L
setglobal guioptions-=l
setglobal guioptions-=R
setglobal guioptions-=r
setglobal guioptions-=b
setglobal guioptions-=h
setglobal guioptions-=m
setglobal guioptions-=T
set guicursor=n-v-c:block-Cursor-blinkon0,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor,r-cr:hor20-Cursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
set mousehide "hide the mouse when typing
set mouse=v
" allow for toggle of menu/toolbar
nnoremap <C-F1> :if &go=~#'m'<Bar>set go-=m<Bar>else<Bar>set go+=m<Bar>endif<CR>
nnoremap <C-F2> :if &go=~#'T'<Bar>set go-=T<Bar>else<Bar>set go+=T<Bar>endif<CR>
endif
"""""""""""""""""""""""""""
" PLUGIN CUSTOMIZATIONS "
"""""""""""""""""""""""""""
" Buffergator
let g:buffergator_autoexpand_on_split = 0
" FuzzyFile
nnoremap <silent> <leader>ff :FufFile<CR>
nnoremap <silent> <leader>fb :FufBuffer<CR>
nnoremap <silent> <leader>fd :FufDir<CR>
nnoremap <silent> <leader>fc :FufChangeList<CR>
" bind Scratch
nnoremap <leader><tab> :Sscratch<CR>
" Setup Gundo
nnoremap <F5> :GundoToggle<CR>
"EasyMotion specifics
map <leader>/ <Plug>(easymotion-sn)
omap <leader>/ <Plug>(easymotion-tn)
map <leader>n <Plug>(easymotion-next)
map <leader>N <Plug>(easymotion-prev)
map <Leader>h <Plug>(easymotion-lineforward)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
map <Leader>l <Plug>(easymotion-linebackward)
let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion
let g:EasyMotion_smartcase = 1
" Setup yankring
" See OS specifics for yankring history file
" let g:yankring_replace_n_nkey = '<leader><C-N>'
" let g:yankring_replace_n_pkey = '<leader><C-P>'
" nnoremap <silent> <F11> :YRShow<CR>
" Setup Nerdtree
nnoremap <silent> <F12> :NERDTreeToggle<CR>
" Relative Line Numbers control mappings
nnoremap <leader><F11> :NumbersToggle<CR>
nnoremap <leader><F12> :NumbersOnOff<CR>
" add Uls alias for Ultisnips#ListSnippets() since putty wont send c-tab
command! Uls :call UltiSnips#ListSnippets()
" Path to git for Fugitive
" let g:fugitive_git_executable='\Path\To\Git'
"""""""""""""
" VISUALS "
"""""""""""""
colorscheme xoria256
"let &colorcolumn="80,".join(range(120,999),",")"
"let &colorcolumn=join(range(81,999),",")
let &colorcolumn="81"
set showmatch
nnoremap <Leader><Leader>c :set cursorline! cursorcolumn!<CR>
"""""""""""""""""""""
" CUSTOM MAPPINGS "
"""""""""""""""""""""
" Clear search with ENTER
nnoremap <CR> :noh<CR><CR>
" change to current dir of file
nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
" toggle folds with space
nnoremap <space> za
" map jk to escape so you can easily get out of insert
inoremap <silent> jk <esc>
" delete a line in insert mode
inoremap <silent> <c-d> <C-o>:normal dd<CR>
" upcase a word in insert
inoremap <silent> <c-u> <C-o>:normal viwUe<CR>
" downcase a word in insert
inoremap <silent> <c-l> <C-o>:normal viwue<CR>
" underline with = (header)
nnoremap <leader>1 yypVr=
" Remove Arrow Keys, learning vimfu the hardway
inoremap <Left> <NOP>
inoremap <Right> <NOP>
inoremap <Up> <NOP>
inoremap <Down> <NOP>
nnoremap <Left> <NOP>
nnoremap <Right> <NOP>
nnoremap <Up> <NOP>
nnoremap <Down> <NOP>
" ctrl-space jumps to matching bracket in normal/visual
nnoremap <c-space> %
vnoremap <c-space> %
" Spell Check
command! Spell :setlocal spell spelllang=en_ca,en_us
command! Nospell :setlocal spell
" Ditch the help button
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" Fold tag in html
nnoremap <leader>ft Vatzf
" hardwrap text
nnoremap <leader>q gqip
" reselect pasted text
nnoremap <leader>v V`]
" Edit vimrc
nnoremap <leader>ev :edit $MYVIMRC<CR>
" Source vimrc
nnoremap <leader>sv :source $MYVIMRC<CR>
""""""""""""""""""""""
" CUSTOM FUNCTIONS "
""""""""""""""""""""""
@gx86
Copy link
Author

gx86 commented May 9, 2014

Caveat Emptor

Makes assumptions about certain directories being created ( _swap, _backup, _undo ) and about certain plugins being installed.

P.S. I tried not to obliterate default Vim bindings were possible, at least the really common ones anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment