Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Many changes in the new job

commit bb62ce2af3b567a67da1e940b4609f91c9c9f5ab 1 parent 7e9c4f1
Derek Wyatt authored
1  .gitignore
@@ -29,6 +29,7 @@ vim-jade
29 29 vim-sbt
30 30 vim-ctrlp
31 31 vim-powerline
  32 +vim-command-t
32 33 *.swp
33 34 .netrwhist
34 35 passwords.vim
1  after/ftdetect/pom.ftdetect.vim
... ... @@ -0,0 +1 @@
  1 +au BufRead,BufNewFile pom.xml set filetype=pom
1  bundle/from_github.md
Source Rendered
@@ -26,3 +26,4 @@
26 26 * **Conque**: `git clone https://github.com/rson/vim-conque.git vim-conque`
27 27 * **Jade**: `git clone https://github.com/vim-scripts/jade.vim.git vim-jade`
28 28 * **SBT**: `git clone https://github.com/derekwyatt/vim-sbt.git vim-sbt`
  29 +* **Command-T**: `git clone https://github.com/wincent/Command-T.git vim-command-t`
146 bundle/vim-netdict/doc/netdict.txt
... ... @@ -0,0 +1,146 @@
  1 +*netdict.txt* Retrieve term definitions from the Internet.
  2 +
  3 + N E T D I C T
  4 +
  5 +1. Introduction |intro|
  6 +2. Settings |settings|
  7 +3. Mappings |mappings|
  8 +4. Commands |commands|
  9 +5. TODO |todo|
  10 +6. Copyright |copyright|
  11 +
  12 +==============================================================================
  13 +1. Introduction *intro*
  14 +
  15 +Netdict is a plugin to retrieve word and other definitions from the Internet
  16 +using the Unix DICT protocol client.
  17 +
  18 +==============================================================================
  19 +2. Settings *settings*
  20 +
  21 +The following global variables are available and may be specified in your
  22 +configuration file via the |:let| command.
  23 +
  24 + *netdict_dictprg*
  25 +Specifies the command to execute dict. The default is 'dict --pager -'.
  26 +
  27 + *netdict_xargs*
  28 +Specifies any extra options to pass to |netdict_dictprg|. See the dict(1)
  29 +manual page for available options. The default is empty.
  30 +
  31 + *netdict_database*
  32 +The default database to search when looking up terms. If empty, the default,
  33 +search all available databases.
  34 +
  35 + *netdict_strategy*
  36 +The default strategy to use when searching a database. If empty, the default,
  37 +use the servers default strategy which is normally 'exact'.
  38 +
  39 + *netdict_expand*
  40 +When selecting terms with any of the cursor lookup or match plugins and this
  41 +option is set to 1, then all words enclosed in '"' or '{}' are used as the
  42 +term in all windows and not just the definition window. Otherwise only the
  43 +word under the cursor (see |<cword>|) is used as the term.
  44 +
  45 + *netdict_extra_history*
  46 +Setting this to zero disables adding words selected with any of the cursor
  47 +lookup or match plugins and |commands| to the input history. The default is 1
  48 +or enabled.
  49 +
  50 +==============================================================================
  51 +3. Mappings *mappings*
  52 +
  53 +The following are the default key mappings. You can easily change them by
  54 +specifying the |{rhs}| of the |:map| command as one of the plugin names in
  55 +your configuration file.
  56 +
  57 + *<Leader>ll*
  58 + *<Plug>NetdictLookup*
  59 +Prompt for input of a term in normal mode. If a term contains spaces or
  60 +special characters it must be enclosed in double quotes to prevent the shell
  61 +from interpreting them. You can select an alternate database and search
  62 +strategy for the term by separating them with spaces. The format for input is:
  63 +
  64 + term [!|*|database [ strategy ]]
  65 +
  66 +A database named '!' returns results from the first matching database only. A
  67 +database named '*' searches all available databases and is usally specified
  68 +when using an alternate search strategy. Otherwise the named database is one
  69 +available from the server. See |<Plug>NetdictShowDB|.
  70 +
  71 +If you are running a version of VIM which was compiled with |+dialog_gui| then
  72 +a new window will be created prompting you for the search term which has the
  73 +same format as above.
  74 +
  75 + *<Leader>lm*
  76 + *<Plug>NetdictMatch*
  77 +Display a list of possible matches for the specified term rather than
  78 +definitions.
  79 +
  80 + *<Leader>ld*
  81 + *<Plug>NetdictShowDB*
  82 +Show a list of searchable databases from the server.
  83 +
  84 + *<Leader>ls*
  85 + *<Plug>NetdictShowStrat*
  86 +Show a list of search strategies from the server.
  87 +
  88 + *<Leader>lcl*
  89 + *<Plug>NetdictCursorLookup*
  90 +Lookup the definition of the word under the cursor (see |netdict_expand|) in
  91 +normal mode without prompting for input. If the word is a hyperlink (enclosed
  92 +in {}) or a term of possible matches from the definition window, then only
  93 +definitions for the term in the associated database will be shown.
  94 +
  95 + *<Leader>lcm*
  96 + *<Plug>NetdictCursorMatch*
  97 +Lookup possible matches for the word under the cursor (see |netdict_expand|)
  98 +in normal mode without prompting for input.
  99 +
  100 + *<C-T>*
  101 +Goto to the previous definition when in the definition window.
  102 +
  103 + *]]* *[[*
  104 +Jump to the next or previous [count] definition or match when in the
  105 +definition window. When jumping between definitions Netdict will try and
  106 +position the match at the top of the window. If this doesn't work then it is
  107 +probably do to |'scrolloff'| being greater than zero.
  108 +
  109 + *}}* *{{*
  110 +Jump to the next or previous [count] hyperlink when in the definition window.
  111 +
  112 +==============================================================================
  113 +4. Commands *commands*
  114 +
  115 + *:Lookup*
  116 +Like |<Plug>NetdictLookup| but without a prompt. If no arguments are given
  117 +then a prompt is displayed just as if |<Plug>NetdictLookup| were used.
  118 +
  119 +Example:
  120 + :Lookup "^somet" web1913 re
  121 +
  122 +would return all words from the Webster's dictionary beginning with 'somet'.
  123 +
  124 + *:Match*
  125 +Like |:Lookup| but behaves like |<Plug>NetdictMatch|.
  126 +
  127 +==============================================================================
  128 +5. TODO *todo*
  129 +
  130 +Below are some things I'd like to see in future versions. If you have any
  131 +other suggestions feel free to let me know or send me some patches.
  132 +
  133 + * multiword terms in (character) visual mode 'v'
  134 + * support multiword terms that span more than one line
  135 + * gui mouse support and syntax highlighting (I dont have a gui yet)
  136 +
  137 +==============================================================================
  138 +6. Copyright *copyright*
  139 +
  140 +Netdict is written by Ben Kibbey <bjk@luxsci.net> and is distributed under the
  141 +terms of the GNU General Public License.
  142 +
  143 +The latest version can be found either at http://arbornet.org/~bjk/vim/ or at
  144 +VIM Online http://www.vim.org/.
  145 +
  146 + vim:tw=78:ts=8:
586 bundle/vim-netdict/plugin/netdict.vim
... ... @@ -0,0 +1,586 @@
  1 +" Vim plugin to look up term definitions using `dict'.
  2 +" Maintainer: Ben Kibbey <bjk@luxsci.net>
  3 +" Last Change: Aug 05, 2006
  4 +" Requirements: VIM 6/7 and a dict protocol client.
  5 +
  6 +if exists("loaded_netdict")
  7 + finish
  8 +endif
  9 +
  10 +let loaded_netdict = 1
  11 +
  12 +if !exists("g:netdict_dictprg")
  13 + let g:netdict_dictprg = "dict --pager -"
  14 +endif
  15 +
  16 +if !exists("g:netdict_strategy")
  17 + let g:netdict_strategy = ""
  18 +endif
  19 +
  20 +if !exists("g:netdict_database")
  21 + let g:netdict_database = ""
  22 +endif
  23 +
  24 +if !exists("g:netdict_xargs")
  25 + let g:netdict_xargs = ""
  26 +endif
  27 +
  28 +if !exists("g:netdict_expand") || g:netdict_expand > 1 || g:netdict_expand < 0
  29 + let g:netdict_expand = 0
  30 +endif
  31 +
  32 +if !exists("g:netdict_extra_history") || g:netdict_extra_history > 1
  33 + \ || g:netdict_extra_history < 0
  34 + let g:netdict_extra_history = 1
  35 +endif
  36 +
  37 +noremap <unique> <script> <Plug>NetdictLookup <SID>NetdictLookup
  38 +noremap <unique> <script> <Plug>NetdictMatch <SID>NetdictMatch
  39 +noremap <unique> <script> <Plug>NetdictCursorLookup <SID>NetdictCursorLookup
  40 +noremap <unique> <script> <Plug>NetdictCursorMatch <SID>NetdictCursorMatch
  41 +noremap <unique> <script> <Plug>NetdictShowDB <SID>NetdictShowDB
  42 +noremap <unique> <script> <Plug>NetdictShowStrat <SID>NetdictShowStrat
  43 +
  44 +
  45 +noremap <SID>NetdictLookup :call <SID>LookupTerm()<CR>
  46 +noremap <SID>NetdictMatch :call <SID>LookupTerm(1)<CR>
  47 +noremap <SID>NetdictCursorLookup :call <SID>GetCursorTerm(0)<CR>
  48 +noremap <SID>NetdictCursorMatch :call <SID>GetCursorTerm(1)<CR>
  49 +noremap <SID>NetdictShowStrat :call <SID>FetchStrategies()<CR>
  50 +noremap <SID>NetdictShowDB :call <SID>FetchDatabases()<CR>
  51 +
  52 +noremenu <script> Plugin.&Netdict.-sep- <nul>
  53 +noremenu <script> <silent> Plugin.Netdict.&Lookup\ Term <SID>NetdictLookup
  54 +noremenu <script> <silent> Plugin.Netdict.L&ookup\ Cursor\ Term <SID>NetdictCursorLookup
  55 +noremenu <script> <silent> Plugin.Netdict.&Match\ Term <SID>NetdictMatch
  56 +noremenu <script> <silent> Plugin.Netdict.M&atch\ Cursor\ Term <SID>NetdictCursorMatch
  57 +noremenu <script> Plugin.Netdict.Available\ &Databases <SID>NetdictShowDB
  58 +noremenu <script> Plugin.Netdict.Available\ &Strategies <SID>NetdictShowStrat
  59 +
  60 +if !hasmapto('<Plug>NetdictLookup')
  61 + nmap <unique> <silent> <Leader>ll <Plug>NetdictLookup
  62 +endif
  63 +
  64 +if !hasmapto('<Plug>NetdictMatch')
  65 + nmap <unique> <silent> <Leader>lm <Plug>NetdictMatch
  66 +endif
  67 +
  68 +if !hasmapto('<Plug>NetdictCursorLookup')
  69 + nmap <unique> <silent> <Leader>lcl <Plug>NetdictCursorLookup
  70 +endif
  71 +
  72 +if !hasmapto('<Plug>NetdictCursorMatch')
  73 + nmap <unique> <silent> <Leader>lcm <Plug>NetdictCursorMatch
  74 +endif
  75 +
  76 +if !hasmapto('<Plug>NetdictShowDB')
  77 + nmap <unique> <silent> <Leader>lD <Plug>NetdictShowDB
  78 +endif
  79 +
  80 +if !hasmapto('<Plug>NetdictShowStrat')
  81 + nmap <unique> <silent> <Leader>ls <Plug>NetdictShowStrat
  82 +endif
  83 +
  84 +if exists(":Lookup") != 2
  85 + comm -nargs=* Lookup call <SID>NetdictCmd(0, <f-args>)
  86 +endif
  87 +
  88 +if exists(":Match") != 2
  89 + comm -nargs=* Match call <SID>NetdictCmd(1, <f-args>)
  90 +endif
  91 +
  92 +let s:netdict_tag_depth = 0
  93 +let s:netdict_last_history = 0
  94 +
  95 +func <SID>GetCursorTerm(match)
  96 + let ft = getwinvar(".", "&filetype")
  97 + let word = expand("<cword>")
  98 +
  99 + if g:netdict_expand == 0 && ft != "netdict"
  100 + if a:match == 1
  101 + call <SID>LookupTerm(word, 1)
  102 + else
  103 + call <SID>LookupTerm(word)
  104 + endif
  105 +
  106 + return
  107 + endif
  108 +
  109 + let line = getline(".")
  110 + let i = col(".") - 1
  111 +
  112 + while i < strlen(line)
  113 + if line[i] == '}' || line[i] == '"'
  114 + let c = line[i]
  115 + let end = i
  116 + break
  117 + endif
  118 +
  119 + let i = i + 1
  120 + endwhile
  121 +
  122 + let i = col(".") - 1
  123 +
  124 + if exists("end")
  125 + while i >= 0
  126 + if line[i] == '{' || line[i] == '"'
  127 + let start = i
  128 + break
  129 + endif
  130 +
  131 + let i = i - 1
  132 + endwhile
  133 + endif
  134 +
  135 + if match(getline(1), '^\p\+: .*$') != -1
  136 + let matchmode = 1
  137 + endif
  138 +
  139 + if exists("start") && exists("end")
  140 + let word = strpart(line, start + 1, (end - start) - 1)
  141 +
  142 + if stridx(word, " ") != -1
  143 + let word = '"'.word.'"'
  144 + endif
  145 +
  146 + if ft == "netdict" && !exists("matchmode") && a:match != 1 && a:0 < 1
  147 + let i = search('^\w.* \(.*\) \[.*\]:\s*$', 'b')
  148 +
  149 + if i > 0
  150 + let db = substitute(getline(i), '.* \[\(.*\)\]:\s*$',
  151 + \ '\1', '')
  152 + endif
  153 + endif
  154 + endif
  155 +
  156 + if exists("matchmode") && a:0 < 1
  157 + let i = line(".")
  158 +
  159 + while i > 0
  160 + if match(getline(i), '^\p\+: .*$') != -1
  161 + let db = substitute(getline(i), '^\(\p\+\): .*$',
  162 + \ '\1', '')
  163 + break
  164 + endif
  165 +
  166 + let i = i - 1
  167 + endwhile
  168 + endif
  169 +
  170 + if exists("db")
  171 + let word = word . " " . db
  172 + endif
  173 +
  174 + if a:match == 1
  175 + call <SID>LookupTerm(word, 1)
  176 + else
  177 + call <SID>LookupTerm(word)
  178 + endif
  179 +
  180 + return
  181 +endfunc
  182 +
  183 +func <SID>NetdictCmd(match, ...)
  184 + if a:0 == 0
  185 + if a:match == 1
  186 + call <SID>LookupTerm(1)
  187 + else
  188 + call <SID>LookupTerm()
  189 + endif
  190 +
  191 + return
  192 + endif
  193 +
  194 + let args = a:1
  195 + let i = 2
  196 +
  197 + while exists("a:" . i)
  198 + let args = args.' '.a:{i}
  199 + let i = i + 1
  200 + endwhile
  201 +
  202 + if a:match == 1
  203 + call <SID>LookupTerm(args, 1)
  204 + else
  205 + call <SID>LookupTerm(args)
  206 + endif
  207 +
  208 + return
  209 +endfunc
  210 +
  211 +func <SID>FetchDatabases()
  212 + call s:Echo("Fetching databases...")
  213 + call <SID>RunDict(1, "--dbs")<CR>
  214 +endfunc
  215 +
  216 +func <SID>FetchStrategies()
  217 + call s:Echo("Fetching strategies...")
  218 + call <SID>RunDict(1, "--strats")
  219 +endfunc
  220 +
  221 +func s:RunDict(...)
  222 + let prog = strpart(g:netdict_dictprg, " ", stridx(g:netdict_dictprg, " "))
  223 +
  224 + if prog == ''
  225 + let prog = g:netdict_dictprg
  226 + endif
  227 +
  228 + if executable(prog) != 1
  229 + if has("gui_running") && has("dialog_gui")
  230 + call confirm("The command \"" . prog . "\" could not be found in your $PATH.")
  231 + return ''
  232 + else
  233 + call s:Echo("The command \"" . prog . "\" could not be found in your $PATH.")
  234 + return ''
  235 + endif
  236 + endif
  237 +
  238 + let s:tmpfile = tempname()
  239 + let args = g:netdict_dictprg . " " . g:netdict_xargs . " "
  240 + let i = 2
  241 +
  242 + while exists("a:" . i)
  243 + let args = args . a:{i}
  244 + let i = i + 1
  245 + endwhile
  246 +
  247 + let args = args . " | tee " . s:tmpfile . ";"
  248 + let result = system(args)
  249 +
  250 + if v:shell_error
  251 + call s:Echo("Problem while executing \"" . args . "\"")
  252 + return
  253 + endif
  254 +
  255 + if a:1
  256 + echo result
  257 + return
  258 + endif
  259 +
  260 + return result
  261 +endfunc
  262 +
  263 +func s:ParseTerm(term)
  264 + let word = a:term
  265 + let word = substitute(word, '^[ ]*', "", "")
  266 + let pos = strridx(word, '"')
  267 +
  268 + if pos != -1
  269 + let more = strpart(word, pos + 1)
  270 + let word = strpart(word, 0, pos + 1)
  271 + else
  272 + if word =~ '^\S* .*$'
  273 + let pos = stridx(word, " ")
  274 + let more = strpart(word, pos + 1)
  275 + let word = strpart(word, 0, pos + 1)
  276 + endif
  277 + endif
  278 +
  279 + if exists("more")
  280 + let more = substitute(more, '^\s*', '', '')
  281 +
  282 + if more =~ '^.* .*$'
  283 + let pos = stridx(more, " ")
  284 + let s:db = substitute(strpart(more, 0, pos), '[ ]', '', '')
  285 + let s:strat = substitute(strpart(more, pos + 1), '[ ]', '', '')
  286 + else
  287 + if more != ''
  288 + let s:db = substitute(more, '[ ]', '', '')
  289 + endif
  290 + endif
  291 + endif
  292 +
  293 + let word = escape(word, "`{}[]")
  294 + return word
  295 +endfunc
  296 +
  297 +func <SID>LookupTerm(...)
  298 + let s:db = g:netdict_database
  299 + let s:strat = g:netdict_strategy
  300 + let match = ""
  301 +
  302 + if a:0 == 0 || a:1 == 1
  303 + if exists("a:1")
  304 + let match = " -m "
  305 + let type = "Match "
  306 + else
  307 + let type = "Lookup "
  308 + endif
  309 +
  310 + if has("gui_running") && has("dialog_gui")
  311 + 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) : ''))
  312 + else
  313 + let word = input(type . "(<term> [!|*|db [strategy]]): ")
  314 + endif
  315 +
  316 + if word =~ '^\s*$'
  317 + return
  318 + endif
  319 +
  320 + let word = s:ParseTerm(word)
  321 + else
  322 + if exists("a:2")
  323 + let match = " -m "
  324 + endif
  325 +
  326 + if a:1 =~ '^\s*$'
  327 + return
  328 + endif
  329 +
  330 + let word = s:ParseTerm(a:1)
  331 + endif
  332 +
  333 + let word = substitute(word, '[[:space:]]*$', '', '')
  334 +
  335 + if g:netdict_extra_history == 1
  336 + call histadd("input", word.(s:db != '' ? ' '.s:db : ''). (s:strat != '' ? ' '.s:strat : ''))
  337 +
  338 + let s:netdict_last_history = histnr("input")
  339 + endif
  340 +
  341 + call s:Echo("Looking up " . (word[0] == '"' ? "" : '"') . word . (word[0] == '"' ? "" : '"') . (s:db != '' ? " in ".s:db : '') . ' ...')
  342 +
  343 + if s:db != ''
  344 + let s:db = " --database " . escape(s:db, "'!#*$")
  345 + endif
  346 +
  347 + if s:strat != ''
  348 + let s:strat = " --strategy " . s:strat
  349 + endif
  350 +
  351 + let def = <SID>RunDict(0, s:db, s:strat." ", match, escape(word, "'!#$"))
  352 +
  353 + if def == ''
  354 + return
  355 + endif
  356 +
  357 + if def =~ '^No \(matches\|definitions\) found for \%["]'.word.'\%["].$'
  358 + call s:Echo(def)
  359 + return
  360 + endif
  361 +
  362 + if match(def, '.*, use -[DS] for a list.*') != -1
  363 + let tmp = substitute(def, '\(.* is not a valid .*\),.*', '\1', '')
  364 +
  365 + if tmp =~ '^No .*'
  366 + let tmp = substitute(tmp, '.*".\(.*\)$', '\1', '')
  367 + endif
  368 +
  369 + call s:Echo(tmp)
  370 + return
  371 + endif
  372 +
  373 + let results = <SID>Dumpdef(word, s:tmpfile)
  374 +
  375 + if match(results, '^[0] ') != -1
  376 + call s:Echo("")
  377 + return
  378 + endif
  379 +
  380 + call s:Echo(substitute(results, '\%["]"\([^"]*\)"\%["]', '"\1"', 'g'))
  381 + return
  382 +endfunc
  383 +
  384 +func s:Dumpdef(word, tmpfile)
  385 + " this is borrowed from man.vim
  386 + exec "let s:netdict_tag_buf_".s:netdict_tag_depth." = ".bufnr("%")
  387 + exec "let s:netdict_tag_lin_".s:netdict_tag_depth." = ".line(".")
  388 + exec "let s:netdict_tag_col_".s:netdict_tag_depth." = ".col(".")
  389 +
  390 + let s:netdict_tag_depth = s:netdict_tag_depth + 1
  391 +
  392 + if &filetype != "netdict"
  393 + let thiswin = winnr()
  394 +
  395 + exec "norm! \<C-W>b"
  396 +
  397 + if winnr() == 1
  398 + new
  399 + else
  400 + exec "norm! " . thiswin . "\<C-W>w"
  401 +
  402 + while 1
  403 + if &filetype == "netdict"
  404 + break
  405 + endif
  406 +
  407 + exec "norm! \<C-W>w"
  408 +
  409 + if thiswin == winnr()
  410 + new
  411 + break
  412 + endif
  413 + endwhile
  414 + endif
  415 + endif
  416 +
  417 + sil exec "edit " . a:tmpfile
  418 + setl modifiable
  419 + sil exec "norm 1GdG"
  420 + sil exec "read " . a:tmpfile
  421 +
  422 + let results = <SID>ParseWin(a:word)
  423 +
  424 + setl filetype=netdict nomodified
  425 + setl bufhidden=hide
  426 + setl nobuflisted
  427 +
  428 + nnoremap <buffer> <C-t> :call <SID>PopDef()<CR>
  429 +
  430 + if match(getline(1), '^\p\+: .*$') != -1
  431 + nnoremap <buffer> <silent> ]] :<C-U>call
  432 + \ <SID>Search('\(\p\+[-:"]\)\@!\w\+', 0, 1)<CR>
  433 + nnoremap <buffer> <silent> [[ :<C-U>call
  434 + \ <SID>Search('\(\p\+[-:"]\)\@!\w\+', 1, 1)<CR>
  435 + 1
  436 + sil exec 'norm ]]'
  437 + else
  438 + nnoremap <buffer> <silent> ]] :call <SID>Search('^[=]\+\n^\p.*:\s*$', 0)<CR>
  439 + nnoremap <buffer> <silent> [[ :call <SID>Search('^[=]\+\n^\p.*:\s*$', 1)<CR>
  440 + nnoremap <buffer> <silent> }} :call <SID>Search('{[^}]\+}', 0, 1)<CR>
  441 + nnoremap <buffer> <silent> {{ :call <SID>Search('{[^}]\+}', 1, 1)<CR>
  442 + 1
  443 + endif
  444 +
  445 + return results
  446 +endfunc
  447 +
  448 +func s:ParseWin(word)
  449 + let results = ""
  450 + let result = 0
  451 +
  452 + while getline(1) =~ "^\s*$"
  453 + sil exec "norm 1Gdd"
  454 + endwhile
  455 +
  456 + if getline(1) =~ '^\d\+\sdefinition\%[s]\sfound$'
  457 + sil exec "norm 1G2dd"
  458 + elseif getline(1) =~ '^\d\+\smatch\%[e]\%[s]\sfound$'
  459 + let result = substitute(getline(1), '^\(\d*\).*', '\1', '')
  460 + sil exec "norm 1Gdd"
  461 + elseif getline(1) =~ '^No .*, perhaps you mean:$'
  462 + let result = "Alternate"
  463 + sil exec "norm 1Gdd"
  464 + endif
  465 +
  466 + call cursor(1, 1)
  467 +
  468 + if getline(1) =~ '^\w\+: .*$'
  469 +" sil exec ':%s/ / /g'
  470 + else
  471 + let total = 0
  472 + let save_pos = getpos(".")
  473 +
  474 + while 1
  475 + " The 'c' flag is needed to match the first line.
  476 + let i = search('^From .* \(.*\)[ ]*\[.*\]:$', "Wc")
  477 +
  478 + if i == 0
  479 + break
  480 + else
  481 + let total = total + 1
  482 + " Without the following two lines the loop would never end
  483 + " ('c' flag from above).
  484 + let pos = [0, i + 1, 0, 0]
  485 + call setpos('.', pos)
  486 + endif
  487 + endwhile
  488 +
  489 + call setpos('.', save_pos)
  490 +
  491 + while 1
  492 + let i = search('^From .* \(.*\)[ ]*\[.*\]:$', "Wc")
  493 +
  494 + if i == 0
  495 + break
  496 + endif
  497 +
  498 + let tmp = substitute(getline(i), "^From \\(.*\\)", "\\1", "")
  499 + let @z = "="
  500 + let n = getwinvar(".", "&textwidth")
  501 +
  502 + if n < strlen(tmp)
  503 + let n = strlen(tmp)
  504 + else
  505 + while strlen(tmp) < n
  506 + let tmp = tmp.' '
  507 + endwhile
  508 + endif
  509 +
  510 + call setline(i, "")
  511 + sil exec 'norm ' . n . '"zp'
  512 + sil exec ':put =tmp'
  513 + call cursor(i + 2, 0)
  514 + sil exec 'norm ' . n . '"zp'
  515 +
  516 + let result = result + 1
  517 + let @z = '['.result.' of '.total.']='
  518 +
  519 + call cursor(i + 2, n - strlen(@z))
  520 + sil exec 'norm '.strlen(@z).'x"zp'
  521 + endwhile
  522 + endif
  523 +
  524 + return result." ".(result != 1 ? "results" : "result").
  525 + \' for "'.a:word.'"'
  526 +endfunc
  527 +
  528 +func s:Search(pattern, dir, ...)
  529 + if getline(1) =~ '^\w\+: .*$'
  530 + let cnt = v:count1
  531 + else
  532 + let cnt = (v:count1 > 1 && a:dir == 1 ? v:count1 + 1 : v:count1)
  533 + endif
  534 +
  535 + while cnt > 0
  536 + let i = search(a:pattern, (a:dir == 1 ? 'b' : ''))
  537 +
  538 + if i == 0
  539 + return
  540 + endif
  541 +
  542 + let cnt = cnt - 1
  543 + endwhile
  544 +
  545 + if a:0 == 0
  546 + sil exe 'norm L'.winline().'j'.i.'G'
  547 + endif
  548 +
  549 + return
  550 +endfunc
  551 +
  552 +func! <SID>PopDef()
  553 + if s:netdict_tag_depth > 1
  554 + let s:netdict_tag_depth = s:netdict_tag_depth - 1
  555 +
  556 + exec "let s:netdict_tag_buf=s:netdict_tag_buf_".s:netdict_tag_depth
  557 + exec "let s:netdict_tag_lin=s:netdict_tag_lin_".s:netdict_tag_depth
  558 + exec "let s:netdict_tag_col=s:netdict_tag_col_".s:netdict_tag_depth
  559 + exec s:netdict_tag_buf."b"
  560 + exec s:netdict_tag_lin
  561 + exec "norm ".s:netdict_tag_col."|"
  562 + exec "unlet s:netdict_tag_buf_".s:netdict_tag_depth
  563 + exec "unlet s:netdict_tag_lin_".s:netdict_tag_depth
  564 + exec "unlet s:netdict_tag_col_".s:netdict_tag_depth
  565 +
  566 + unlet s:netdict_tag_buf s:netdict_tag_lin s:netdict_tag_col
  567 + else
  568 + call s:Echo("No previous term")
  569 + endif
  570 +
  571 + return
  572 +endfunc
  573 +
  574 +" an old message isnt cleared for me (maybe my TERM) so i pad the message with
  575 +" spaces
  576 +func s:Echo(str)
  577 + let line = substitute(a:str, '[[:space:]]*$', '', '')
  578 + let n = getwinvar(".", "&columns")
  579 +
  580 + while strlen(line) < n - 1
  581 + let line = line.' '
  582 + endwhile
  583 +
  584 + echohl Normal | echon "\r" . line | echohl None
  585 + return
  586 +endfunc
62 bundle/vim-netdict/syntax/netdict.vim
... ... @@ -0,0 +1,62 @@
  1 +" Vim syntax file
  2 +" Language: Netdict plugin
  3 +" Maintainer: Ben Kibbey <bjk@luxsci.net>
  4 +
  5 +" For version 6.x: Quit when a syntax file was already loaded
  6 +if version < 600
  7 + syntax clear
  8 +elseif exists("b:current_syntax")
  9 + finish
  10 +endif
  11 +
  12 +syn case ignore
  13 +
  14 +syn keyword netdictRef syn ant
  15 +syn match netdictFOLDOC /\s\+<\([a-z ,]\+\)>\s/
  16 +syn match netdictSeparator /^[=]\+$/
  17 +syn match netdictDBName /\[\p\+\]/hs=s+1,he=e-1 contained
  18 +syn match netdictDatabase /^\p.*\[.*\]:\s*/ contains=netdictDBName
  19 +syn match netdictDefinitionN /[.]*\d\+[:.]/he=e-1
  20 +syn match netdictMatchN /[.]*\[\d\+ of \d\+\]/ contained
  21 +syn match netdictSeparator /^[=]\+\[\d\+ of \d\+\][=]$/ contains=netdictMatchN
  22 +syn match netdictTermUsage /\s\+(\l) /
  23 +syn match netdictMatchDB /^\p\+: /he=e-3
  24 +syn match netdictHyperLink /{[^}]*}/
  25 +syn region netdictType start=/\[/ end=/\]/ contains=netdictHyperLink,netdictRef
  26 +
  27 +if version >= 508 || !exists("did_c_syn_inits")
  28 + if version < 508
  29 + let did_c_syn_inits = 1
  30 + command -nargs=+ HiLink hi link <args>
  31 + else
  32 + command -nargs=+ HiLink hi def link <args>
  33 + endif
  34 +
  35 + hi nSeparator term=bold cterm=bold ctermfg=5 guifg=DarkGray
  36 + hi nDBTitle term=bold cterm=NONE ctermfg=7 ctermbg=4 guifg=Darkred
  37 + hi nDBName term=bold cterm=bold ctermfg=3 ctermbg=4 guifg=Orange
  38 + hi nMatchDBName term=bold cterm=NONE ctermfg=3 guifg=Orange
  39 + hi nHyperLink term=bold cterm=standout ctermfg=6 guibg=black guifg=goldenrod
  40 + hi nDefinitionN term=reverse cterm=reverse ctermfg=2 guifg=darkgreen
  41 + hi nMatchN term=reverse cterm=NONE ctermfg=1 guifg=darkgreen
  42 + hi nFOLDOC term=NONE cterm=NONE ctermfg=5
  43 + hi nReference term=underline cterm=NONE ctermfg=5
  44 + hi nType term=underline cterm=NONE ctermfg=3
  45 + hi nUsage term=bold cterm=NONE ctermfg=3
  46 +
  47 + HiLink netdictSeparator nSeparator
  48 + HiLink netdictDBName nDBName
  49 + HiLink netdictDatabase nDBTitle
  50 + HiLink netdictHyperLink nHyperLink
  51 + HiLink netdictDefinitionN nDefinitionN
  52 + HiLink netdictMatchN nMatchN
  53 + HiLink netdictFOLDOC nFOLDOC
  54 + HiLink netdictRef nReference
  55 + HiLink netdictType nType
  56 + HiLink netdictMatchDB nMatchDBName
  57 + HiLink netdictTermUsage nUsage
  58 +
  59 + delcommand HiLink
  60 +endif
  61 +
  62 +let b:current_syntax = "netdict"
70 ftplugin/java.vim
... ... @@ -0,0 +1,70 @@
  1 +setlocal formatoptions=crq
  2 +setlocal textwidth=80
  3 +setlocal foldmethod=marker
  4 +setlocal foldmarker=//{,//}
  5 +setlocal foldlevel=0
  6 +setlocal sw=4
  7 +
  8 +if !exists("*s:CodeOrTestFile")
  9 + function! s:CodeOrTestFile(precmd)
  10 + let current = expand('%:p')
  11 + let other = current
  12 + if current =~ "/src/main/.*/\%(blogs|news\)/"
  13 + let other = substitute(current, "/main/", "/test/", "")
  14 + let other = substitute(other, "/blogs/", "/tests/", "")
  15 + let other = substitute(other, "/news/", "/tests/", "")
  16 + let other = substitute(other, ".java$", "Test.java", "")
  17 + elseif current =~ "/src/test/.*/actions/tests/"
  18 + let other = substitute(current, "/test/", "/main/", "")
  19 + let other = substitute(other, "/tests/", "/blogs/", "")
  20 + let other = substitute(other, "Test.java$", ".java", "")
  21 + elseif current =~ "/src/main/"
  22 + let other = substitute(current, "/main/", "/test/", "")
  23 + let other = substitute(other, ".java$", "Test.java", "")
  24 + elseif current =~ "/src/test/"
  25 + let other = substitute(current, "/test/", "/main/", "")
  26 + let other = substitute(other, "Test.java$", ".java", "")
  27 + endif
  28 + if &switchbuf =~ "^use"
  29 + let i = 1
  30 + let bufnum = winbufnr(i)
  31 + while bufnum != -1
  32 + let filename = fnamemodify(bufname(bufnum), ':p')
  33 + if filename == other
  34 + execute ":sbuffer " . filename
  35 + return
  36 + endif
  37 + let i += 1
  38 + let bufnum = winbufnr(i)
  39 + endwhile
  40 + endif
  41 + if other != ''
  42 + if strlen(a:precmd) != 0
  43 + execute a:precmd
  44 + endif
  45 + execute 'edit ' . fnameescape(other)
  46 + else
  47 + echoerr "Alternate has evaluated to nothing."
  48 + endif
  49 + endfunction
  50 +endif
  51 +
  52 +com! -buffer JavaSwitchHere :call s:CodeOrTestFile('')
  53 +com! -buffer JavaSwitchRight :call s:CodeOrTestFile('wincmd l')
  54 +com! -buffer JavaSwitchSplitRight :call s:CodeOrTestFile('let b:curspr=&spr | set nospr | vsplit | wincmd l | if b:curspr | set spr | endif | unlet b:curspr')
  55 +com! -buffer JavaSwitchLeft :call s:CodeOrTestFile('wincmd h')
  56 +com! -buffer JavaSwitchSplitLeft :call s:CodeOrTestFile('let b:curspr=&spr | set nospr | vsplit | wincmd h | if b:curspr | set spr | endif | unlet b:curspr')
  57 +com! -buffer JavaSwitchAbove :call s:CodeOrTestFile('wincmd k')
  58 +com! -buffer JavaSwitchSplitAbove :call s:CodeOrTestFile('let b:cursb=&sb | set nosb | split | wincmd k | if b:cursb | set sb | endif | unlet b:cursb')
  59 +com! -buffer JavaSwitchBelow :call s:CodeOrTestFile('wincmd j')
  60 +com! -buffer JavaSwitchSplitBelow :call s:CodeOrTestFile('let b:cursb=&sb | set nosb | split | wincmd j | if b:cursb | set sb | endif | unlet b:cursb')
  61 +
  62 +nmap <buffer> <silent> ,of :JavaSwitchHere<cr>
  63 +nmap <buffer> <silent> ,ol :JavaSwitchRight<cr>
  64 +nmap <buffer> <silent> ,oL :JavaSwitchSplitRight<cr>
  65 +nmap <buffer> <silent> ,oh :JavaSwitchLeft<cr>
  66 +nmap <buffer> <silent> ,oH :JavaSwitchSplitLeft<cr>
  67 +nmap <buffer> <silent> ,ok :JavaSwitchAbove<cr>
  68 +nmap <buffer> <silent> ,oK :JavaSwitchSplitAbove<cr>
  69 +nmap <buffer> <silent> ,oj :JavaSwitchBelow<cr>
  70 +nmap <buffer> <silent> ,oJ :JavaSwitchSplitBelow<cr>
1  syntax/pom.vim
... ... @@ -0,0 +1 @@
  1 +runtime! syntax/xml.vim
13 vimrc
@@ -281,6 +281,7 @@ nnoremap <C-E> ,
281 281
282 282 " Alright... let's try this out
283 283 imap jj <esc>
  284 +cmap jj <esc>
284 285
285 286 " I like jj - Let's try something else fun
286 287 imap ,fn <c-r>=expand('%:t:r')<cr>
@@ -478,11 +479,17 @@ let g:fuf_splitPathMatching = 0
478 479 let g:fuf_maxMenuWidth = 110
479 480 let g:fuf_timeFormat = ''
480 481 nmap <silent> ,fv :FufFile ~/.vim/<cr>
481   -nmap <silent> ,fb :FufBuffer<cr>
482   -nmap <silent> ,ff :FufFile<cr>
483 482 nmap <silent> ,fc :FufMruCmd<cr>
484 483 nmap <silent> ,fm :FufMruFile<cr>
485   -nmap <silent> ,fp :FufFile ~/git/*<cr>
  484 +
  485 +"-----------------------------------------------------------------------------
  486 +" CommandT Settings
  487 +"-----------------------------------------------------------------------------
  488 +set wildignore+=*.o,*.class,.git,.svn
  489 +let g:CommandTMatchWindowAtTop = 1
  490 +nmap <silent> ,fb :CommandTBuffer<cr>
  491 +nmap <silent> ,ff :CommandT<cr>
  492 +nmap <silent> ,fp :CommandT ~/primal/platform<cr>
486 493
487 494 "-----------------------------------------------------------------------------
488 495 " Gundo Settings
92 xpt-personal/ftplugin/java/java.xpt.vim
... ... @@ -0,0 +1,92 @@
  1 +
  2 +XPTemplate priority=personal
  3 +
  4 +XPTinclude
  5 + \ _common/personal
  6 + \ _common/java
  7 +
  8 +XPTvar $BRif ' '
  9 +XPTvar $BRloop ' '
  10 +XPTvar $BRfun ' '
  11 +XPTvar $author 'Derek Wyatt'
  12 +XPTvar $email derek.wyatt@primal.com
  13 +
  14 +let s:f = g:XPTfuncs()
  15 +
  16 +function! s:f.year(...)
  17 + return strftime("%Y")
  18 +endfunction
  19 +
  20 +function! s:f.getPackageForFile(...)
  21 + let dir = expand('%:p:h')
  22 + let regexes = [
  23 + \ [ '/src/main/java', '/src/main/java' ],
  24 + \ [ '/src/test/java', '/src/test/java' ]
  25 + \ ]
  26 + for e in regexes
  27 + let idx = match(dir, e[0])
  28 + if idx != -1
  29 + let subdir = strpart(dir, idx + strlen(e[1]) + 1)
  30 + let package = substitute(subdir, '/', '.', 'g')
  31 + return package
  32 + endif
  33 + endfor
  34 + return ''
  35 +endfunction
  36 +
  37 +function! s:f.classname(...)
  38 + return expand('%:t:r')
  39 +endfunction
  40 +
  41 +function! s:f.classNameFromSpec(...)
  42 + return substitute(s:f.classname(), 'Test$', '', '')
  43 +endfunction
  44 +
  45 +function! s:f.getFilenameWithPackage(...)
  46 + let package = s:f.getPackageForFile()
  47 + if strlen(package) == 0
  48 + return expand('%:t:r')
  49 + else
  50 + return package . '.' . expand('%:t:r')
  51 + endif
  52 +endfunction
  53 +
  54 +function! s:f.getPackageLine(...)
  55 + let package = s:f.getPackageForFile()
  56 + if strlen(package) == 0
  57 + return ''
  58 + else
  59 + return "package " . package
  60 + endif
  61 +endfunction
  62 +
  63 +XPT file hint=Standard\ Java\ source\ file
  64 +`getPackageLine()^;
  65 +
  66 +public class `classname()^ {
  67 + public `classname()^(`$SParg^`ctorParam^`$SParg^)`$BRfun^{
  68 + `cursor^
  69 + }
  70 +}
  71 +
  72 +XPT testfile hint=JUnit\ Test
  73 +`getPackageLine()^;
  74 +
  75 +import static org.junit.Assert.*;
  76 +import org.junit.Test;
  77 +
  78 +public class `classname()^ {
  79 + `cursor^
  80 +}
  81 +
  82 +XPT t hint=Test\ method
  83 +@Test
  84 +public void `testname^() {
  85 + `cursor^
  86 +}
  87 +
  88 +XPT package hint=package\ for\ this\ file
  89 +`getPackageLine()^;
  90 +
  91 +XPT p hint=System.out.println\(...\)
  92 +System.out.println(`cursor^);
122 xpt-personal/ftplugin/pom/pom.xpt.vim
... ... @@ -0,0 +1,122 @@
  1 +
  2 +XPTemplate priority=personal
  3 +
  4 +let s:f = g:XPTfuncs()
  5 +
  6 +XPTinclude
  7 + \ _common/personal
  8 + \ _common/common
  9 + \ _common/xml
  10 +
  11 +fun! s:f.xml_close_tag()
  12 + let v = self.V()
  13 + if v[ 0 : 0 ] != '<' || v[ -1:-1 ] != '>'
  14 + return ''
  15 + endif
  16 +
  17 + let v = v[ 1: -2 ]
  18 +
  19 + if v =~ '\v/\s*$|^!'
  20 + return ''
  21 + else
  22 + return '</' . matchstr( v, '\v^\S+' ) . '>'
  23 + endif
  24 +endfunction
  25 +
  26 +fun! s:f.xml_cont_helper()
  27 + let v = self.V()
  28 + if v =~ '\V\n'
  29 + return self.ResetIndent( -s:nIndent, "\n" )
  30 + else
  31 + return ''
  32 + endif
  33 +endfunction
  34 +
  35 +let s:nIndent = 0
  36 +fun! s:f.xml_cont_ontype()
  37 + let v = self.V()
  38 + if v =~ '\V\n'
  39 + let v = matchstr( v, '\V\.\*\ze\n' )
  40 + let s:nIndent = &indentexpr != ''
  41 + \ ? eval( substitute( &indentexpr, '\Vv:lnum', 'line(".")', '' ) ) - indent( line( "." ) - 1 )
  42 + \ : self.NIndent()
  43 +
  44 + return self.Finish( v . "\n" . repeat( ' ', s:nIndent ) )
  45 + else
  46 + return v
  47 + endif
  48 +endfunction
  49 +
  50 +
  51 +XPT __tag hidden " <Tag>..</Tag>
  52 +XSET content|def=Echo( R( 't' ) =~ '\v/\s*$' ? Finish() : '' )
  53 +XSET content|ontype=xml_cont_ontype()
  54 +`<`t`>^^`content^^`content^xml_cont_helper()^`t^xml_close_tag()^
  55 +
  56 +XPT tag alias=__tag
  57 +
  58 +XPT dependency hint=<dependency>...</dependency>
  59 +<dependency>
  60 + <groupId>`groupId^</groupId>
  61 + <artifactId>`artifactId^</artifactId>
  62 + <version>`version^</version>
  63 +</dependency>
  64 +
  65 +XPT new hint=New\ POM\ file
  66 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  67 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  68 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
  69 + http://maven.apache.org/xsd/maven-4.0.0.xsd">
  70 + <modelVersion>4.0.0</modelVersion>
  71 +
  72 + <groupId>com.primal</groupId>
  73 + <artifactId>`artifact^</artifactId>
  74 + <version>0.1-SNAPSHOT</version>
  75 + <name>`name^</name>
  76 +
  77 + <properties>
  78 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  79 + <akka.version>2.0.3</akka.version>` `property...{{^
  80 + `Include:__tag^` `property...^`}}^
  81 + </properties>
  82 +
  83 + <repositories>
  84 + <repository>
  85 + <id>primal-thirdparty</id>
  86 + <url>http://maven.primal.com:8081/nexus/content/repositories/thirdparty/</url>
  87 + </repository>
  88 + </repositories>
  89 +
  90 + <dependencies>
  91 + <dependency>
  92 + <groupId>com.typesafe.akka</groupId>
  93 + <artifactId>akka-actor</artifactId>
  94 + <version>${akka.version}</version>
  95 + </dependency>
  96 + </dependencies>
  97 +
  98 + <build>
  99 + <plugins>
  100 + <plugin>
  101 + <groupId>org.codehaus.mojo</groupId>
  102 + <artifactId>exec-maven-plugin</artifactId>
  103 + <version>1.2.1</version>
  104 + <configuration>
  105 + <mainClass>com.primal.Main</mainClass>
  106 + </configuration>
  107 + </plugin>
  108 + </plugins>
  109 + <pluginManagement>
  110 + <plugins>
  111 + <plugin>
  112 + <groupId>org.apache.maven.plugins</groupId>
  113 + <artifactId>maven-compiler-plugin</artifactId>
  114 + <configuration>
  115 + <source>1.5</source>
  116 + <target>1.5</target>
  117 + </configuration>
  118 + </plugin>
  119 + </plugins>
  120 + </pluginManagement>
  121 + </build>
  122 +</project>

0 comments on commit bb62ce2

Please sign in to comment.
Something went wrong with that request. Please try again.