Created
December 1, 2011 20:02
-
-
Save shes-a-skeeze/1419416 to your computer and use it in GitHub Desktop.
vimrc
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
" | |
" Brookie Surae | |
" bite.my.peepee@gmail.com | |
" | |
" be iMproved | |
set nocompatible | |
" set gfn=Monaco\ Compressed\ 7.5 | |
set gfn=Profont\ 9 | |
"set gfn=Pragmata\ 7 | |
"set gfn=Sleeze\ Medium\ 8 | |
" General settings | |
filetype plugin indent on | |
syntax on | |
set nolist | |
set nrformats+=alpha " in-/decrease letters with C-a/C-x | |
" dynamic window title | |
set title | |
" enable mouse | |
set mouse=a | |
" modelines | |
set modeline | |
set modelines=5 | |
" show the current command in the lower right corner | |
"set showcmd | |
" don't display current mode | |
set noshowmode | |
" fast buffer switching | |
set hidden | |
" show numbers, current position, and cursor line | |
set number | |
set ruler | |
set cursorline | |
" no backups | |
set nobackup | |
set nowb | |
set noswapfile | |
" folds | |
set foldmethod=marker | |
if has('gui_running') | |
set foldcolumn=1 | |
else | |
set foldcolumn=0 | |
endif | |
" NERDTree | |
let NERDTreeChDirMode = 2 | |
let NERDTreeShowBookmarks = 1 | |
let NERDTreeShowHidden = 1 | |
" enable paste | |
set paste | |
" tabs | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set autoindent | |
set smartindent | |
set expandtab | |
set equalalways | |
" GUI or no GUI, that's the question | |
if has('gui_running') | |
set guicursor+=a:blinkon0 " Cursor doesn't blink - it's annoying | |
set guioptions-=m " No Menubar | |
set guioptions-=T " No Toolbar | |
set guioptions-=l " No Scrollbar left | |
set guioptions-=L " No Scrollbar left when split | |
set guioptions-=r " No Scrollbar right | |
set guioptions-=r " No Scrollbar right when split | |
set lines=40 " Height | |
set columns=95 " Width | |
colorscheme junk | |
else | |
colorscheme xdefaults | |
endif | |
" General Keybinds {{{ | |
" colors | |
map <F8> :call NextColorScheme()<CR> | |
map <F7> :call PreviousColorScheme()<CR> | |
map <C-F4> :call RandomColorScheme()<CR> | |
" buffers | |
map <F2> <Esc>:bn<CR> | |
map <F3> <Esc>:bp<CR> | |
map <F4> <Esc>:bd<CR> | |
" cd to the directory containing the file in the buffer | |
nmap <silent> ,cd :lcd %:h<CR> | |
" Toggle NERDTree | |
map <F5> :NERDTreeToggle<CR> | |
" Tab Switching | |
" Insert Mode | |
imap <F10> <ESC>:tabnext<CR> | |
imap <F9> <ESC>:tabprevious<CR> | |
imap <F11> <ESC>:tabnew<CR> | |
" Normal Mode | |
map <F10> :tabnext<CR> | |
map <F9> :tabprevious<CR> | |
map <F11> :tabnew<CR> | |
" Saving | |
map ,, :w<CR> | |
"map ,. :w!<CR> | |
" Explore | |
nmap <silent> ,. :Explore<CR> | |
" sourcing files | |
nmap <silent> ,ev :e $MYVIMRC<CR> | |
nmap <silent> ,sv :so $MYVIMRC<CR> | |
nmap <silent> ,re :so $MYVIMRC<CR> | |
nmap <silent> ,aa :so .vim/sessions/session.vim<CR> | |
nmap <silent> ,ss :colorscheme dot<CR> | |
nmap <silent> ,ff :colorscheme fatraps<CR> | |
" Maps to make handling windows a bit easier | |
noremap <silent> ,h :wincmd h<CR> | |
noremap <silent> ,j :wincmd j<CR> | |
noremap <silent> ,k :wincmd k<CR> | |
noremap <silent> ,l :wincmd l<CR> | |
noremap <silent> ,sb :wincmd p<CR> | |
noremap <silent> <C-F9> :vertical resize -10<CR> | |
noremap <silent> <C-F10> :resize +10<CR> | |
noremap <silent> <C-F11> :resize -10<CR> | |
noremap <silent> <C-F12> :vertical resize +10<CR> | |
noremap <silent> ,s8 :vertical resize 83<CR> | |
noremap <silent> ,cj :wincmd j<CR>:close<CR> | |
noremap <silent> ,ck :wincmd k<CR>:close<CR> | |
noremap <silent> ,ch :wincmd h<CR>:close<CR> | |
noremap <silent> ,cl :wincmd l<CR>:close<CR> | |
noremap <silent> ,cc :close<CR> | |
noremap <silent> ,cw :cclose<CR> | |
noremap <silent> ,ml <C-W>L | |
noremap <silent> ,mk <C-W>K | |
noremap <silent> ,mh <C-W>H | |
noremap <silent> ,mj <C-W>J | |
noremap <silent> <C-7> <C-W>> | |
noremap <silent> <C-8> <C-W>+ | |
noremap <silent> <C-9> <C-W>+ | |
noremap <silent> <C-0> <C-W>> | |
" }}} | |
" Status line {{{ | |
if has('gui_running') | |
set laststatus=2 " always show statusline | |
else | |
set laststatus=2 | |
endif | |
" Generic Statusline {{{ | |
if has('gui_running') | |
"function! SetStatus() | |
"setl statusline+= | |
"\%1*\ %f\ %6*-- | |
"\%H%M%R%W%7*\ | |
"\%2*%Y\ %5*::\ line\ %l\ %P | |
"endfunction | |
function! SetRightStatus() | |
setl statusline+= | |
\%=%<%7*\ | |
\%5*\ %{StatusWrapON()} | |
\%6*%{StatusWrapOFF()}\ %7* | |
\%5*\ %{StatusInvisiblesON()} | |
\%6*%{StatusInvisiblesOFF()}\ %7* | |
\%5*\ %{StatusExpandtabON()} | |
\%6*%{StatusExpandtabOFF()}\ %7* | |
\%5*\ w%{StatusTabstop()}\ %7* | |
\%3*\ %l,%c\ >>>\ %P | |
\\ | |
endfunction | |
function! SetStatus() | |
setl statusline+= | |
\%1*\ %f | |
\%H%M%R%W%7*\ | |
\%2*\ %Y\ <<<\ %{&ff}%7*\ | |
\%5*\ %{StatusFileencoding()}%7*\ | |
\%5*\ %{StatusBuffersize()}%7*\ | |
endfunction | |
"function! SetRightStatus() | |
"setl statusline+= | |
"\\ | |
"endfunction | |
else | |
function! SetStatus() | |
setl statusline+=%9*\ 0:%n\ sleeze\ %8*//\ | |
endfunction | |
function! SetRightStatus() | |
setl statusline+=%9*%<%f%h%m%r\ %2*%=\ | |
endfunction | |
endif | |
" }}} | |
"fileencoding (three characters only) {{{ | |
function! StatusFileencoding() | |
if &fileencoding == "" | |
if &encoding != "" | |
return &encoding | |
else | |
return " -- " | |
endif | |
else | |
return &fileencoding | |
endif | |
endfunc " }}} | |
" Buffer Size {{{ | |
function! StatusBuffersize() | |
let bufsize = line2byte(line("$") + 1) - 1 | |
" prevent negative numbers (non-existant buffers) | |
if bufsize < 0 | |
let bufsize = 0 | |
endif | |
" add commas | |
let remain = bufsize | |
let bufsize = "" | |
while strlen(remain) > 3 | |
let bufsize = "," . strpart(remain, strlen(remain) - 3) . bufsize | |
let remain = strpart(remain, 0, strlen(remain) - 3) | |
endwhile | |
let bufsize = remain . bufsize | |
" too bad we can't use "¿" (nr2char(1068)) :) | |
let char = "b" | |
return bufsize . char | |
endfunction " }}} | |
" Update when switching mode {{{ | |
if has('gui_running') | |
function! SetStatusInsertMode(mode) | |
setl statusline=%4* | |
if a:mode == 'i' | |
setl statusline+=%4*\ ◥ | |
elseif a:mode == 'r' | |
setl statusline+=%4*\ ◥ | |
elseif a:mode == 'normal' | |
setl statusline+=%4*\ ◥ | |
endif | |
call SetStatus() | |
call SetRightStatus() | |
endfunction | |
" if has('gui_running') | |
" function! SetStatusInsertMode(mode) | |
" setl statusline=%4* | |
" if a:mode == 'i' | |
" setl statusline+=%4*\ <i> | |
" elseif a:mode == 'r' | |
" setl statusline+=%4*\ <r> | |
" elseif a:mode == 'normal' | |
" setl statusline+=%4*\ <n> | |
" endif | |
" call SetStatus() | |
" call SetRightStatus() | |
" endfunction | |
else | |
function! SetStatusInsertMode(mode) | |
setl statusline=%4* | |
if a:mode == 'i' | |
setl statusline+=%4*\ (O.o)\ %8*// | |
elseif a:mode == 'r' | |
setl statusline+=%4*\ (O.o)\ %8*// | |
elseif a:mode == 'normal' | |
setl statusline+=%4*\ (O.o)\ %8*// | |
endif | |
call SetStatus() | |
call SetRightStatus() | |
endfunction | |
endif | |
au VimEnter * call SetStatusInsertMode('normal') | |
au InsertEnter * call SetStatusInsertMode(v:insertmode) | |
au InsertLeave * call SetStatusInsertMode('normal') | |
au BufEnter * call SetStatusInsertMode('normal') " }}} | |
" &expandtab {{{ | |
function! StatusExpandtabON() | |
if &expandtab == 0 | |
return "tabs" | |
else | |
return "" | |
endif | |
endfunction " | |
function! StatusExpandtabOFF() | |
if &expandtab == 0 | |
return "" | |
else | |
return "tabs" | |
endif | |
endfunction " }}} | |
" tabstop and softtabstop {{{ | |
function! StatusTabstop() | |
" show by Vim option, not Cream global (modelines) | |
let str = "" . &tabstop | |
" show softtabstop or shiftwidth if not equal tabstop | |
if (&softtabstop && (&softtabstop != &tabstop)) | |
\ || (&shiftwidth && (&shiftwidth != &tabstop)) | |
if &softtabstop | |
let str = str . ":sts" . &softtabstop | |
endif | |
if &shiftwidth != &tabstop | |
let str = str . ":sw" . &shiftwidth | |
endif | |
endif | |
return str | |
endfunction " }}} | |
" Show Invisibles {{{ | |
function! StatusInvisiblesON() | |
"if exists("g:LIST") && g:LIST == 1 | |
if &list | |
if &encoding == "latin1" | |
return "¶" | |
elseif &encoding == "utf-8" | |
return "¶" | |
else | |
return "$" | |
endif | |
else | |
return "" | |
endif | |
endfunction | |
function! StatusInvisiblesOFF() | |
"if exists("g:LIST") && g:LIST == 1 | |
if &list | |
return "" | |
else | |
if &encoding == "latin1" | |
return "¶" | |
elseif &encoding == "utf-8" | |
return "¶" | |
else | |
return "$" | |
endif | |
endif | |
endfunction " }}} | |
" Wrap Enabled {{{ | |
function! StatusWrapON() | |
if &wrap | |
return "wrap" | |
else | |
return "" | |
endif | |
endfunction | |
function! StatusWrapOFF() | |
if &wrap | |
return "" | |
else | |
return "wrap" | |
endif | |
endfunction | |
" }}} | |
" }}} | |
" invisibles {{{ | |
set listchars=tab:<\ ,eol:< | |
"set list | |
nmap <silent> <F6> :set list!<CR> | |
"}}} | |
" Margins {{{ | |
set scrolloff=5 | |
set sidescroll=5 | |
" }}} | |
" Wrapping {{{ | |
set linebreak | |
set showbreak=</ | |
" toggle wrapping | |
nmap <silent> <F12> :let &wrap = !&wrap<CR> | |
" }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment