Permalink
Browse files

Many changes in the new job

  • Loading branch information...
1 parent 7e9c4f1 commit bb62ce2af3b567a67da1e940b4609f91c9c9f5ab @derekwyatt committed Sep 17, 2012
View
1 .gitignore
@@ -29,6 +29,7 @@ vim-jade
vim-sbt
vim-ctrlp
vim-powerline
+vim-command-t
*.swp
.netrwhist
passwords.vim
View
1 after/ftdetect/pom.ftdetect.vim
@@ -0,0 +1 @@
+au BufRead,BufNewFile pom.xml set filetype=pom
View
1 bundle/from_github.md
@@ -26,3 +26,4 @@
* **Conque**: `git clone https://github.com/rson/vim-conque.git vim-conque`
* **Jade**: `git clone https://github.com/vim-scripts/jade.vim.git vim-jade`
* **SBT**: `git clone https://github.com/derekwyatt/vim-sbt.git vim-sbt`
+* **Command-T**: `git clone https://github.com/wincent/Command-T.git vim-command-t`
View
146 bundle/vim-netdict/doc/netdict.txt
@@ -0,0 +1,146 @@
+*netdict.txt* Retrieve term definitions from the Internet.
+
+ N E T D I C T
+
+1. Introduction |intro|
+2. Settings |settings|
+3. Mappings |mappings|
+4. Commands |commands|
+5. TODO |todo|
+6. Copyright |copyright|
+
+==============================================================================
+1. Introduction *intro*
+
+Netdict is a plugin to retrieve word and other definitions from the Internet
+using the Unix DICT protocol client.
+
+==============================================================================
+2. Settings *settings*
+
+The following global variables are available and may be specified in your
+configuration file via the |:let| command.
+
+ *netdict_dictprg*
+Specifies the command to execute dict. The default is 'dict --pager -'.
+
+ *netdict_xargs*
+Specifies any extra options to pass to |netdict_dictprg|. See the dict(1)
+manual page for available options. The default is empty.
+
+ *netdict_database*
+The default database to search when looking up terms. If empty, the default,
+search all available databases.
+
+ *netdict_strategy*
+The default strategy to use when searching a database. If empty, the default,
+use the servers default strategy which is normally 'exact'.
+
+ *netdict_expand*
+When selecting terms with any of the cursor lookup or match plugins and this
+option is set to 1, then all words enclosed in '"' or '{}' are used as the
+term in all windows and not just the definition window. Otherwise only the
+word under the cursor (see |<cword>|) is used as the term.
+
+ *netdict_extra_history*
+Setting this to zero disables adding words selected with any of the cursor
+lookup or match plugins and |commands| to the input history. The default is 1
+or enabled.
+
+==============================================================================
+3. Mappings *mappings*
+
+The following are the default key mappings. You can easily change them by
+specifying the |{rhs}| of the |:map| command as one of the plugin names in
+your configuration file.
+
+ *<Leader>ll*
+ *<Plug>NetdictLookup*
+Prompt for input of a term in normal mode. If a term contains spaces or
+special characters it must be enclosed in double quotes to prevent the shell
+from interpreting them. You can select an alternate database and search
+strategy for the term by separating them with spaces. The format for input is:
+
+ term [!|*|database [ strategy ]]
+
+A database named '!' returns results from the first matching database only. A
+database named '*' searches all available databases and is usally specified
+when using an alternate search strategy. Otherwise the named database is one
+available from the server. See |<Plug>NetdictShowDB|.
+
+If you are running a version of VIM which was compiled with |+dialog_gui| then
+a new window will be created prompting you for the search term which has the
+same format as above.
+
+ *<Leader>lm*
+ *<Plug>NetdictMatch*
+Display a list of possible matches for the specified term rather than
+definitions.
+
+ *<Leader>ld*
+ *<Plug>NetdictShowDB*
+Show a list of searchable databases from the server.
+
+ *<Leader>ls*
+ *<Plug>NetdictShowStrat*
+Show a list of search strategies from the server.
+
+ *<Leader>lcl*
+ *<Plug>NetdictCursorLookup*
+Lookup the definition of the word under the cursor (see |netdict_expand|) in
+normal mode without prompting for input. If the word is a hyperlink (enclosed
+in {}) or a term of possible matches from the definition window, then only
+definitions for the term in the associated database will be shown.
+
+ *<Leader>lcm*
+ *<Plug>NetdictCursorMatch*
+Lookup possible matches for the word under the cursor (see |netdict_expand|)
+in normal mode without prompting for input.
+
+ *<C-T>*
+Goto to the previous definition when in the definition window.
+
+ *]]* *[[*
+Jump to the next or previous [count] definition or match when in the
+definition window. When jumping between definitions Netdict will try and
+position the match at the top of the window. If this doesn't work then it is
+probably do to |'scrolloff'| being greater than zero.
+
+ *}}* *{{*
+Jump to the next or previous [count] hyperlink when in the definition window.
+
+==============================================================================
+4. Commands *commands*
+
+ *:Lookup*
+Like |<Plug>NetdictLookup| but without a prompt. If no arguments are given
+then a prompt is displayed just as if |<Plug>NetdictLookup| were used.
+
+Example:
+ :Lookup "^somet" web1913 re
+
+would return all words from the Webster's dictionary beginning with 'somet'.
+
+ *:Match*
+Like |:Lookup| but behaves like |<Plug>NetdictMatch|.
+
+==============================================================================
+5. TODO *todo*
+
+Below are some things I'd like to see in future versions. If you have any
+other suggestions feel free to let me know or send me some patches.
+
+ * multiword terms in (character) visual mode 'v'
+ * support multiword terms that span more than one line
+ * gui mouse support and syntax highlighting (I dont have a gui yet)
+
+==============================================================================
+6. Copyright *copyright*
+
+Netdict is written by Ben Kibbey <bjk@luxsci.net> and is distributed under the
+terms of the GNU General Public License.
+
+The latest version can be found either at http://arbornet.org/~bjk/vim/ or at
+VIM Online http://www.vim.org/.
+
+ vim:tw=78:ts=8:
View
586 bundle/vim-netdict/plugin/netdict.vim
@@ -0,0 +1,586 @@
+" Vim plugin to look up term definitions using `dict'.
+" Maintainer: Ben Kibbey <bjk@luxsci.net>
+" Last Change: Aug 05, 2006
+" Requirements: VIM 6/7 and a dict protocol client.
+
+if exists("loaded_netdict")
+ finish
+endif
+
+let loaded_netdict = 1
+
+if !exists("g:netdict_dictprg")
+ let g:netdict_dictprg = "dict --pager -"
+endif
+
+if !exists("g:netdict_strategy")
+ let g:netdict_strategy = ""
+endif
+
+if !exists("g:netdict_database")
+ let g:netdict_database = ""
+endif
+
+if !exists("g:netdict_xargs")
+ let g:netdict_xargs = ""
+endif
+
+if !exists("g:netdict_expand") || g:netdict_expand > 1 || g:netdict_expand < 0
+ let g:netdict_expand = 0
+endif
+
+if !exists("g:netdict_extra_history") || g:netdict_extra_history > 1
+ \ || g:netdict_extra_history < 0
+ let g:netdict_extra_history = 1
+endif
+
+noremap <unique> <script> <Plug>NetdictLookup <SID>NetdictLookup
+noremap <unique> <script> <Plug>NetdictMatch <SID>NetdictMatch
+noremap <unique> <script> <Plug>NetdictCursorLookup <SID>NetdictCursorLookup
+noremap <unique> <script> <Plug>NetdictCursorMatch <SID>NetdictCursorMatch
+noremap <unique> <script> <Plug>NetdictShowDB <SID>NetdictShowDB
+noremap <unique> <script> <Plug>NetdictShowStrat <SID>NetdictShowStrat
+
+
+noremap <SID>NetdictLookup :call <SID>LookupTerm()<CR>
+noremap <SID>NetdictMatch :call <SID>LookupTerm(1)<CR>
+noremap <SID>NetdictCursorLookup :call <SID>GetCursorTerm(0)<CR>
+noremap <SID>NetdictCursorMatch :call <SID>GetCursorTerm(1)<CR>
+noremap <SID>NetdictShowStrat :call <SID>FetchStrategies()<CR>
+noremap <SID>NetdictShowDB :call <SID>FetchDatabases()<CR>
+
+noremenu <script> Plugin.&Netdict.-sep- <nul>
+noremenu <script> <silent> Plugin.Netdict.&Lookup\ Term <SID>NetdictLookup
+noremenu <script> <silent> Plugin.Netdict.L&ookup\ Cursor\ Term <SID>NetdictCursorLookup
+noremenu <script> <silent> Plugin.Netdict.&Match\ Term <SID>NetdictMatch
+noremenu <script> <silent> Plugin.Netdict.M&atch\ Cursor\ Term <SID>NetdictCursorMatch
+noremenu <script> Plugin.Netdict.Available\ &Databases <SID>NetdictShowDB
+noremenu <script> Plugin.Netdict.Available\ &Strategies <SID>NetdictShowStrat
+
+if !hasmapto('<Plug>NetdictLookup')
+ nmap <unique> <silent> <Leader>ll <Plug>NetdictLookup
+endif
+
+if !hasmapto('<Plug>NetdictMatch')
+ nmap <unique> <silent> <Leader>lm <Plug>NetdictMatch
+endif
+
+if !hasmapto('<Plug>NetdictCursorLookup')
+ nmap <unique> <silent> <Leader>lcl <Plug>NetdictCursorLookup
+endif
+
+if !hasmapto('<Plug>NetdictCursorMatch')
+ nmap <unique> <silent> <Leader>lcm <Plug>NetdictCursorMatch
+endif
+
+if !hasmapto('<Plug>NetdictShowDB')
+ nmap <unique> <silent> <Leader>lD <Plug>NetdictShowDB
+endif
+
+if !hasmapto('<Plug>NetdictShowStrat')
+ nmap <unique> <silent> <Leader>ls <Plug>NetdictShowStrat
+endif
+
+if exists(":Lookup") != 2
+ comm -nargs=* Lookup call <SID>NetdictCmd(0, <f-args>)
+endif
+
+if exists(":Match") != 2
+ comm -nargs=* Match call <SID>NetdictCmd(1, <f-args>)
+endif
+
+let s:netdict_tag_depth = 0
+let s:netdict_last_history = 0
+
+func <SID>GetCursorTerm(match)
+ let ft = getwinvar(".", "&filetype")
+ let word = expand("<cword>")
+
+ if g:netdict_expand == 0 && ft != "netdict"
+ if a:match == 1
+ call <SID>LookupTerm(word, 1)
+ else
+ call <SID>LookupTerm(word)
+ endif
+
+ return
+ endif
+
+ let line = getline(".")
+ let i = col(".") - 1
+
+ while i < strlen(line)
+ if line[i] == '}' || line[i] == '"'
+ let c = line[i]
+ let end = i
+ break
+ endif
+
+ let i = i + 1
+ endwhile
+
+ let i = col(".") - 1
+
+ if exists("end")
+ while i >= 0
+ if line[i] == '{' || line[i] == '"'
+ let start = i
+ break
+ endif
+
+ let i = i - 1
+ endwhile
+ endif
+
+ if match(getline(1), '^\p\+: .*$') != -1
+ let matchmode = 1
+ endif
+
+ if exists("start") && exists("end")
+ let word = strpart(line, start + 1, (end - start) - 1)
+
+ if stridx(word, " ") != -1
+ let word = '"'.word.'"'
+ endif
+
+ if ft == "netdict" && !exists("matchmode") && a:match != 1 && a:0 < 1
+ let i = search('^\w.* \(.*\) \[.*\]:\s*$', 'b')
+
+ if i > 0
+ let db = substitute(getline(i), '.* \[\(.*\)\]:\s*$',
+ \ '\1', '')
+ endif
+ endif
+ endif
+
+ if exists("matchmode") && a:0 < 1
+ let i = line(".")
+
+ while i > 0
+ if match(getline(i), '^\p\+: .*$') != -1
+ let db = substitute(getline(i), '^\(\p\+\): .*$',
+ \ '\1', '')
+ break
+ endif
+
+ let i = i - 1
+ endwhile
+ endif
+
+ if exists("db")
+ let word = word . " " . db
+ endif
+
+ if a:match == 1
+ call <SID>LookupTerm(word, 1)
+ else
+ call <SID>LookupTerm(word)
+ endif
+
+ return
+endfunc
+
+func <SID>NetdictCmd(match, ...)
+ if a:0 == 0
+ if a:match == 1
+ call <SID>LookupTerm(1)
+ else
+ call <SID>LookupTerm()
+ endif
+
+ return
+ endif
+
+ let args = a:1
+ let i = 2
+
+ while exists("a:" . i)
+ let args = args.' '.a:{i}
+ let i = i + 1
+ endwhile
+
+ if a:match == 1
+ call <SID>LookupTerm(args, 1)
+ else
+ call <SID>LookupTerm(args)
+ endif
+
+ return
+endfunc
+
+func <SID>FetchDatabases()
+ call s:Echo("Fetching databases...")
+ call <SID>RunDict(1, "--dbs")<CR>
+endfunc
+
+func <SID>FetchStrategies()
+ call s:Echo("Fetching strategies...")
+ call <SID>RunDict(1, "--strats")
+endfunc
+
+func s:RunDict(...)
+ let prog = strpart(g:netdict_dictprg, " ", stridx(g:netdict_dictprg, " "))
+
+ if prog == ''
+ let prog = g:netdict_dictprg
+ endif
+
+ if executable(prog) != 1
+ if has("gui_running") && has("dialog_gui")
+ call confirm("The command \"" . prog . "\" could not be found in your $PATH.")
+ return ''
+ else
+ call s:Echo("The command \"" . prog . "\" could not be found in your $PATH.")
+ return ''
+ endif
+ endif
+
+ let s:tmpfile = tempname()
+ let args = g:netdict_dictprg . " " . g:netdict_xargs . " "
+ let i = 2
+
+ while exists("a:" . i)
+ let args = args . a:{i}
+ let i = i + 1
+ endwhile
+
+ let args = args . " | tee " . s:tmpfile . ";"
+ let result = system(args)
+
+ if v:shell_error
+ call s:Echo("Problem while executing \"" . args . "\"")
+ return
+ endif
+
+ if a:1
+ echo result
+ return
+ endif
+
+ return result
+endfunc
+
+func s:ParseTerm(term)
+ let word = a:term
+ let word = substitute(word, '^[ ]*', "", "")
+ let pos = strridx(word, '"')
+
+ if pos != -1
+ let more = strpart(word, pos + 1)
+ let word = strpart(word, 0, pos + 1)
+ else
+ if word =~ '^\S* .*$'
+ let pos = stridx(word, " ")
+ let more = strpart(word, pos + 1)
+ let word = strpart(word, 0, pos + 1)
+ endif
+ endif
+
+ if exists("more")
+ let more = substitute(more, '^\s*', '', '')
+
+ if more =~ '^.* .*$'
+ let pos = stridx(more, " ")
+ let s:db = substitute(strpart(more, 0, pos), '[ ]', '', '')
+ let s:strat = substitute(strpart(more, pos + 1), '[ ]', '', '')
+ else
+ if more != ''
+ let s:db = substitute(more, '[ ]', '', '')
+ endif
+ endif
+ endif
+
+ let word = escape(word, "`{}[]")
+ return word
+endfunc
+
+func <SID>LookupTerm(...)
+ let s:db = g:netdict_database
+ let s:strat = g:netdict_strategy
+ let match = ""
+
+ if a:0 == 0 || a:1 == 1
+ if exists("a:1")
+ let match = " -m "
+ let type = "Match "
+ else
+ let type = "Lookup "
+ endif
+
+ if has("gui_running") && has("dialog_gui")
+ let word = inputdialog("Enter the term to " . tolower(type) . "in the text field below. If the term contains any spaces it should be enclosed in double quotes.\n\nA database may be specified by following the term with a space then the database name. A database of \"!\" will stop searching after the first match from any database, \"*\" will search all databases.\n\nA strategy may be specified by following the database name with a space then the strategy name.\n\nExample: \"^re.*ination\" gcide re", (s:netdict_last_history ? histget("input", s:netdict_last_history) : ''))
+ else
+ let word = input(type . "(<term> [!|*|db [strategy]]): ")
+ endif
+
+ if word =~ '^\s*$'
+ return
+ endif
+
+ let word = s:ParseTerm(word)
+ else
+ if exists("a:2")
+ let match = " -m "
+ endif
+
+ if a:1 =~ '^\s*$'
+ return
+ endif
+
+ let word = s:ParseTerm(a:1)
+ endif
+
+ let word = substitute(word, '[[:space:]]*$', '', '')
+
+ if g:netdict_extra_history == 1
+ call histadd("input", word.(s:db != '' ? ' '.s:db : ''). (s:strat != '' ? ' '.s:strat : ''))
+
+ let s:netdict_last_history = histnr("input")
+ endif
+
+ call s:Echo("Looking up " . (word[0] == '"' ? "" : '"') . word . (word[0] == '"' ? "" : '"') . (s:db != '' ? " in ".s:db : '') . ' ...')
+
+ if s:db != ''
+ let s:db = " --database " . escape(s:db, "'!#*$")
+ endif
+
+ if s:strat != ''
+ let s:strat = " --strategy " . s:strat
+ endif
+
+ let def = <SID>RunDict(0, s:db, s:strat." ", match, escape(word, "'!#$"))
+
+ if def == ''
+ return
+ endif
+
+ if def =~ '^No \(matches\|definitions\) found for \%["]'.word.'\%["].$'
+ call s:Echo(def)
+ return
+ endif
+
+ if match(def, '.*, use -[DS] for a list.*') != -1
+ let tmp = substitute(def, '\(.* is not a valid .*\),.*', '\1', '')
+
+ if tmp =~ '^No .*'
+ let tmp = substitute(tmp, '.*".\(.*\)$', '\1', '')
+ endif
+
+ call s:Echo(tmp)
+ return
+ endif
+
+ let results = <SID>Dumpdef(word, s:tmpfile)
+
+ if match(results, '^[0] ') != -1
+ call s:Echo("")
+ return
+ endif
+
+ call s:Echo(substitute(results, '\%["]"\([^"]*\)"\%["]', '"\1"', 'g'))
+ return
+endfunc
+
+func s:Dumpdef(word, tmpfile)
+ " this is borrowed from man.vim
+ exec "let s:netdict_tag_buf_".s:netdict_tag_depth." = ".bufnr("%")
+ exec "let s:netdict_tag_lin_".s:netdict_tag_depth." = ".line(".")
+ exec "let s:netdict_tag_col_".s:netdict_tag_depth." = ".col(".")
+
+ let s:netdict_tag_depth = s:netdict_tag_depth + 1
+
+ if &filetype != "netdict"
+ let thiswin = winnr()
+
+ exec "norm! \<C-W>b"
+
+ if winnr() == 1
+ new
+ else
+ exec "norm! " . thiswin . "\<C-W>w"
+
+ while 1
+ if &filetype == "netdict"
+ break
+ endif
+
+ exec "norm! \<C-W>w"
+
+ if thiswin == winnr()
+ new
+ break
+ endif
+ endwhile
+ endif
+ endif
+
+ sil exec "edit " . a:tmpfile
+ setl modifiable
+ sil exec "norm 1GdG"
+ sil exec "read " . a:tmpfile
+
+ let results = <SID>ParseWin(a:word)
+
+ setl filetype=netdict nomodified
+ setl bufhidden=hide
+ setl nobuflisted
+
+ nnoremap <buffer> <C-t> :call <SID>PopDef()<CR>
+
+ if match(getline(1), '^\p\+: .*$') != -1
+ nnoremap <buffer> <silent> ]] :<C-U>call
+ \ <SID>Search('\(\p\+[-:"]\)\@!\w\+', 0, 1)<CR>
+ nnoremap <buffer> <silent> [[ :<C-U>call
+ \ <SID>Search('\(\p\+[-:"]\)\@!\w\+', 1, 1)<CR>
+ 1
+ sil exec 'norm ]]'
+ else
+ nnoremap <buffer> <silent> ]] :call <SID>Search('^[=]\+\n^\p.*:\s*$', 0)<CR>
+ nnoremap <buffer> <silent> [[ :call <SID>Search('^[=]\+\n^\p.*:\s*$', 1)<CR>
+ nnoremap <buffer> <silent> }} :call <SID>Search('{[^}]\+}', 0, 1)<CR>
+ nnoremap <buffer> <silent> {{ :call <SID>Search('{[^}]\+}', 1, 1)<CR>
+ 1
+ endif
+
+ return results
+endfunc
+
+func s:ParseWin(word)
+ let results = ""
+ let result = 0
+
+ while getline(1) =~ "^\s*$"
+ sil exec "norm 1Gdd"
+ endwhile
+
+ if getline(1) =~ '^\d\+\sdefinition\%[s]\sfound$'
+ sil exec "norm 1G2dd"
+ elseif getline(1) =~ '^\d\+\smatch\%[e]\%[s]\sfound$'
+ let result = substitute(getline(1), '^\(\d*\).*', '\1', '')
+ sil exec "norm 1Gdd"
+ elseif getline(1) =~ '^No .*, perhaps you mean:$'
+ let result = "Alternate"
+ sil exec "norm 1Gdd"
+ endif
+
+ call cursor(1, 1)
+
+ if getline(1) =~ '^\w\+: .*$'
+" sil exec ':%s/ / /g'
+ else
+ let total = 0
+ let save_pos = getpos(".")
+
+ while 1
+ " The 'c' flag is needed to match the first line.
+ let i = search('^From .* \(.*\)[ ]*\[.*\]:$', "Wc")
+
+ if i == 0
+ break
+ else
+ let total = total + 1
+ " Without the following two lines the loop would never end
+ " ('c' flag from above).
+ let pos = [0, i + 1, 0, 0]
+ call setpos('.', pos)
+ endif
+ endwhile
+
+ call setpos('.', save_pos)
+
+ while 1
+ let i = search('^From .* \(.*\)[ ]*\[.*\]:$', "Wc")
+
+ if i == 0
+ break
+ endif
+
+ let tmp = substitute(getline(i), "^From \\(.*\\)", "\\1", "")
+ let @z = "="
+ let n = getwinvar(".", "&textwidth")
+
+ if n < strlen(tmp)
+ let n = strlen(tmp)
+ else
+ while strlen(tmp) < n
+ let tmp = tmp.' '
+ endwhile
+ endif
+
+ call setline(i, "")
+ sil exec 'norm ' . n . '"zp'
+ sil exec ':put =tmp'
+ call cursor(i + 2, 0)
+ sil exec 'norm ' . n . '"zp'
+
+ let result = result + 1
+ let @z = '['.result.' of '.total.']='
+
+ call cursor(i + 2, n - strlen(@z))
+ sil exec 'norm '.strlen(@z).'x"zp'
+ endwhile
+ endif
+
+ return result." ".(result != 1 ? "results" : "result").
+ \' for "'.a:word.'"'
+endfunc
+
+func s:Search(pattern, dir, ...)
+ if getline(1) =~ '^\w\+: .*$'
+ let cnt = v:count1
+ else
+ let cnt = (v:count1 > 1 && a:dir == 1 ? v:count1 + 1 : v:count1)
+ endif
+
+ while cnt > 0
+ let i = search(a:pattern, (a:dir == 1 ? 'b' : ''))
+
+ if i == 0
+ return
+ endif
+
+ let cnt = cnt - 1
+ endwhile
+
+ if a:0 == 0
+ sil exe 'norm L'.winline().'j'.i.'G'
+ endif
+
+ return
+endfunc
+
+func! <SID>PopDef()
+ if s:netdict_tag_depth > 1
+ let s:netdict_tag_depth = s:netdict_tag_depth - 1
+
+ exec "let s:netdict_tag_buf=s:netdict_tag_buf_".s:netdict_tag_depth
+ exec "let s:netdict_tag_lin=s:netdict_tag_lin_".s:netdict_tag_depth
+ exec "let s:netdict_tag_col=s:netdict_tag_col_".s:netdict_tag_depth
+ exec s:netdict_tag_buf."b"
+ exec s:netdict_tag_lin
+ exec "norm ".s:netdict_tag_col."|"
+ exec "unlet s:netdict_tag_buf_".s:netdict_tag_depth
+ exec "unlet s:netdict_tag_lin_".s:netdict_tag_depth
+ exec "unlet s:netdict_tag_col_".s:netdict_tag_depth
+
+ unlet s:netdict_tag_buf s:netdict_tag_lin s:netdict_tag_col
+ else
+ call s:Echo("No previous term")
+ endif
+
+ return
+endfunc
+
+" an old message isnt cleared for me (maybe my TERM) so i pad the message with
+" spaces
+func s:Echo(str)
+ let line = substitute(a:str, '[[:space:]]*$', '', '')
+ let n = getwinvar(".", "&columns")
+
+ while strlen(line) < n - 1
+ let line = line.' '
+ endwhile
+
+ echohl Normal | echon "\r" . line | echohl None
+ return
+endfunc
View
62 bundle/vim-netdict/syntax/netdict.vim
@@ -0,0 +1,62 @@
+" Vim syntax file
+" Language: Netdict plugin
+" Maintainer: Ben Kibbey <bjk@luxsci.net>
+
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+syn case ignore
+
+syn keyword netdictRef syn ant
+syn match netdictFOLDOC /\s\+<\([a-z ,]\+\)>\s/
+syn match netdictSeparator /^[=]\+$/
+syn match netdictDBName /\[\p\+\]/hs=s+1,he=e-1 contained
+syn match netdictDatabase /^\p.*\[.*\]:\s*/ contains=netdictDBName
+syn match netdictDefinitionN /[.]*\d\+[:.]/he=e-1
+syn match netdictMatchN /[.]*\[\d\+ of \d\+\]/ contained
+syn match netdictSeparator /^[=]\+\[\d\+ of \d\+\][=]$/ contains=netdictMatchN
+syn match netdictTermUsage /\s\+(\l) /
+syn match netdictMatchDB /^\p\+: /he=e-3
+syn match netdictHyperLink /{[^}]*}/
+syn region netdictType start=/\[/ end=/\]/ contains=netdictHyperLink,netdictRef
+
+if version >= 508 || !exists("did_c_syn_inits")
+ if version < 508
+ let did_c_syn_inits = 1
+ command -nargs=+ HiLink hi link <args>
+ else
+ command -nargs=+ HiLink hi def link <args>
+ endif
+
+ hi nSeparator term=bold cterm=bold ctermfg=5 guifg=DarkGray
+ hi nDBTitle term=bold cterm=NONE ctermfg=7 ctermbg=4 guifg=Darkred
+ hi nDBName term=bold cterm=bold ctermfg=3 ctermbg=4 guifg=Orange
+ hi nMatchDBName term=bold cterm=NONE ctermfg=3 guifg=Orange
+ hi nHyperLink term=bold cterm=standout ctermfg=6 guibg=black guifg=goldenrod
+ hi nDefinitionN term=reverse cterm=reverse ctermfg=2 guifg=darkgreen
+ hi nMatchN term=reverse cterm=NONE ctermfg=1 guifg=darkgreen
+ hi nFOLDOC term=NONE cterm=NONE ctermfg=5
+ hi nReference term=underline cterm=NONE ctermfg=5
+ hi nType term=underline cterm=NONE ctermfg=3
+ hi nUsage term=bold cterm=NONE ctermfg=3
+
+ HiLink netdictSeparator nSeparator
+ HiLink netdictDBName nDBName
+ HiLink netdictDatabase nDBTitle
+ HiLink netdictHyperLink nHyperLink
+ HiLink netdictDefinitionN nDefinitionN
+ HiLink netdictMatchN nMatchN
+ HiLink netdictFOLDOC nFOLDOC
+ HiLink netdictRef nReference
+ HiLink netdictType nType
+ HiLink netdictMatchDB nMatchDBName
+ HiLink netdictTermUsage nUsage
+
+ delcommand HiLink
+endif
+
+let b:current_syntax = "netdict"
View
70 ftplugin/java.vim
@@ -0,0 +1,70 @@
+setlocal formatoptions=crq
+setlocal textwidth=80
+setlocal foldmethod=marker
+setlocal foldmarker=//{,//}
+setlocal foldlevel=0
+setlocal sw=4
+
+if !exists("*s:CodeOrTestFile")
+ function! s:CodeOrTestFile(precmd)
+ let current = expand('%:p')
+ let other = current
+ if current =~ "/src/main/.*/\%(blogs|news\)/"
+ let other = substitute(current, "/main/", "/test/", "")
+ let other = substitute(other, "/blogs/", "/tests/", "")
+ let other = substitute(other, "/news/", "/tests/", "")
+ let other = substitute(other, ".java$", "Test.java", "")
+ elseif current =~ "/src/test/.*/actions/tests/"
+ let other = substitute(current, "/test/", "/main/", "")
+ let other = substitute(other, "/tests/", "/blogs/", "")
+ let other = substitute(other, "Test.java$", ".java", "")
+ elseif current =~ "/src/main/"
+ let other = substitute(current, "/main/", "/test/", "")
+ let other = substitute(other, ".java$", "Test.java", "")
+ elseif current =~ "/src/test/"
+ let other = substitute(current, "/test/", "/main/", "")
+ let other = substitute(other, "Test.java$", ".java", "")
+ endif
+ if &switchbuf =~ "^use"
+ let i = 1
+ let bufnum = winbufnr(i)
+ while bufnum != -1
+ let filename = fnamemodify(bufname(bufnum), ':p')
+ if filename == other
+ execute ":sbuffer " . filename
+ return
+ endif
+ let i += 1
+ let bufnum = winbufnr(i)
+ endwhile
+ endif
+ if other != ''
+ if strlen(a:precmd) != 0
+ execute a:precmd
+ endif
+ execute 'edit ' . fnameescape(other)
+ else
+ echoerr "Alternate has evaluated to nothing."
+ endif
+ endfunction
+endif
+
+com! -buffer JavaSwitchHere :call s:CodeOrTestFile('')
+com! -buffer JavaSwitchRight :call s:CodeOrTestFile('wincmd l')
+com! -buffer JavaSwitchSplitRight :call s:CodeOrTestFile('let b:curspr=&spr | set nospr | vsplit | wincmd l | if b:curspr | set spr | endif | unlet b:curspr')
+com! -buffer JavaSwitchLeft :call s:CodeOrTestFile('wincmd h')
+com! -buffer JavaSwitchSplitLeft :call s:CodeOrTestFile('let b:curspr=&spr | set nospr | vsplit | wincmd h | if b:curspr | set spr | endif | unlet b:curspr')
+com! -buffer JavaSwitchAbove :call s:CodeOrTestFile('wincmd k')
+com! -buffer JavaSwitchSplitAbove :call s:CodeOrTestFile('let b:cursb=&sb | set nosb | split | wincmd k | if b:cursb | set sb | endif | unlet b:cursb')
+com! -buffer JavaSwitchBelow :call s:CodeOrTestFile('wincmd j')
+com! -buffer JavaSwitchSplitBelow :call s:CodeOrTestFile('let b:cursb=&sb | set nosb | split | wincmd j | if b:cursb | set sb | endif | unlet b:cursb')
+
+nmap <buffer> <silent> ,of :JavaSwitchHere<cr>
+nmap <buffer> <silent> ,ol :JavaSwitchRight<cr>
+nmap <buffer> <silent> ,oL :JavaSwitchSplitRight<cr>
+nmap <buffer> <silent> ,oh :JavaSwitchLeft<cr>
+nmap <buffer> <silent> ,oH :JavaSwitchSplitLeft<cr>
+nmap <buffer> <silent> ,ok :JavaSwitchAbove<cr>
+nmap <buffer> <silent> ,oK :JavaSwitchSplitAbove<cr>
+nmap <buffer> <silent> ,oj :JavaSwitchBelow<cr>
+nmap <buffer> <silent> ,oJ :JavaSwitchSplitBelow<cr>
View
1 syntax/pom.vim
@@ -0,0 +1 @@
+runtime! syntax/xml.vim
View
13 vimrc
@@ -281,6 +281,7 @@ nnoremap <C-E> ,
" Alright... let's try this out
imap jj <esc>
+cmap jj <esc>
" I like jj - Let's try something else fun
imap ,fn <c-r>=expand('%:t:r')<cr>
@@ -478,11 +479,17 @@ let g:fuf_splitPathMatching = 0
let g:fuf_maxMenuWidth = 110
let g:fuf_timeFormat = ''
nmap <silent> ,fv :FufFile ~/.vim/<cr>
-nmap <silent> ,fb :FufBuffer<cr>
-nmap <silent> ,ff :FufFile<cr>
nmap <silent> ,fc :FufMruCmd<cr>
nmap <silent> ,fm :FufMruFile<cr>
-nmap <silent> ,fp :FufFile ~/git/*<cr>
+
+"-----------------------------------------------------------------------------
+" CommandT Settings
+"-----------------------------------------------------------------------------
+set wildignore+=*.o,*.class,.git,.svn
+let g:CommandTMatchWindowAtTop = 1
+nmap <silent> ,fb :CommandTBuffer<cr>
+nmap <silent> ,ff :CommandT<cr>
+nmap <silent> ,fp :CommandT ~/primal/platform<cr>
"-----------------------------------------------------------------------------
" Gundo Settings
View
92 xpt-personal/ftplugin/java/java.xpt.vim
@@ -0,0 +1,92 @@
+
+XPTemplate priority=personal
+
+XPTinclude
+ \ _common/personal
+ \ _common/java
+
+XPTvar $BRif ' '
+XPTvar $BRloop ' '
+XPTvar $BRfun ' '
+XPTvar $author 'Derek Wyatt'
+XPTvar $email derek.wyatt@primal.com
+
+let s:f = g:XPTfuncs()
+
+function! s:f.year(...)
+ return strftime("%Y")
+endfunction
+
+function! s:f.getPackageForFile(...)
+ let dir = expand('%:p:h')
+ let regexes = [
+ \ [ '/src/main/java', '/src/main/java' ],
+ \ [ '/src/test/java', '/src/test/java' ]
+ \ ]
+ for e in regexes
+ let idx = match(dir, e[0])
+ if idx != -1
+ let subdir = strpart(dir, idx + strlen(e[1]) + 1)
+ let package = substitute(subdir, '/', '.', 'g')
+ return package
+ endif
+ endfor
+ return ''
+endfunction
+
+function! s:f.classname(...)
+ return expand('%:t:r')
+endfunction
+
+function! s:f.classNameFromSpec(...)
+ return substitute(s:f.classname(), 'Test$', '', '')
+endfunction
+
+function! s:f.getFilenameWithPackage(...)
+ let package = s:f.getPackageForFile()
+ if strlen(package) == 0
+ return expand('%:t:r')
+ else
+ return package . '.' . expand('%:t:r')
+ endif
+endfunction
+
+function! s:f.getPackageLine(...)
+ let package = s:f.getPackageForFile()
+ if strlen(package) == 0
+ return ''
+ else
+ return "package " . package
+ endif
+endfunction
+
+XPT file hint=Standard\ Java\ source\ file
+`getPackageLine()^;
+
+public class `classname()^ {
+ public `classname()^(`$SParg^`ctorParam^`$SParg^)`$BRfun^{
+ `cursor^
+ }
+}
+
+XPT testfile hint=JUnit\ Test
+`getPackageLine()^;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+public class `classname()^ {
+ `cursor^
+}
+
+XPT t hint=Test\ method
+@Test
+public void `testname^() {
+ `cursor^
+}
+
+XPT package hint=package\ for\ this\ file
+`getPackageLine()^;
+
+XPT p hint=System.out.println\(...\)
+System.out.println(`cursor^);
View
122 xpt-personal/ftplugin/pom/pom.xpt.vim
@@ -0,0 +1,122 @@
+
+XPTemplate priority=personal
+
+let s:f = g:XPTfuncs()
+
+XPTinclude
+ \ _common/personal
+ \ _common/common
+ \ _common/xml
+
+fun! s:f.xml_close_tag()
+ let v = self.V()
+ if v[ 0 : 0 ] != '<' || v[ -1:-1 ] != '>'
+ return ''
+ endif
+
+ let v = v[ 1: -2 ]
+
+ if v =~ '\v/\s*$|^!'
+ return ''
+ else
+ return '</' . matchstr( v, '\v^\S+' ) . '>'
+ endif
+endfunction
+
+fun! s:f.xml_cont_helper()
+ let v = self.V()
+ if v =~ '\V\n'
+ return self.ResetIndent( -s:nIndent, "\n" )
+ else
+ return ''
+ endif
+endfunction
+
+let s:nIndent = 0
+fun! s:f.xml_cont_ontype()
+ let v = self.V()
+ if v =~ '\V\n'
+ let v = matchstr( v, '\V\.\*\ze\n' )
+ let s:nIndent = &indentexpr != ''
+ \ ? eval( substitute( &indentexpr, '\Vv:lnum', 'line(".")', '' ) ) - indent( line( "." ) - 1 )
+ \ : self.NIndent()
+
+ return self.Finish( v . "\n" . repeat( ' ', s:nIndent ) )
+ else
+ return v
+ endif
+endfunction
+
+
+XPT __tag hidden " <Tag>..</Tag>
+XSET content|def=Echo( R( 't' ) =~ '\v/\s*$' ? Finish() : '' )
+XSET content|ontype=xml_cont_ontype()
+`<`t`>^^`content^^`content^xml_cont_helper()^`t^xml_close_tag()^
+
+XPT tag alias=__tag
+
+XPT dependency hint=<dependency>...</dependency>
+<dependency>
+ <groupId>`groupId^</groupId>
+ <artifactId>`artifactId^</artifactId>
+ <version>`version^</version>
+</dependency>
+
+XPT new hint=New\ POM\ file
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.primal</groupId>
+ <artifactId>`artifact^</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <name>`name^</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <akka.version>2.0.3</akka.version>` `property...{{^
+ `Include:__tag^` `property...^`}}^
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>primal-thirdparty</id>
+ <url>http://maven.primal.com:8081/nexus/content/repositories/thirdparty/</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.typesafe.akka</groupId>
+ <artifactId>akka-actor</artifactId>
+ <version>${akka.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2.1</version>
+ <configuration>
+ <mainClass>com.primal.Main</mainClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>

0 comments on commit bb62ce2

Please sign in to comment.