Last active
August 29, 2015 13:58
-
-
Save chriszf/10026698 to your computer and use it in GitHub Desktop.
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
"Pathogen" | |
call pathogen#infect() | |
"Taglist stuff for mac" | |
let Tlist_Ctags_Cmd='/usr/local/bin/ctags' | |
"Basic crap for coding" | |
syntax on | |
set ai | |
set autochdir | |
set sts=4 | |
set sw=4 | |
filetype indent plugin on | |
set incsearch | |
set winminheight=0 | |
set winminwidth=0 | |
set updatetime=500 | |
set wildmode=longest,list | |
"enable fun autocomplete for java | |
set complete=.,w,b,u,t,i | |
"enable smart search | |
set smartcase | |
set ignorecase | |
set textwidth=0 | |
"convert tabs to spaces | |
set et | |
"Find file, ala textmate | |
"ex: | |
" :Find sq wk | |
" Will find all files named *sq*wk | |
" Depends on 'ProjectDir' variable | |
if !exists("$ProjDir") | |
let $ProjDir="." | |
endif | |
function! Find(name) | |
let l:_name = substitute(a:name, "\\s", "*", "g") | |
let l:list=system("find ".$ProjDir." -iwholename '*".l:_name."*' -not -name \"*.class\" -and -not -name \"*.swp\" -and -not -name \"*.svn*\" -and -not -name \"*.pyc\" | perl -ne 'print \"$.\\t$_\"'") | |
let l:num=strlen(substitute(l:list, "[^\n]", "", "g")) | |
if l:num < 1 | |
echo "'".a:name."' not found" | |
return | |
endif | |
if l:num != 1 | |
echo l:list | |
let l:input=input("Which file? (<enter>=quit)\n") | |
if strlen(l:input)==0 | |
return | |
endif | |
if strlen(substitute(l:input, "[0-9]", "", "g"))>0 | |
echo "Not a number" | |
return | |
endif | |
if l:input<1 || l:input>l:num | |
echo "Out of range" | |
return | |
endif | |
let l:line=matchstr("\n".l:list, "\n".l:input."\t[^\n]*") | |
else | |
let l:line=l:list | |
endif | |
let l:line=substitute(l:line, "^[^\t]*\t", "", "") | |
execute ":e ".l:line | |
endfunction | |
command! -nargs=1 Find :call Find("<args>") | |
command! Reload :source ~/.vimrc | |
"Tako specific stuff" | |
function! SetProject(dir) | |
let $ProjDir=a:dir | |
set tags=./ctags,ctags,$ProjDir/ctags | |
lcd $ProjDir | |
endf | |
"command! Tako :call SetProject("/home/chriszf/src/app/main") | |
"command! MapPoint :call SetProject("/home/chriszf/src/tako-misc/mappoint") | |
"command! Framework :call SetProject("/home/chriszf/src/framework/trunk/src") | |
command! Custard :call SetProject("/Users/chriszf/src/custard") | |
command! Xmllint :%!xmllint --format - | |
"Mappings | |
"Turn on the taglist window | |
nmap ,f :CursorFileSearch<CR> | |
nmap ,w :sp<CR> | |
com! CursorFileSearch call Find(expand("<cfile>")) | |
"Move around and maximize windows | |
map <C-J> <C-W>j<C-W>_ | |
map <C-K> <C-W>k<C-W>_ | |
map <C-H> <C-W>h | |
"map <C-L> <C-W>l | |
"let g:xml_syntax_folding = 1 | |
"set foldmethod=syntax | |
autocmd BufEnter * syn sync fromstart | |
"Some defaults for taglist | |
nnoremap <silent> <F8> :TlistToggle<CR> | |
let Tlist_Exit_OnlyWindow = 1 | |
let Tlist_Show_One_File = 1 | |
let Tlist_Enable_Fold_Column = 1 | |
set backspace=eol,indent,start | |
set background=light | |
" Highlight a column in csv text. | |
" :Csv 1 " highlight first column | |
" :Csv 12 " highlight twelfth column | |
" :Csv 0 " switch off highlight | |
function! CSVH(colnr) | |
if a:colnr > 1 | |
let n = a:colnr - 1 | |
execute 'match Keyword /^\([^,]*,\)\{'.n.'}\zs[^,]*/' | |
execute 'normal! 0'.n.'f,' | |
elseif a:colnr == 1 | |
match Keyword /^[^,]*/ | |
normal! 0 | |
else | |
match | |
endif | |
endfunction | |
command! -nargs=1 Csv :call CSVH(<args>) | |
imap <S-space> <Esc> | |
imap <D-Space> <Esc> | |
nmap <S-space> i | |
nmap <D-Space> i | |
" Relative numbers" | |
noremap <F3> :exec &nu==&rnu ? "set nu!" : "set rnu!"<CR> | |
set tags=tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment