Created
July 27, 2011 03:54
-
-
Save st23am/1108638 to your computer and use it in GitHub Desktop.
Vimrc after lion
This file contains 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
call pathogen#runtime_append_all_bundles() | |
set nocompatible | |
set hidden | |
set tabstop=4 | |
set softtabstop=4 | |
set expandtab | |
set cursorline | |
let mapleader = "," | |
cd ~/Dev | |
syntax on | |
let hour = strftime("%H") | |
if 6 <= hour && hour < 18 | |
"daytime | |
set background=light | |
colorscheme solarized | |
else | |
let g:solarized_termcolors=256 | |
let g:solarized_termtrans=0 | |
colorscheme solarized | |
set background=dark | |
endif | |
call togglebg#map("<F5>") | |
" auto indention | |
set ai | |
" map jj to esc | |
ino jj <esc> | |
cno jj <c-c> | |
map <F2> :NERDTreeToggle<CR> | |
set directory^=$HOME/.vim_swap// " put all swap files together in one place | |
" For visual mode, just use "v" to toggle it on/off | |
vno v <esc> | |
" Strip trailing whitespace on save while retaining cursor position | |
fun! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces() | |
"folding settings | |
set nofoldenable | |
set foldmethod=syntax | |
set foldlevel=1 | |
set foldnestmax=2 | |
set foldtext=strpart(getline(v:foldstart),0,50).'\ ...\ '.substitute(getline(v:foldend),'^[\ #]*','','g').'\ ' | |
highlight Folded guibg=#eee8d5 guifg=#b58900 | |
"misc cosmetic | |
set number | |
set tabstop=2 | |
set sw=2 | |
" Hit D to duplicate the highlighted text below while in visual mode | |
vmap D y'>p | |
map <D-r> :SweetVimRspecRunFile<CR> | |
ca shell Shell | |
function! s:ExecuteInShell(command) | |
let command = join(map(split(a:command), 'expand(v:val)')) | |
let winnr = bufwinnr('^' . command . '$') | |
silent! execute winnr < 0 ? 'botright new ' . fnameescape(command) : winnr . 'wincmd w' | |
setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap number | |
echo 'Execute ' . command . '...' | |
silent! execute 'silent %!'. command | |
silent! execute 'resize ' . line('$') | |
silent! redraw | |
silent! execute 'au BufUnload <buffer> execute bufwinnr(' . bufnr('#') . ') . ''wincmd w''' | |
silent! execute 'nnoremap <silent> <buffer> <LocalLeader>r :call <SID>ExecuteInShell(''' . command . ''')<CR>' | |
echo 'Shell command ' . command . ' executed.' | |
endfunction | |
command! -complete=shellcmd -nargs=+ Shell call s:ExecuteInShell(<q-args>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment