Created
November 16, 2015 13:53
-
-
Save santosh/0d4059298e83f0156d21 to your computer and use it in GitHub Desktop.
Minimal .vimrc file for Windows. Note that my dotfiles are on BitBucket. For sake of compatibility I am maintaining a different version for Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" {{ | |
se nocompatible autoindent autoread autowrite autowriteall confirm cindent expandtab foldenable gdefault hidden hlsearch ignorecase incsearch lazyredraw lbr nu ruler sm sc smd scs smartindent sta spell splitright ttyfast undofile noerrorbells wildmenu wrap equalalways splitbelow wrapscan list | |
" }} | |
se dir=~/tmp/vimswapfiles//,~/.vim/vimswapfiles// bs=eol,start,indent,start cb=unnamed cc=-1 cot=menu,longest,preview enc=utf-8 ffs=unix fdm=marker foldlevel=0 fmr={{,}} foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo formatoptions=tcqrn1 history=100 laststatus=2 matchtime=1 mouse=a nrformats=octal,hex,alpha scrolloff=5 shiftwidth=4 softtabstop=4 spl=en_us timeoutlen=300 tw=77 ts=4 undolevels=1000 udir=~/tmp/vimundo,~/.vim/vimundo uc=10 whichwrap+=<,>,[,],h,l wildchar=<tab> wig=*.o,*.obj,*.bak,*.exe,*.py[co],*.swp,*~,*.pyc,.svn guioptions-=T lcs=tab:?\ ,eol:¬,trail:·,nbsp:? | |
" ESSENTIALS | |
" ========== | |
" {{ | |
filetype plugin indent on | |
let snips_author = 'Santosh Kumar' | |
let snips_author_twitter = '<https://twitter.com/sntshk>' | |
let snips_author_email = '<[email protected]>' | |
let date = strftime("%a %d %b %Y %T %Z") | |
function! WindowNumber() | |
let str=tabpagewinnr(tabpagenr()) | |
return str | |
endfunction | |
se stl=%a\ %<%F\ %(%h%m%r%y%)\[%{&ff}\]\[buf:%n\]\[win:%{WindowNumber()}\]\ \ %=\ \ %(%o\ %b%)\ \|\ %(%c%V\ %l/%L\ %)%P | |
" HIGHLIGHT GROUP | |
" =============== | |
" {{ | |
hi ColorColumn NONE ctermbg=Cyan | |
" }} | |
" CONDITIONAL SETTINGS | |
" ==================== | |
"{{ | |
if has('win32') || has('win64') | |
se runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after | |
se shell=powershell.exe | |
endif | |
if !exists("syntax_on") | |
syntax on | |
endif | |
au FileType javascript set ts=4 sts=4 sw=4 et | |
au FileType css set ts=2 sts=2 sw=2 et | |
au FileType make set ts=8 sts=8 sw=8 noet | |
au BufReadPre *.j set ft=objc | |
au BufReadPre *.yml set ft=yaml | |
au BufReadPre *.md set ft=yaml | |
au BufReadPre *.txt set ft=text | |
au BufLeave,FocusLost ?* :up | |
" Don't check spelling if opened as vimdiff | |
if &diff | set nospell | endif | |
" }} | |
" MAPPINGS | |
" ======== | |
" {{ | |
let mapleader = "," | |
nnoremap ; : | |
vnoremap ; : | |
nnoremap / /\v | |
vnoremap / /\v | |
nnoremap + <c-w>_ | |
let i = 1 | |
while i <= 9 | |
execute 'nnoremap <Leader>' . i . ' :' . i . 'wincmd w<CR>' | |
let i = i + 1 | |
endwhile | |
nnoremap <leader>s :set spell!<cr> | |
nnoremap <leader>n :NERDTreeToggle<cr> | |
nnoremap <leader>f ggdG | |
nnoremap <silent> s :up<cr> | |
inoremap <silent> <esc><esc> <esc>:q<cr> | |
nnoremap <silent> <esc><esc> :q<cr> | |
nnoremap <leader>t :TlistToggle<cr> | |
nnoremap <leader>v :tabe ~/.vimrc<cr> | |
nnoremap <leader>7 :%s/\s\+$//<cr>:let @/=''<cr>\|:echo "cleared trailing spaces"<cr> | |
nnoremap <silent> <space> :set hlsearch!<cr> | |
nnoremap <tab> % | |
" quote current word | |
nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel | |
vnoremap <leader>" <esc>a"<esc>`<i"<esc> | |
nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>lel | |
" toggle current word to uppercase and lowercase | |
inoremap <c-u> <esc>g~iwi | |
vnoremap <c-u> ~ | |
" move just half page on PageUp and PageDown | |
nnoremap <PageUp> <c-u> | |
nnoremap <PageDown> <c-d> | |
inoremap <PageUp> <esc><c-u>i | |
inoremap <PageDown> <esc><c-d>i | |
" use <F2> if pasting from external resource. | |
set pastetoggle=<F2> | |
nnoremap <F3> a<C-R>=strftime("%a %d %b %Y %r")<CR><Esc> | |
inoremap <F3> <C-R>=strftime("%a %d %b %Y %r")<CR> | |
inoremap <F4> <esc>:exe "set textwidth=" . (&tw ? 0 : 77)<cr>a | |
" press <F6> to reload current file from disk | |
nnoremap <F6> :e<cr>G | |
inoremap <F6> <esc>:e<cr>Gi | |
" }} | |
" FUNCTIONS | |
" ========= | |
" {{ | |
function! ReCur() | |
if line("'\"") <= line("$") | |
normal! g`" | |
return 1 | |
endif | |
endfunction | |
au BufReadPost * call ReCur() | |
function! RemTrailSp() | |
%s/\s\+$//e | |
endfun | |
" }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment