|
Old Rank: | Old Date: | New Date: | |
1) | Initiate: | 08/06/2002 | ??? |
2) | Novice: | 08/07/2002 | ??? |
3) | Acolyte: | 08/10/2002 | ??? |
4) | Scribe: | 08/15/2002 | ??? |
5) | Monk: | 08/31/2002 | 8/7/2007 |
6) | Friar: | 10/16/2004 | Not there Yet |
7) | Abbot: | Not there Yet | Not there Yet |
8) | Bishop: | Not there Yet | Not there Yet |
9) | Pontiff: | Not there Yet | Not there Yet |
10) | Saint: | Not there Yet | Not there Yet |
My Useful VIM Stuff |
File: $VIM/_vimrc |
"***************************************************************** " Title : .vimrc " Date : 1/9/2001 " Version : 2.0 " " History : " 1/9/2001 - Added header comment. " 1/9/2001 - Made backspace= line use vim 5.4 and earlier syntax " 1/9/2001 - Set noexpandtab when editing makefiles " 1/15/2001 - Correctly set expandtab when leaving makefiles "****************************************************************** "** Turn syntax highlighting on (must be after terminfo stuff above) syntax on set ff=unix "** Attempt to use 16 color terminal ** if has("terminfo") set t_Co=16 set t_AB=^[[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm set t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm else set t_Co=16 set t_AB=^[[3%dm set t_AF=^[[4%dm endif "** Make the color used for comments readable on a black background "highlight Comment ctermfg=Cyan highlight Comment ctermfg=Cyan "** Turn on line numbers in status bar set ruler "** Tell vim to set the title on xterms (needed for imwheel to detect vim) set title "** Tabstops should be two spaces, expand by default set tabstop=4 set shiftwidth=4 set noexpandtab "** Don't do "C" smart indenting by default, but do auto indent. set nocindent set si set autoindent "** Allow backspacing before start of indent, back around eol, etc set backspace=2 "** More generous tags file location set tags=./tags,tags,../tags if !exists("autocommands_loaded") let autocommands_loaded=1 "** C/C++ autocmd BufNewFile,BufRead *.c,*.cpp,*.C,*.cxx,*.h set cindent autocmd BufLeave *.c,*.cpp,*.C,*.cxx,*.h set nocindent "** Perl autocmd BufNewFile,BufRead *.pl,*.pm set cindent autocmd BufLeave *.pl,*.pm set nocindent endif if has('syntax') let perl_include_pod=1 let java_highlight_java_lang_ids=1 let java_highlight_debug=1 let java_allow_cpp_keywords=1 let is_bash=1 syntax on if v:version >= 600 filetype plugin indent on endif endif let g:initals="KIN" let g:myname="Scott Atkins" let g:email1="kin@cypress.com" let g:email2="" let g:email3="" " load my personal settings so $VIM/kin/personal.vim |
$VIM/kin/personal.vim |
"######################################## " File - personal.vim " Author - Scott Atkins " Date - Wednesday, September 11, 2002 " E-Mail - kin@cypress.com " " " Description - VIM Personal Settings File "######################################## " load tab complete so $VIM/kin/tabcomplete.vim " load new windows file so $VIM/kin/mswin2.vim " load comments so $VIM/kin/comments.vim " load matchMe so $VIM/kin/matchMe.vim " Set colors colors murphy " Other config options " set vim to wrap the cursor " at the end of a line (in " insert mode) set whichwrap=>,<,b,s,h,l,~,[,] " No more hit enter to continue set shortmess=a " 1 line command line set cmdheight=1 " Set line numbering, visual bell " and other such options set nu set vb set esckeys set showcmd set sm set mousehide set guioptions+=a " Set PHP to c++ syntax if !exists("autocommands_loaded") let autocommands_loaded=1 "** Php autocmd BufNewFile,BufRead *.php,*.php4 set cindent autocmd BufLeave *.php,*.php4 set nocindent endif " Windows Help if has("win32") let winhelpfile='windows.hlp' map K :execute "!start winhlp32 -k <cword> " . winhelpfile endif if has("gui_running") " If the current buffer has never been saved, it will have no name, " call the file browser to save it, otherwise just save it. :map <silent> <C-S> :if expand("%") == ""<CR>:browse confirm w<CR>:else<CR>:confirm w<CR>:endif<CR> endif imap <c-s> <c-o><c-s><cr> map <F2> ma][%0"xy$`a:echo @x<cr> imap <F2> <esc>ma][%0"xy$`ai<c-o>:echo @x<cr> " make up and down work correctly imap <silent> <Down> <C-o>gj imap <silent> <Up> <C-o>gk nmap <silent> <Down> gj nmap <silent> <Up> gk " Status Bar function VarSet(var,ret1,ret2) if a:var != '' return a:ret1 else return a:ret2 endif endfunction function FileInfo() return CompVar().VarSet(&ft,'['.&ft.'-','[').&ff.'] ' endfunction set ls=2 set statusline=%<%f%h%m%r%=%b\ 0x%B\ %{FileInfo()}%l,%c%V\ %P hi StatusLine term=bold cterm=bold ctermfg=lightblue guifg=lightblue gui=none guibg=#333333 hi StatusLineNC term=NONE cterm=NONE ctermfg=Black guifg=#666666 gui=None guibg=#333333 " Set the window size " win 100 45 " wrap at word set lbr! " fullscreen " au GUIEnter * simalt ~x nmap ,s :so $VIM/_vimrc<cr> nmap ,v :e $VIM/_vimrc<cr> " Escape Toggle map <esc> :startinsert<cr> " Start in insert mode :startinsert |
$VIM/kin/tabcomplete.vim |
"######################################## " File - tabcomplete.vim " Author - Scott Atkins " Date - Monday, August 05, 2002 " E-Mail - kin@cypress.com " " " Description - fixes small things " with vim such as using " tab to complete words " starting in insert mode " and escape switches " modes. Plus there are " file headers and comment " functions for most file " types. "######################################## " This code is from vim.org in the tips " section. function! InsertTabWrapper(direction) let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\<tab>" elseif "backward" == a:direction return "\<c-p>" else return "\<c-n>" endif endfunction " Bind the tab-complete inoremap <tab> <c-r>=InsertTabWrapper ("forward")<cr> inoremap <s-tab> <c-r>=InsertTabWrapper ("backward")<cr> |
$VIM/kin/mswin2.vim |
" Set options and add mapping such that Vim behaves a lot like MS-Windows " " Maintainer: Bram Moolenaar <Bram@vim.org> " Last change: 2002 Mar 05 " set the 'cpoptions' to its Vim default if 1 " only do this when compiled with expression evaluation let s:save_cpo = &cpoptions endif set cpo&vim " backspace in Visual mode deletes selection vnoremap <BS> d " CTRL-X and SHIFT-Del are Cut vnoremap <C-X> "+x " CTRL-C and CTRL-Insert are Copy vnoremap <C-C> "+y " CTRL-V and SHIFT-Insert are Paste map <C-V> "+gP cmap <C-V> <C-R>+ imap <C-V> <ESC><C-V><ESC> " Use CTRL-Q to do what CTRL-V used to do noremap <C-Q> <C-V> " CTRL-Z is Undo; not in cmdline though noremap <C-Z> u inoremap <C-Z> <C-O>u " CTRL-Y is Redo (although not repeat); not in cmdline though noremap <C-Y> <C-R> inoremap <C-Y> <C-O><C-R> " CTRL-A is Select all noremap <C-A> gggH<C-O>G inoremap <C-A> <C-O>gg<C-O>gH<C-O>G cnoremap <C-A> <C-C>gggH<C-O>G " restore 'cpoptions' set cpo& if 1 let &cpoptions = s:save_cpo unlet s:save_cpo endif |
$VIM/kin/matchMe.vim |
"######################################## " File - matchMe.vim " Author - Scott Atkins " Date - Wednesday, August 21, 2002 " E-Mail - kin@cypress.com "######################################## " This code fixes my problem with " does the one format for perl, and acts " correctly with hashes. function! InsertBrackets() let fileType = &ft if fileType == 'perl' let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' && getline('.')[col - 1] !~ '\$' && getline('.')[col - 1] !~ '@' && getline('.')[col - 1] !~ '%' && getline('.')[col - 1] !~ '#' return "{\<cr>\<bs>}\<esc>ko" else return "{}\<esc>i\<c-o>:echo \<cr>" endif else return "{\<cr>\<bs>}\<esc>ko" endif endfunction " This code jumps out of the brackets function! JumpNext(startChar, endChar,oneItem) let ret1 = "\<esc>:if \"0\"==searchpair('".a:startChar."','','".a:endChar."','W','synIDattr(synID(line(\".\"), col(\".\"), 0), \"name\") =~? \"string\"')\<cr>exec(\"normal i\\<right>".a:oneItem."\")\<cr>endif\<cr>i\<right>" return ret1 endfunction " Added toggle. " Date: Thursday, August 29, 2002 @ 07:57 AM " Thanks to: Alex A. Naanou <alex_nanou@yahoo.com> fun! s:Toggle_Edit2() if exists('b:edithelpers_on') && b:edithelpers_on == 1 if (!exists('b:edithelpers2_on') || b:edithelpers2_on == 0) let b:edithelpers2_on=1 " mappings inoremap > <c-r>=JumpNext("<",">","\<m-.>")<cr> inoremap ) <c-r>=JumpNext("(",")","\<m-0>")<cr> inoremap ] <c-r>=JumpNext("[","]","\<m-=>")<cr> inoremap } <c-r>=JumpNext("{","}","\<m-]>")<cr> inoremap <m-=> ] inoremap <m-]> } inoremap <m-.> > inoremap <m-0> ) else unlet b:edithelpers2_on iunmap > iunmap ) iunmap ] iunmap } iunmap <m-=> iunmap <m-]> iunmap <m-.> iunmap <m-0> endif endif endfun " Added toggle. " Date: Thursday, August 29, 2002 @ 07:57 AM " Thanks to: Alex A. Naanou <alex_nanou@yahoo.com> fun! s:Toggle_Edit() if !exists('b:edithelpers_on') || b:edithelpers_on == 0 let b:edithelpers_on=1 " mappings inoremap " ""<esc>i<c-o>:echo <cr> inoremap ' ''<esc>i<c-o>:echo <cr> inoremap < <><esc>i<c-o>:echo <cr> inoremap ( ()<esc>i<c-o>:echo <cr> inoremap [ []<esc>i<c-o>:echo <cr> inoremap { <c-r>=InsertBrackets ()<cr> inoremap <m--> [ inoremap <m-/> " inoremap <m-[> { inoremap <m-,> < inoremap <m-9> ( inoremap <m-'> ' if !exists('b:edithelpers2_on') || b:edithelpers2_on == 0 call <SID>Toggle_Edit2() endif else iunmap " iunmap ' iunmap < iunmap ( iunmap [ iunmap { iunmap <m--> iunmap <m-/> iunmap <m-[> iunmap <m-,> iunmap <m-9> iunmap <m-'> if exists('b:edithelpers2_on') && b:edithelpers2_on == 1 call <SID>Toggle_Edit2() endif unlet b:edithelpers_on endif endfun function VarExists(var, val1, val2) if exists(a:var) | return a:val1 | else | return a:val2 | endif endfunction function CompVar() return VarExists('b:edithelpers_on',VarExists('b:edithelpers2_on','[BC-J] ','[BC] '),'') endfunction nnoremap <silent><F9> :call <SID>Toggle_Edit()<CR> inoremap <silent><F9> <C-O>:call <SID>Toggle_Edit()<CR> call <SID>Toggle_Edit() nnoremap <silent><F8> :call <SID>Toggle_Edit2()<CR> inoremap <silent><F8> <C-O>:call <SID>Toggle_Edit2()<CR> " F-8 toggles the jump " F-9 toggles the bracketing feature and overrides F-8 |
$VIM/kin/comments.vim |
"######################################## " File - comments.vim " Author - Scott Atkins " Date - Wednesday, August 21, 2002 " E-Mail - kin@cypress.com " " "######################################## " This code is from vim.org from the " enhanced commentify script (v. 1.8) " " it is used in a diffrent way here. function s:getFileType() let fileType = &ft if fileType == 'ox' || fileType == 'cpp' || fileType == 'php' || fileType == 'java' let commentSy = '//' elseif fileType == 'ftf' let commentSy = '//' elseif fileType == 'vim' let commentSy = '"' elseif fileType == 'lisp' || fileType == 'scheme' || fileType == 'dosini' let commentSy = ';' elseif fileType == 'tex' let commentSy = '%' elseif fileType == 'caos' let commentSy = '*' elseif fileType == 'm4' || fileType == 'config' || fileType == 'automake' let commentSy = 'dnl ' elseif fileType == 'python' || fileType == 'perl' || fileType == 'make' || fileType =~ '[^w]sh$' || fileType == 'tcl' || fileType == 'jproperties' let commentSy = '#' elseif fileType == 'vb' || fileType == 'aspvbs' let commentSy == "'" elseif fileType == 'plsql' || fileType == 'lua' let commentSy = '--' else execute 'echo "File not supported"' let commentSy = '' endif unlet fileType return commentSy endfunction " This code just adds my initials and the " date/time for any changes I make to " other people's scripts/source files function MyComment() let commentSy = s:getFileType() let s:line=line(".") call append(s:line,commentSy." Added/Changed by ".g:initals) call append(s:line+1,commentSy." Date: ".strftime("%A, %B %d, %Y @ %I:%M %p")) unlet s:line unlet commentSy endfunction " This code is for adding function " headers as I'm writing functions. function! FunctionHeading() let commentSy = s:getFileType() let fun = input("Function Name? ") let s:line=line(".") let retaa = commentSy."########################################\<cr> Function - ".fun."\<cr>Author - ".g:myname."\<cr>Date - ".strftime("%A, %B %d, %Y")."\<cr>Input - \<esc>mzA\<cr>ReturnVal - \<cr>Description - \<cr>\<bs>########################################\<cr>\<bs>" let fileType = &ft if fileType == 'perl' let retb = "sub ".fun."{\<cr> \<esc>mzi\<cr>}" let retc = retaa . retb let retaa = retc unlet retb unlet retc endif return retaa . "\<esc>`zA" unlet retaa unlet fun unlet s:line unlet commentSy endfunction " This code writes my standard header " to a script or source file. function! FileHeading() if has("gui_running") if expand("%") == "" browse confirm w endif endif let commentSy = s:getFileType() let name = expand("%:t") let s:line=line(".") let fileType = &ft let retA = "" let retI = "" if s:line == 1 && fileType == 'perl' let retA = "#!/usr/local/bin/perl -w\<cr>\<bs>" let retI = "use strict;\<cr>" endif let retB = commentSy."########################################\<cr>" let retC = " File - ".name."\<cr>Author - ".g:myname."\<cr>Date -" let retD = " ".strftime("%A, %B %d, %Y")."\<cr>E-Mail - " let retE = g:email1."\<cr> ".g:email2."\<cr>" let retF = g:email3."\<cr>\<bs>\<bs>\<bs>\<bs>Description - \<esc>" let retG = "mzi\<cr>Flags - \<cr>Notes - \<cr>\<bs>" let retH = "########################################\<cr>\<bs>" let retJ = "\<esc>`zA " let retK = retA . retB . retC . retD . retE . retF . retG . retH . retI . retJ unlet retA unlet retB unlet retC unlet retD unlet retE unlet retF unlet retG unlet retH unlet retI unlet retJ return retK unlet s:line unlet commentSy endfunction " Bind all the comment keys inoremap <F3> <c-r>=FileHeading()<cr> inoremap <F4> <c-r>=FunctionHeading()<cr> imap <F5> <esc>mz:execute MyComment()<cr>`zjjA |