From 572148ef725c5f7cfdba47c3eac01bb1d071e363 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Wed, 7 Nov 2012 02:35:55 +0100 Subject: [PATCH] update --- autoload/vim_addon_MarcWeber.vim | 587 +++++++++++++++++++++++++++++-- ftplugin/php_mw.vim | 2 + ftplugin/ruby_mw.vim | 20 ++ ftplugin/sh_mw.vim | 4 +- ftplugin/vim_mw.vim | 1 + 5 files changed, 580 insertions(+), 34 deletions(-) diff --git a/autoload/vim_addon_MarcWeber.vim b/autoload/vim_addon_MarcWeber.vim index 369c119..b28bf2b 100644 --- a/autoload/vim_addon_MarcWeber.vim +++ b/autoload/vim_addon_MarcWeber.vim @@ -11,32 +11,40 @@ fun! vim_addon_MarcWeber#Activate(vam_features) let plugins = { \ 'always': - \ [ + \ [ 'vim-addon-mru', \ empty($XPTEMPLATE) ? 'snipmate-snippets' : 'xptemplate', - \ 'vim-addon-commenting','vim-addon-local-vimrc','vim-addon-sql',"vim-addon-completion", + \ 'vim-addon-commenting', 'vim-addon-local-vimrc', 'vim-addon-sql',"vim-addon-completion", \ 'vim-addon-async', 'tlib', "vim-addon-toggle-buffer", \ "vim-addon-git","vim-addon-mercurial","vim-addon-mw-utils","vim-addon-goto-thing-at-cursor","vim-addon-other", - \ 'matchit.zip', 'vim-addon-syntax-checker', 'vim-addon-rfc' + \ 'matchit.zip', 'vim-addon-syntax-checker', 'vim-addon-rfc', + \ 'vim-addon-mw-utils', 'vim-addon-surround', 'vim-addon-toc' \ ], \ 'extra' : ['textobj-diff', "textobj-function", "narrow_region"], - \ 'vim': ["reload", 'vim-dev-plugin'], - \ 'sql': [], - \ 'php': ["phpcomplete", "vim-addon-xdebug","ZenCoding",'vim-addon-php-manual'], - \ 'scala': ["ensime", "vim-addon-scala","vim-addon-sbt"], - \ 'sml': ["vim-addon-sml"], - \ 'agda' : ["vim-addon-agda"], - \ 'lilypond' : ['vim-addon-lilypond'], - \ 'urweb': ["vim-addon-urweb"], - \ 'ocaml' : ["vim-addon-ocaml"], - \ 'haxe' : [ 'vim-haxe' ], - \ 'as3': ["vim-addon-fcsh","Flex_Development_Support"], - \ 'haskell' : [ "vim-addon-haskell"], - \ 'haskell-scion' : ["scion-backend-vim"], - \ 'ruby' : [ "vim-addon-rdebug", 'vim-addon-ruby-debug-ide' ], - \ 'delphi' : [ "vim-addon-delphi" ], - \ 'nix' : ["vim-addon-nix"], - \ 'coq' : ['vim-addon-coq'], \ } + + " \ 'sql': [], + " \ 'as3': ["vim-addon-fcsh","Flex_Development_Support"], + " \ 'coq' : ['vim-addon-coq'], + " \ 'haskell-scion' : ["scion-backend-vim"], + " \ 'delphi' : [ "vim-addon-delphi" ], + " \ 'haxe' : [ 'vim-haxe' ], + " \ 'scala': ["ensime", "vim-addon-scala","vim-addon-sbt"], + " \ 'sml': ["vim-addon-sml"], + " \ 'agda' : ["vim-addon-agda"], + " \ 'lilypond' : ['vim-addon-lilypond'], + " \ 'urweb': ["vim-addon-urweb"], + " \ 'ocaml' : ["vim-addon-ocaml"], + + " \ '^\%(c\|cpp\)$': [ 'plugin-for-c-development' ], + let g:ft_addons = { + \ '^\%(cabal\|hs\|hsc\|lhs\)$': [ "vim-addon-haskell"], + \ '^\%(php\|inc\|php.inc\|hsc\|lhs\)$': ['theonevimlib',"phpcomplete", "vim-addon-xdebug","ZenCoding", 'vim-addon-php-manual'], + \ 'rb': [ 'vim-ruby', "vim-addon-rdebug", 'vim-addon-ruby-debug-ide' ], + \ 'nix': [ "vim-addon-nix" ], + \ 'vim': ["reload", 'vim-dev-plugin'], + \ } + au FileType * for l in values(filter(copy(g:ft_addons), string(expand('')).' =~ v:key')) | call vam#ActivateAddons(l, {'force_loading_plugins_now':1}) | endfor + let activate = [] for [k,v] in items(plugins) if k == 'always' @@ -56,6 +64,8 @@ fun! vim_addon_MarcWeber#Activate(vam_features) " \ "delimitMate", call vam#ActivateAddons(activate,{'auto_install':1}) + " open file with spaces by using E instead of e + command! -nargs=* E exec 'e '.fnameescape(join([], ' ')) " command MergePluginFiles call vam#install#MergePluginFiles(g:merge+["tlib"], '\%(cmdlinehelp\|concordance\|evalselection\|glark\|hookcursormoved\|linglang\|livetimestamp\|localvariables\|loremipsum\|my_tinymode\|pim\|scalefont\|setsyntax\|shymenu\|spec\|tassert\|tbak\|tbibtools\|tcalc\|tcomment\|techopair\|tgpg\|tmarks\|tmboxbrowser\|tortoisesvn\|tregisters\|tselectbuffer\|tselectfile\|tsession\|tskeleton\|tstatus\|viki\|vikitasks\)\.vim_merged') " command UnmergePluginFiles call vam#install#UnmergePluginFiles() @@ -182,7 +192,7 @@ fun! vim_addon_MarcWeber#Activate(vam_features) noremap \co :exec 'cope '.&lines/3 noremap :SnipMateOpenSnippetFiles " noremap sp :SnipMateOpenSnippetFiles - inoremap :A + inoremap A if isdirectory('src/main/scala') noremap :e src/main/scala/* @@ -190,10 +200,6 @@ fun! vim_addon_MarcWeber#Activate(vam_features) set list listchars=tab:\ \ ,trail:· - augroup FIX_YOUR_WORDING - autocmd BufWritePost * call vim_addon_MarcWeber#FixYourWording() - augroup end - let g:snipMate = { 'scope_aliases' : \ {'objc' :'c' \ ,'cpp': 'c' @@ -208,18 +214,15 @@ fun! vim_addon_MarcWeber#Activate(vam_features) noremap :callvim_addon_MarcWeber#FileByGlobCurrentDir('**/*'.input('glob open '),"\\.git\\.hg" ) -endf -fun! vim_addon_MarcWeber#FixYourWording() - if join(getline(1,'$'),' ') =~ '\cget\s*out\s*of\s*your' - echoe "should be keep out of your way!" - endif + set sw =2 + call vim_addon_MarcWeber#Old() + call vim_addon_MarcWeber#GlobalMappings() endf " TODO refactor: create glob function function! vim_addon_MarcWeber#FileByGlobCurrentDir(glob, exclude_pattern) - exec library#GetOptionalArg('caption', string('Choose a file')) " let files = split(glob(a:glob),"\n") let g = a:glob let replace = {'**': '.*','*': '[^/\]*','.': '\.'} @@ -244,10 +247,530 @@ function! vim_addon_MarcWeber#FileByGlobCurrentDir(glob, exclude_pattern) call tovl#ui#filter_list#ListView({ \ 'number' : 1, \ 'selectByIdOrFilter' : 1, - \ 'Continuation' : library#Function('exec "e ".fnameescape(ARGS[0])'), + \ 'Continuation' : funcref#Function('exec "e ".fnameescape(ARGS[0])'), \ 'items' : files, \ 'cmds' : ['wincmd J'] \ }) endif endif endfunction + +fun! vim_addon_MarcWeber#Old() + + autocmd BufNewFile *autoload**v**/*.vim :call vl#dev#vimscript#vl#InsertVLScriptDocumentationHeader() + + augroup reloadftplugins + au BufWritePost ~/.vim/ftplugin/*.vim bufdo exec 'if exists("b:completion_list")|unlet b:completion_list | endif' + au BufWritePost ~/.vim/ftplugin/*.vim bufdo let &ft=&ft + "let &ft=&ft' or 'exe "set ft=" . &ft + augroup end + " vim: foldmethod=marker + + " autocommands"{{{ + autocmd BufRead,BufNewFile *.y,*.ly :set ft=happy + " recognize ly files:"{{{ + autocmd BufRead,BufNewFile *.ly setlocal filetype= + "}}} + " python"{{{ + augroup Python + autocmd BufRead,BufNewFile *.py :setlocal aw + autocmd BufRead,BufNewFile *.py :setlocal makeprg=python + autocmd BufRead,BufNewFile *.py map :make % + au BufNewFile *.py :put='#!/usr/bin/env python' + au BufNewFile *.py :put='import' + augroup end"}}} + "makefile"{{{ + augroup Makefile + au BufRead,BufNewFile *Makefile* set aw + augroup end + "}}} + augroup abcde + au BufRead *abcde* imap /=./eC + au BufRead *abcde* imap /=./eC + augroup end + augroup sh + au BufRead,BufNewFile *.sh imap -sh #!/bin/bash + augroup end + + " for LINUX only""{{{ + if exists('g:linux') + " scilab:"{{{ + augroup scilab + autocmd BufRead,BufNewFile *.sci map :call Exec('w','!cat %\|scilab \-nw') + autocmd BufRead,BufNewFile *.sci set aw + augroup end"}}} + " set for C/C++ (linux)"{{{ + augroup CCpp + autocmd BufRead,BufNewFile *.cpp setlocal tags+=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include/tags,/usr/include/TAGS + autocmd BufRead,BufNewFile *.h setlocal tags+=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include/tags,/usr/include/TAGS + autocmd BufRead,BufNewFile *.c setlocal tags+=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include/tags,/usr/include/TAGS + augroup end"}}} + " gnuplot"{{{ + augroup GnuPlot + autocmd BufRead,BufNewFile *.gp :setlocal aw + autocmd BufRead,BufNewFile *.gp :setlocal makeprg=gnuplot\ -persist + autocmd BufRead,BufNewFile *.gp map :make % + augroup end"}}} + endif + "}}} + + augroup warn + aug BufRead,BufNewFile *_darcs* echoe " be carefule, darcs_file !" + augroup end + + augroup Spice + autocmd BufRead,BufNewFile *.cir* setlocal ft=spice + augroup end + + augroup Cabal + autocmd BufRead,BufNewFile *.cabal setlocal ft=cabal + augroup end + + augroup Greencard + autocmd BufRead,BufNewFile *.gc setlocal ft=haskell + augroup end + + + augroup DefaultNix + autocmd BufRead,BufNewFile *.nix setlocal ft=nix + "autocmd BufRead,BufNewFile all-packages.nix setlocal autoread | setlocal noswap + augroup end + + augroup Haskell + autocmd BufRead,BufNewFile *.drift setlocal ft=haskell + autocmd BufRead,BufNewFile *.[l]hs.* setlocal ft=haskell + autocmd BufRead,BufNewFile *.lhs.* setlocal ft=haskell + autocmd BufRead,BufNewFile *.hsc setlocal ft=haskell + autocmd BufRead,BufNewFile *.hi let g:hi_bufnr = bufnr('%') | e %:r.*hs |echo 'bd! '.g:hi_bufnr| exec 'bd! '.g:hi_bufnr | unlet g:hi_bufnr | set ft=haskell + augroup end + + augroup Ledger + autocmd BufRead,BufNewFile *.ledger setlocal ft=ledger + augroup end + + augroup Scons + autocmd BufRead,BufNewFile SConstruct setlocal ft=scons + augroup end + + " cpp lex file + augroup Lex + autocmd BufRead,BufNewFile *.ll setlocal ft=lex + augroup end + + augroup foreignlibraries + autocmd BufRead,BufNewFile *foreignl* setlocal readonly + autocmd BufRead,BufNewFile *foreignl* setlocal noswapfile + augroup end + + augroup alex + autocmd BufRead,BufNewFile *.x setlocal ft=alex + augroup end + + augroup MySynEnsureHighlight + autocmd BufRead,BufNewFile * syn match TODO "\ctodo\|fixme" containedin=.* + augroup end + + augroup Nix + "autocmd BufRead,BufNewFile /nix/* call vl#lib#files#switch_files#SwitchFileRegisterLocalRegexSwap('/nix/mynix/','/pr/svnnix/') + "autocmd BufRead,BufNewFile /pr/*nix,/pr/*nix/*.sh call vl#lib#files#switch_files#SwitchFileRegisterLocalRegexSwap('/pr/mynix/','/pr/svnnix/') + "autocmd BufRead,BufNewFile /pr/*nix,/pr/*nix/*.sh call vl#lib#files#switch_files#SwitchFileRegisterLocalRegexSwap('trunk','branches/stdenv-updates') + augroup end + augroup NixSVN + autocmd BufEnter /nix/svnnix/* echo "svn controlled nix file" + augroup end + + augroup Scons + autocmd BufRead,BufNewFile SConstruct setlocal ft=scons + augroup end + + augroup SwapFound + "autocmd SwapExists * let v:swapchoice=input('Swapfilefound, set to ? (o,e,r,d)') + autocmd SwapExists * echo "swap found (o,e,r,d,a) ESC to show default vim menu"| let v:swapchoice=nr2char(getchar()) + augroup end + + augroup NoSync + autocmd BufRead,BufNewFile set noswapsync | set nofsync + augroup end + + augroup UTF + "autocmd BufRead,BufNewFile * if &buftype=='' | setlocal encoding=utf-8 | endif + "autocmd BufRead,BufWritePre,BufNewFile * if &buftype=='' | setlocal fileencoding=utf-8 | endif + augroup end + + augroup Flapjax + autocmd BufRead,BufNewFile *.fjs setlocal ft=flapjax + augroup end + + augroup GPG2 + autocmd BufReadPre,FileReadPre *.gpg + \ set bin + \ | setlocal noswapfile + autocmd BufReadPost,FileReadPost *.gpg + \ exec '%!gpg2 --decrypt 2>/dev/null' + \ | if v:shell_error != 0 + \ | echoe "pgp2 decryption error" + \ | endif + \ | set nobin + \ | setlocal buftype=acwrite + autocmd BufWriteCmd *.gpg + \ exec '%!gpg2 --encrypt 1> ' + \ | if v:shell_error == 0 + \ | set nomodified + \ | else + \ | echoe "pgp2 --encrypt failed with ".v:shell_error + \ | endif + "autocmd BufWritePost,FileWritePost *.gpg !mv :r + + "autocmd FileAppendPre *.gpg !gpg2 --decrypt + "autocmd FileAppendPre *.gpg !mv :r + "autocmd FileAppendPost *.gpg !mv :r + "autocmd FileAppendPost *.gpg !gpg2 --encrypt :r + augroup END + + augroup SQL + autocmd BufRead,BufNewFile *.sql call vim_addon_sql#UI() + augroup end + + + augroup SCSS + autocmd BufRead,BufNewFile *.scss setlocal commentstring=//%s | setlocal comments=:// + augroup end + + augroup Matlab + autocmd BufRead,BufNewFile *.m,*.asv set filetype=matlab + autocmd BufRead,BufNewFile *.m,*.asv silent! map :call vl#lib#quickfix#runtaskinbackground#RunInBGQF(['octave', expand('%')],{ 'efm' : 'ZQp', 'onFinish' : 'cw', 'loadErrorCmd' : 'cfile' }) + augroup end + + augroup MAXIMA + autocmd BufRead,BufNewFile *.max* map :w + \ call tovl#runtaskinbackground#Run({'cmd': ['maxima','-b', expand('%')], + \ 'ef' : 'plugins#tovl#errorformats#PluginErrorFormats#php', 'onFinishCallbacks' : ['cope','normal G']}) + augroup end + + augroup FISH + autocmd BufRead,BufNewFile *.fish setlocal ft=fish + augroup end +endf + +fun! vim_addon_MarcWeber#GlobalMappings() + noremap \og : e /home/marc/mwr/github-MarcWeber/autoload/vim_addon_MarcWeber.vim + noremap g, g;g; + let mapleader='\' + map cx :!chmod +x % + " jump till after end of next word |)) -> ))| | is cursor + inoremap ea + inoremap + inoremap + inoremap jA + inoremap kA + "imap :echo "use m-u" + noremap \sf :updatesource % + inoremap =vl#dev#text#insertheadlines#GetHeadline(input('caption :')) + inoremap : + inoremap =system('date') + + inoremap kyawjPa + inoremap jyawkPa + cmap >e tests/**/ + + inoremap * :set paste*:set nopaste + inoremap \" + inoremap \n + inoremap TODO + inoremap FIXME + inoremap :w + nnoremap :w + nnoremap :Man + + " inoremap A + "inoremap =system('xclip -o -selection clipboard') + " + noremap "+p + noremap "+P + + "commandline + cmap **/* + cmap >no /etc/nixos/nixos/ + cmap >nou /etc/nixos/nixos/upstart-jobs/ + cmap >M ~/mwr/dotvim/Marc/ + cmap >p ~/mwr/dotvim/plugin/ + cmap >ftp ~/mwr/dotvim/ftplugin/ + cmap >as ~/mwr/dotvim/after/syntax/ + cmap >t /tmp/ + cmap >smj src/main/java/ + cmap >smr src/main/resources/ + cmap >stj src/test/java/ + cmap >l ~/mwr/dotvim/autoload/vl/ + cmap >s ~/mwr/vl_repo/autoload/vl/ + cmap >sf ~/mwr/vl_repo/ftplugin/ + cmap >v ~/mwr/dotvim + cmap >F =system('/pr/haskell/hquickfile/dist/build/hquickfile/hquickfile '.input('options')) + noremap >comp ~/mwr/dotvim/compiler/ + + " quickfix / location list + nnoremap :cn + nnoremap :cp + "nnoremap :lnext + "nnoremap :lp + + " by Piet Delport a few years ago. + command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis + + + "quick open + noremap :e Makefile + noremap :make + noremap :Tlist + noremap :exec 'lopen '.&lines/3 + noremap :h + + noremap :bd + noremap :q + "noremap :MRU + "noremap r :MRU/ + noremap :exec 'e '.DirectorySpecificVimFile() + + noremap :messages + + " closeb.vim + noremap :let b:dummy_abc=b:closeb_openname + \ let b:closeb_openname="mymatch" + \ exec 'echo substitute('.g:closeb_Pathfunc.",'/<',\"\\n<\",'g')" + \ let b:closeb_openname = b:dummy_abc unlet b:dummy_abc + noremap :IT + + + + inoremap :call vl#ui#confirm#IfConfirm(&modified,"file wasn't saved yet, delete anyway?","bd!") + noremap :close + noremap :e**/* + noremap :e + noremap :n**/* + + "tags + noremap :ptjump + noremap :ptag + noremap :ptfirst + noremap :ptlast + noremap :ptprevious + noremap :ptnext + + for i in range(8,2,-1) + exec 'imap '.i.' '.repeat('',i-1).'' + exec 'imap '.i.' '.repeat('',i-1).'' + endfor + + noremap :e *.cabal + + " small vim wm + "noremap :call vl#lib#window_management#vimwm#MoveHorizontal('h') + "noremap :call vl#lib#window_management#vimwm#MoveHorizontal('l') + "noremap :call vl#lib#window_management#vimwm#MakeOnlyWindowInCol() + "noremap :call vl#lib#window_management#vimwm#SetWindowSize('h') + "noremap :call vl#lib#window_management#vimwm#SetWindowSize('w') + + " HighlightCurrentLine in current window + noremap :call vl#lib#hl#vim7highlightCurrentLineInActiveWindow#ToggleHighlightCurrentLine() + + "substitution + " selection , document + vnoremap :exec "'<,'>".'s='.input('substitute :').'='.input('with :').'=g' + nnoremap :exec '%s='.input('substitute :').'='.input('with :').'=g' + " replace first + vnoremap :exec "'<,'>".'s='.input('substitute :').'='.input('with :').'=' + nnoremap :exec '%s='.input('substitute :').'='.input('with :').'=' + + noremap /^\s* + noremap ?^\s* + + + " misc things + nnoremap yp yyp + nnoremap y yyP + nnoremap dad ggdG + " search next occurence (in all files) will loop if not found? + noremap sn :while !search( @/, "W") \| bnext \| endwhile + inoremap =expand('%:r:t') + inoremap =expand('%:t') + map fe :echo filereadable(expand('')) + + + " insert helpers + inoremap =vim_addon_other#InsertLT(' ','=',' ') + inoremap =vim_addon_other#InsertLT(' ','+',' ') + inoremap =vim_addon_other#InsertLT(' ','*',' ') + inoremap \\ + "inoremap =vl#dev#text#insertFunctions#InsertWithSpace(")") + "inoremap =vl#dev#text#insertFunctions#InsertWithSpace("]") + "inoremap =vl#dev#text#insertFunctions#InsertWithSpace("}") + "inoremap =vl#dev#text#insertFunctions#InsertWithSpace("(") + "inoremap =vl#dev#text#insertFunctions#InsertWithSpace("[") + "inoremap =vl#dev#text#insertFunctions#InsertWithSpace("{") + "inoremap =vl#dev#text#insertFunctions#InsertWithSpace("]") + "inoremap =vl#dev#text#insertFunctions#InsertWithSpace("}") + "inoremap =vl#dev#text#insertFunctions#InsertWithSpace(")") + + inoremap scl :exec "call append(line('.'),vl#dev#text#insertFunctions#ReturnBar('------ >8 ','".input("caption: ")."' , 20, 60, -1))" + inoremap scr :exec "call append(line('.'),vl#dev#text#insertFunctions#ReturnBar('------ 8< ','".input("caption: ")."' , 20, 60, -1))" + + nnoremap ]l :call NextIndent(0, 1, 0, 1) + + "tabs + map g< :tabp + map g> :tabn2k + for i in range(10,1,-1) + "for getting the nth item from completion menu + exec 'inoremap '.i.' '.repeat('',i).'' + + exec 'noremap '.i.'gt' + exec 'inoremap '.i.'gt' + endfor + + " Plugin mappings" + +"vnoremap :call vl#dev#text#surround#Surround('v') +"nnoremap :call vl#dev#text#surround#Surround('n') +"noremap :call vl#dev#text#surround#RemoveSurrounding() +"noremap :call vl#dev#text#surround#RemoveInnerMostSurrounding() +"TODO fix this: +"noremap :call vl#dev#text#surround#SubstituteSurrounding() +"noremap :call vl#dev#text#surround#SubstituteInnerMostSurrounding() + + + "quick for ( { doesn't 0work + "for i in ['(','{',"'",'<','"'] + " if !has('gui_running') && i == '[' + " continue + " endif + " [>exec 'nnoremap :call vl#dev#text#surround#Surround('n')".i + " [>exec 'inoremap :call vl#dev#text#surround#Surround('n')".i + " [>exec 'vnoremap :call vl#dev#text#surround#Surround('v')".i + " [>exec 'nnoremap :call + " [>vl#dev#text#surround#RemoveSurrounding('n')".i + " [>exec 'vnoremap :call + " [>vl#dev#text#surround#RemoveSurrounding('v')".i + "endfor + + "exec "vnoremap :call vl#dev#text#surround#Surround('v')__(" + + " vimtip12 + " Moving back and forth between lines of same or lower indentation. + nnoremap [l :call NextIndent(0, 0, 0, 1) + nnoremap ]l :call NextIndent(0, 1, 0, 1) + nnoremap [L :call NextIndent(0, 0, 1, 1) + nnoremap ]L :call NextIndent(0, 1, 1, 1) + vnoremap [l :call NextIndent(0, 0, 0, 1)m'gv'' + vnoremap ]l :call NextIndent(0, 1, 0, 1)m'gv'' + vnoremap [L :call NextIndent(0, 0, 1, 1)m'gv'' + vnoremap ]L :call NextIndent(0, 1, 1, 1)m'gv'' + onoremap [l :cala:l NextIndent(0, 0, 0, 1) + onoremap ]l :call NextIndent(0, 1, 0, 1) + onoremap [L :call NextIndent(1, 0, 1, 1) + onoremap ]L :call NextIndent(1, 1, 1, 1) + nmap gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/ + + noremap :exec getline('.') + + noremap ttw :%s/\s*$// + + "commands + command! RemoveTrailingWhiteSpace :%s=\s*$== + command! -nargs=+ InBG :call vl#lib#quickfix#runtaskinbackground#RunMakeInBG() + + function! s:OpenMySQLManual() + EditAnyMemory mysql/manual.txt + noremap :call vl#ui#navigation#jump_to_code_by_regex#Outline("^\\d")/ + noremap :call vl#ui#navigation#jump_to_code_by_regex#Outline("^\\d") + endfunction + command! MySQLManual :call s:OpenMySQLManual() + + map :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' + \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" + \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" + + map :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' + \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" + \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" + + " noremap \eam :EditAnyMemory + noremap \eam :e ~/mwr/dotvim/mymemories/**/* + noremap :StatusGit + " noremap :TRecentlyUsedFiles + + + + set history=300 + set ruler + set noshowcmd + set incsearch + set modeline + set backspace=indent,eol,start + set hidden + set expandtab + set wildmode=list:longest + set wildmenu + "set wildmode=list:longest + + + " let g:scaleFont='Luxi\ Mono\ #{SIZE}' + " let g:scaleFontSize=12 + " let g:scaleFontWidth=9 + set lazyredraw + set expandtab + set sw=2 + set shm=a + set bs=2 + + + let g:store_vl_stuff = expand('~/vl_store') + let g:vl_top_dir = substitute(expand(':h'),'[/\\]plugin$','','') + let g:dotvim=expand(':h') + let vl_repo = simplify(g:dotvim.'/../vl_repo') + let noswapsync='' + + if expand('$TERM') == 'rxvt-unicode' + set term=builtin_vt320 + endif + if has('unix') + let t = "/tmp/vim-swaps-".$HOME.getcwd() + if !isdirectory(t) | call mkdir(t, "p") | endif + exec 'set dir='.t + unlet t + endif + + map \or +endf + +set wildignore+=.git +set wildignore+=.hg +set wildignore+=.svn + + +" function! If(condition, then_v, else_v) +" if a:condition +" exec a:then_v +" else +" exec u:else_v +" endif +" endfunction +" function! IfE(condition, then_v, else_v) +" if a:condition +" exec 'return '.a:then_v +" else +" exec 'return '.a:else_v +" endif +" endfunction + +fun! Exec(...) + let i=1 + while i<=a:0 + exec a:{i} + let i+=1 + endwhile +endfun + +let g:aliases_file='/home/marc/.mutt-aliases' +augroup ADD_CONFLICT_MARKERS_MATCH_WORDS + " git onlny for now + autocmd BufRead,BufNewFile * exec 'let b:match_words '.(exists('b:match_words') ? '.' : '').'= '.string(exists('b:match_words') ? ',' : ''.'<<<<<<<:=======:>>>>>>>') +augroup end diff --git a/ftplugin/php_mw.vim b/ftplugin/php_mw.vim index 1e9e110..0781152 100755 --- a/ftplugin/php_mw.vim +++ b/ftplugin/php_mw.vim @@ -1,3 +1,5 @@ +ActivateAddons theonevimlib +call theonevimlibsetup#Setup() "print_isetlocal fdm=indent "finish " pear coding standard diff --git a/ftplugin/ruby_mw.vim b/ftplugin/ruby_mw.vim index 90174ef..e0e1b63 100644 --- a/ftplugin/ruby_mw.vim +++ b/ftplugin/ruby_mw.vim @@ -11,10 +11,30 @@ fun! s:LTSp(s) endf inoremap =LTSp("=>") +inoremap =vim_addon_other#InsertLT(' ','\|\|=',' ') +inoremap require_relative " noremap :cfile errors-dev.txt +inoremap puts" +inoremap .include? +inoremap lambda {\| + fun! Ri(s) endf command! -nargs=1 Ri call views#View('exec',['sh', '-c', 'ri '..' sed -e "s/.//g" -e "s///"']) + +if (!filereadable(expand('%'))) + exec "normal I# encoding: UTF-8" +endif + +let b:match_words = + \ '\<\%(unless\|case\|while\|until\|for\|do\|class\|module\|def\|begin\)\>=\@!\|do\s\+|[^|]*|\|^\s*if\>' . + \ ':' . + \ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' . + \ ':' . + \ '\' . + \ ',{:},\[:\],(:)' + + diff --git a/ftplugin/sh_mw.vim b/ftplugin/sh_mw.vim index 1b3e00c..428d6d1 100755 --- a/ftplugin/sh_mw.vim +++ b/ftplugin/sh_mw.vim @@ -2,14 +2,14 @@ syn match Error '\\\s\+$' contained inoremap -sh #!/bin/sh -call vl#lib#completion#contextcompletion#ContextCompletionDefault() +" call vl#lib#completion#contextcompletion#ContextCompletionDefault() set sw=2 " sed -i -e 's/^\(\s*\)@\(.*\)/\1\2/' "call vl#lib#template#template#AddTemplateUI() -AddMCRCompletion ()$ {\}\O fitness:break +" AddMCRCompletion ()$ {\}\O fitness:break if expand('%') =~ 'nix' && vl#lib#buffer#utils#FileIsNew() put='source $stdenv/setup' diff --git a/ftplugin/vim_mw.vim b/ftplugin/vim_mw.vim index b4c05b3..f6ad252 100755 --- a/ftplugin/vim_mw.vim +++ b/ftplugin/vim_mw.vim @@ -1,3 +1,4 @@ +call theonevimlibsetup#Setup() fun! s:LTSp(s) return vim_addon_other#InsertLT(' ',a:s,' ') endf