├── .gitignore ├── README.md ├── after ├── colors │ └── solarized.vim ├── ftdetect │ └── pom.ftdetect.vim ├── ftplugin │ ├── cpp.vim │ ├── help.vim │ ├── json.vim │ ├── tex.vim │ └── wiki.vim ├── plugin │ ├── solarized.vim │ └── tabular_extra.vim └── syntax │ ├── cpp │ └── stl.vim │ └── help.vim ├── autoload ├── plug.vim └── plug.vim.old ├── bin └── maketags ├── colors ├── lakesidelight.vim ├── navajo-night.vim ├── tolerable.vim └── xoria256.vim ├── data └── vimside │ ├── .gitignore │ ├── ensime_config.vim │ └── options_user.vim ├── ftdetect ├── gradle.vim └── tex.vim ├── ftplugin ├── cpp.vim ├── java.vim ├── markdown.vim ├── ruby.vim ├── scala.vim └── tex.vim ├── spell ├── en.utf-8.add └── en.utf-8.add.spl ├── syntax ├── pom.vim └── wiki.vim ├── thesaurus └── thesaurus-en-short.txt ├── vimrc └── xpt-personal └── ftplugin ├── _common ├── personal.xpt.vim └── personal_example.xpt.vim ├── cpp └── cpp.xpt.vim ├── dot └── dot.xpt.vim ├── java └── java.xpt.vim ├── mail └── mail.xpt.vim ├── pom └── pom.xpt.vim ├── sbt └── sbt.xpt.vim ├── scala └── scala.xpt.vim ├── sh └── sh.xpt.vim ├── tex └── tex.xpt.vim ├── viki └── viki.xpt.vim └── xsd └── xsd.xpt.vim /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | .netrwhist 3 | passwords.vim 4 | tags 5 | plugged/ 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Derek Wyatt's Vim Configuration 2 | 3 | Yup... it's a vim configuration. 4 | 5 | To install it, do the following: 6 | 7 | * Wipe out your `~/.vimrc` file and `~/.vim` directory (back up if you wish) 8 | * `git clone https://github.com/derekwyatt/vim-config.git ~/.vim` 9 | * `ln ~/.vim/vimrc ~/.vimrc` 10 | * I use [Vundle](https://github.com/gmarik/Vundle.vim), so you'll have to install that into `~/.vim/bundle/Vundle.vim`. You will probably also have to run `:VundleInstall` when you start up Vim as well. 11 | * Start Vim 12 | 13 | Occassionally plugins will get updates, and you should use the `:VundleUpdate` command to get those updates. 14 | -------------------------------------------------------------------------------- /after/colors/solarized.vim: -------------------------------------------------------------------------------- 1 | hi Cursor guibg=#cc00cc guifg=black 2 | -------------------------------------------------------------------------------- /after/ftdetect/pom.ftdetect.vim: -------------------------------------------------------------------------------- 1 | au BufRead,BufNewFile pom.xml set filetype=pom 2 | -------------------------------------------------------------------------------- /after/ftplugin/cpp.vim: -------------------------------------------------------------------------------- 1 | " 2 | " C++ Filetype Plugin 3 | " Derek Wyatt (derek [my first name][mylastname] org) 4 | " http://derekwyatt.org 5 | " 6 | 7 | " We want to keep comments within an 80 column limit, but not code. 8 | " These two options give us that 9 | setlocal formatoptions=crq 10 | setlocal textwidth=80 11 | 12 | " This makes doxygen comments work the same as regular comments 13 | setlocal comments-=:// 14 | setlocal comments+=:///,:// 15 | 16 | " Indents are 4 spaces 17 | setlocal shiftwidth=4 18 | setlocal tabstop=4 19 | setlocal softtabstop=4 20 | 21 | " And they really are spaces, *not* tabs 22 | setlocal expandtab 23 | 24 | " Setup for indending 25 | setlocal nosmartindent 26 | setlocal autoindent 27 | setlocal cinkeys-=0# 28 | setlocal cinoptions+=^ 29 | setlocal cinoptions+=g0 30 | setlocal cinoptions+=:0 31 | setlocal cinoptions+=(0 32 | 33 | " Highlight strings inside C comments 34 | let c_comment_strings=1 35 | 36 | " Load up the doxygen syntax 37 | let g:load_doxygen_syntax=1 38 | 39 | " 40 | " AddCPPUnitTestMacros() 41 | " 42 | " This function ensures that the CPPUNIT_TEST() entries in the header of the 43 | " C++ test class remain up to date with the tests that are actually defined 44 | " in the test class itself. 45 | " 46 | " class MyTests : public CppUnit::TestCase 47 | " { 48 | " CPPUNIT_TEST_SUITE(MyTests); 49 | " CPPUNIT_TEST(testOne); 50 | " CPPUNIT_TEST(testTwo); 51 | " // testThree() will go here when this function is called 52 | " CPPUNIT_TEST_SUITE_END(); 53 | " public: 54 | " void testOne() 55 | " { 56 | " // Test code goes here 57 | " } 58 | " 59 | " void testTwo() 60 | " { 61 | " // Test code goes here 62 | " } 63 | " 64 | " void testThree() 65 | " { 66 | " // Test code goes here 67 | " } 68 | " 69 | " }; 70 | " 71 | " It works off of a convention that test functions look like this: 72 | " 73 | " ^\s\+void test.* 74 | " 75 | " If you have a different convention you'll need to modify this code. 76 | " 77 | function! AddCPPUnitTestMacros() 78 | if s:modifyCPPUnitHeader == 0 79 | return 80 | endif 81 | let suitestart = search("CPPUNIT_TEST_SUITE(", 'nw') 82 | if suitestart == 0 83 | return 84 | endif 85 | execute "normal mp" 86 | let contents = getbufline(bufname('%'), 1, "$") 87 | let testlines = [] 88 | for line in contents 89 | if match(line, "void test") != -1 90 | let beg = match(line, "test") 91 | let fin = match(line, "(") 92 | let fun = strpart(line, beg, fin - beg) 93 | call add(testlines, "CPPUNIT_TEST(".fun.");") 94 | endif 95 | endfor 96 | if len(testlines) > 0 97 | let suitestart = search("CPPUNIT_TEST_SUITE(", 'nw') 98 | let suiteend = search("CPPUNIT_TEST_SUITE_END(", 'nw') 99 | let suitestart = suitestart + 1 100 | let suiteend = suiteend - 1 101 | if suitestart <= suiteend 102 | execute suitestart.",".suiteend."d" 103 | endif 104 | let linenum = suitestart - 1 105 | for line in testlines 106 | call setpos('.', [0, linenum, 0, 0]) 107 | execute "normal o".line 108 | let linenum = linenum + 1 109 | endfor 110 | endif 111 | execute "normal `p" 112 | endfunction 113 | 114 | " These functions and the s:modifyCPPUnitHeader variable allow the 115 | " functionality to be turned on and off. There are times you want to 116 | " comment out some tests and not have them updated automatically during 117 | " a run, so you'd want to shut this feature off. 118 | let s:modifyCPPUnitHeader = 0 119 | command! CPPUnitHeaderModify let s:modifyCPPUnitHeader = 1 120 | command! CPPUnitHeaderNoModify let s:modifyCPPUnitHeader = 0 121 | 122 | " Now plugin the AddCPPUnitTestMacros() to be called automatically 123 | " just before we write the file 124 | au! BufWritePre *.cpp call AddCPPUnitTestMacros() 125 | 126 | " 127 | " We want our code to stay within a certain set column length but we don't 128 | " want to be so brutal as to force an automatic word wrap by setting 129 | " 'textwidth'. What we want is to give a gentle reminder that we've gone 130 | " over our limits. To do this, we use the following two functions and some 131 | " colour settings. 132 | " 133 | " In addition to the column highlighting we also want to highlight when 134 | " there are leading tabs in the code - the last thing we want is people not 135 | " using the equivalent of 'expandtab' in their editors. When we load the 136 | " file in Vim we want to know that we've got some obnoxious leading tabs 137 | " that we should clean up. 138 | " 139 | 140 | " 141 | " DisableErrorHighlights() 142 | " 143 | " Clear out the highlighting that was done to warn us about the messes. 144 | " 145 | function! DisableErrorHighlights() 146 | if exists("w:match120") 147 | call matchdelete(w:match120) 148 | unlet w:match120 149 | endif 150 | if exists("w:matchTab") 151 | call matchdelete(w:matchTab) 152 | unlet w:matchTab 153 | endif 154 | endfunction 155 | 156 | " 157 | " EnableErrorHighlights() 158 | " 159 | " Highlight the stuff we are unhappy with. 160 | " 161 | function! EnableErrorHighlights() 162 | if !exists("w:match120") 163 | let w:match120=matchadd('BadInLine', '\%121v.*', -1) 164 | endif 165 | if !exists("w:matchTab") 166 | let w:matchTab=matchadd('BadInLine', '^\t\+', -1) 167 | endif 168 | endfunction 169 | 170 | " 171 | " AlterColour() 172 | " 173 | " This function is used in setting the error highlighting to compute an 174 | " appropriate colour for the highlighting that is computed independently 175 | " from the colour scheme itself. I find this nicer than hard-coding the 176 | " colour. 177 | " 178 | function! AlterColour(groupname, attr, shift) 179 | let clr = synIDattr(synIDtrans(hlID(a:groupname)), a:attr) 180 | if match(clr, '^#') == 0 181 | let red = str2nr(strpart(clr, 1, 2), 16) 182 | let green = str2nr(strpart(clr, 3, 2), 16) 183 | let blue = str2nr(strpart(clr, 5, 2), 16) 184 | let red = red + a:shift 185 | if red <= 0 186 | let red = "00" 187 | elseif red >= 256 188 | let red = "ff" 189 | else 190 | let red = printf("%02x", red) 191 | end 192 | let green = green + a:shift 193 | if green <= 0 194 | let green = "00" 195 | elseif green >= 256 196 | let green = "ff" 197 | else 198 | let green = printf("%02x", green) 199 | end 200 | let blue = blue + a:shift 201 | if blue <= 0 202 | let blue = "00" 203 | elseif blue >= 256 204 | let blue = "ff" 205 | else 206 | let blue = printf("%02x", blue) 207 | end 208 | return "#" . red . green . blue 209 | elseif strlen(clr) != 0 210 | echoerr 'Colour is not in hex form (' . clr . ')' 211 | return clr 212 | else 213 | return '' 214 | endif 215 | endfunction 216 | 217 | " The syntax highlight we use for the above error highlighting is 'BadInLine' 218 | " and we set what that colour is right here. I use the AlterColour() function 219 | " defined above to compute the right colour that's essentially colorshceme 220 | " neutral 221 | " 222 | " It's easier just to use black :) 223 | let darkerbg = "" 224 | if strlen(darkerbg) == 0 225 | let darkerbg = "black" 226 | end 227 | exe "hi BadInLine gui=none guibg=" . darkerbg 228 | 229 | " Enable/Disable the highlighting of tabs and of line length overruns 230 | nmap ,ee :call EnableErrorHighlights() 231 | nmap ,ed :call DisableErrorHighlights() 232 | 233 | " set up retabbing on a source file 234 | nmap ,rr :1,$retab 235 | 236 | " Fix up indent issues - I can't stand wasting an indent because I'm in a 237 | " namespace. If you don't like this then just comment this line out. 238 | setlocal indentexpr=GetCppIndentNoNamespace(v:lnum) 239 | 240 | " 241 | " Helper functions for the Indent code below 242 | " 243 | function! IsBlockComment(lnum) 244 | if getline(a:lnum) =~ '^\s*/\*' 245 | return 1 246 | else 247 | return 0 248 | endif 249 | endfunction 250 | 251 | function! IsBlockEndComment(lnum) 252 | if getline(a:lnum) =~ '^\s*\*/' 253 | return 1 254 | else 255 | return 0 256 | endif 257 | endfunction 258 | 259 | function! IsLineComment(lnum) 260 | if getline(a:lnum) =~ '^\s*//' 261 | return 1 262 | else 263 | return 0 264 | endif 265 | endfunction 266 | 267 | function! IsBrace(lnum) 268 | if getline(a:lnum) =~ '^\s*{' 269 | return 1 270 | else 271 | return 0 272 | endif 273 | endfunction 274 | 275 | function! IsCode(lnum) 276 | if !IsBrace(a:lnum) && getline(a:lnum) =~ '^\s*\S' 277 | return 1 278 | else 279 | return 0 280 | endif 281 | endfunction 282 | 283 | " 284 | " GetCppIndentNoNamespace() 285 | " 286 | " This little function calculates the indent level for C++ and treats the 287 | " namespace differently than usual - we ignore it. The indent level is the for 288 | " a given line is the same as it would be were the namespace not event there. 289 | " 290 | function! GetCppIndentNoNamespace(lnum) 291 | let nsLineNum = search('^\s*\\s\+\S\+', 'bnW') 292 | if nsLineNum == 0 293 | return cindent(a:lnum) 294 | else 295 | let inBlockComment = 0 296 | let inLineComment = 0 297 | let inCode = 0 298 | for n in range(nsLineNum + 1, a:lnum - 1) 299 | if IsBlockComment(n) 300 | let inBlockComment = 1 301 | elseif IsBlockEndComment(n) 302 | let inBlockComment = 0 303 | elseif IsLineComment(n) && inBlockComment == 0 304 | let inLineComment = 1 305 | elseif IsCode(n) && inBlockComment == 0 306 | let inCode = 1 307 | break 308 | endif 309 | endfor 310 | if inCode == 1 311 | if IsBrace(a:lnum) && GetCppIndentNoNamespace(a:lnum - 1) == 0 312 | return 0 313 | else 314 | return cindent(a:lnum) 315 | endif 316 | elseif inBlockComment 317 | return cindent(a:lnum) 318 | elseif inLineComment 319 | if IsCode(a:lnum) 320 | return cindent(nsLineNum) 321 | else 322 | return cindent(a:ln 323 | endif 324 | elseif inBlockComment == 0 && inLineComment == 0 && inCode == 0 325 | return cindent(nsLineNum) 326 | endif 327 | endif 328 | endfunction 329 | 330 | " 331 | " FuzzyFinder stuff 332 | " 333 | " 334 | " SanitizeDirForFuzzyFinder() 335 | " 336 | " This is really just a convenience function to clean up 337 | " any stray '/' characters in the path, should they be there. 338 | " 339 | function! SanitizeDirForFuzzyFinder(dir) 340 | let dir = expand(a:dir) 341 | let dir = substitute(dir, '/\+$', '', '') 342 | let dir = substitute(dir, '/\+', '/', '') 343 | 344 | return dir 345 | endfunction 346 | 347 | " 348 | " GetDirForFuzzyFinder() 349 | " 350 | " The important function... Given a directory to start 'from', 351 | " walk up the hierarchy, looking for a path that matches the 352 | " 'addon' you want to see. 353 | " 354 | " If nothing can be found, then we just return the 'from' so 355 | " we don't really get the advantage of a hint, but just let 356 | " the user start from wherever he was starting from anyway. 357 | " 358 | function! GetDirForFuzzyFinder(from, addon) 359 | let from = SanitizeDirForFuzzyFinder(a:from) 360 | let addon = expand(a:addon) 361 | let addon = substitute(addon, '^/\+', '', '') 362 | let found = '' 363 | " If the addon is right here, then we win 364 | if isdirectory(from . '/' . addon) 365 | let found = from . '/' . addon 366 | else 367 | let dirs = split(from, '/') 368 | if !has('win32') && !has('win64') 369 | let dirs[0] = '/' . dirs[0] 370 | endif 371 | " Walk up the tree and see if it's anywhere there 372 | for n in range(len(dirs) - 1, 0, -1) 373 | let path = join(dirs[0:n], '/') 374 | if isdirectory(path . '/' . addon) 375 | let found = path . '/' . addon 376 | break 377 | endif 378 | endfor 379 | endif 380 | " If we found it, then let's see if we can go deeper 381 | " 382 | " For example, we may have found component_name/include 383 | " but what if that directory only has a single directory 384 | " in it, and that subdirectory only has a single directory 385 | " in it, etc... ? This can happen when you're segmenting 386 | " by namespace like this: 387 | " 388 | " component_name/include/org/vim/CoolClass.h 389 | " 390 | " You may find yourself always typing '' from the 391 | " 'include' directory just to go into 'org/vim' so let's 392 | " just eliminate the need to hit the ''. 393 | if found != '' 394 | let tempfrom = found 395 | let globbed = globpath(tempfrom, '*') 396 | while len(split(globbed, "\n")) == 1 397 | let tempfrom = globbed 398 | let globbed = globpath(tempfrom, '*') 399 | endwhile 400 | let found = SanitizeDirForFuzzyFinder(tempfrom) . '/' 401 | else 402 | let found = from 403 | endif 404 | 405 | return found 406 | endfunction 407 | 408 | " 409 | " GetDirForFuzzyFinder() 410 | " 411 | " Now overload GetDirForFuzzyFinder() specifically for 412 | " the test directory (I'm really only interested in going 413 | " down into test/src 90% of the time, so let's hit that 414 | " 90% and leave the other 10% to couple of extra keystrokes) 415 | " 416 | function! GetTestDirForFuzzyFinder(from) 417 | return GetDirForFuzzyFinder(a:from, 'test/src/') 418 | endfunction 419 | 420 | " 421 | " GetIncludeDirForFuzzyFinder() 422 | " 423 | " Now specialize for the 'include'. Note that we rip off any 424 | " '/test/' in the current 'from'. Why? The /test/ directory 425 | " contains an 'include' directory, which would match if we 426 | " were anywhere in the 'test' directory, and we don't want that. 427 | " 428 | function! GetIncludeDirForFuzzyFinder(from) 429 | let from = substitute(SanitizeDirForFuzzyFinder(a:from), '/test/.*$', '', '') 430 | return GetDirForFuzzyFinder(from, 'include/') 431 | endfunction 432 | 433 | " 434 | " GetSrcDirForFuzzyFinder() 435 | " 436 | " Much like the GetIncludeDirForFuzzyFinder() but for the 'src' directory. 437 | " 438 | function! GetSrcDirForFuzzyFinder(from) 439 | let from = substitute(SanitizeDirForFuzzyFinder(a:from), '/test/.*$', '', '') 440 | return GetDirForFuzzyFinder(from, 'src/') 441 | endfunction 442 | 443 | "nnoremap ,ft :FufFile =GetTestDirForFuzzyFinder('%:p:h') 444 | "nnoremap ,fi :FufFile =GetIncludeDirForFuzzyFinder('%:p:h') 445 | "nnoremap ,fs :FufFile =GetSrcDirForFuzzyFinder('%:p:h') 446 | 447 | " 448 | " ProtoDef Settings 449 | " See http://www.vim.org/scripts/script.php?script_id=2624 450 | " 451 | "let g:protodefprotogetter = expand($VIM) . '/pullproto.pl' 452 | let g:protodefctagsexe = '/usr/bin/ctags' 453 | 454 | augroup local_ftplugin_cpp 455 | au! 456 | " Enable and disable the highlighting of lines greater than 457 | " our 'allowed' length 458 | au BufWinEnter *.h,*.cpp call EnableErrorHighlights() 459 | au BufWinLeave *.h,*.cpp call DisableErrorHighlights() 460 | " Change the directory when entering a buffer 461 | au BufWinEnter,BufEnter *.h,*.cpp :lcd %:h 462 | " Settings for the FSwitch plugin 463 | " See http://www.vim.org/scripts/script.php?script_id=2590 464 | "au BufEnter *.cpp let b:fswitchlocs = 'reg:/src/include/,reg:|src|include/**|,../include' 465 | "au BufEnter *.h let b:fswitchlocs = 'reg:/include/src/,reg:|include/.*|src|,reg:|include/.*||,../src' 466 | "au BufEnter *.h let b:fswitchdst = 'cpp' 467 | augroup END 468 | 469 | -------------------------------------------------------------------------------- /after/ftplugin/help.vim: -------------------------------------------------------------------------------- 1 | function! JustifySectionTitle() 2 | let line = getline('.') 3 | let matches = matchlist(line, '^\(.\{-}\)\s\+\(\*.*\)\s*$') 4 | let title = matches[1] 5 | let theTag = matches[2] 6 | let numSpaces = 78 - strlen(title) - strlen(theTag) 7 | let c = 0 8 | let spc = "" 9 | while c < numSpaces 10 | let spc = spc . " " 11 | let c = c + 1 12 | endwhile 13 | let lnum = getpos('.')[1] - 1 14 | normal dd 15 | call append(lnum, title . spc . theTag) 16 | endfunction 17 | 18 | nmap ,jt :call JustifySectionTitle() 19 | -------------------------------------------------------------------------------- /after/ftplugin/json.vim: -------------------------------------------------------------------------------- 1 | hi def link jsonCommentError Comment 2 | -------------------------------------------------------------------------------- /after/ftplugin/tex.vim: -------------------------------------------------------------------------------- 1 | 2 | " When I'm editing some LaTeX, I use PDF files to handle any inserted images and 3 | " LaTeX has some difficulty lining them up right, so I explicitly state the 4 | " viewport. To get the bounding box from the PDF file, I have a script called 5 | " 'getbb'. This function is /very/ specific to my needs. It pulls the filename 6 | " from the current line, which always looks something like this: 7 | " 8 | " \includegraphics[scale=0.5, viewport = 40 39 703 153]{target/filename.pdf} 9 | " 10 | " Pulls out the filename (i.e. target/filename.pdf), runs 'getbb' on that and 11 | " inserts the output back overtop of the "viewport = 40 39 703 153". 12 | " 13 | " The couple of mappings make everything real easy to use. 14 | function! UpdateBoundingBox() 15 | let l = getline('.') 16 | let f = substitute(l, '.*{\(.*\)}.*$', '\1', '') 17 | if f =~? '[^/]\+/[^/]\+\.pdf' 18 | if filereadable('getbb') 19 | let bb = system('getbb ' . f) 20 | let bb = substitute(bb, '.$', '', '') 21 | :s/\zsviewport.*\ze\]/\=bb/ 22 | else 23 | echoerr "Can't find getbb... are you in the right directory?" 24 | endif 25 | else 26 | echoerr "Couldn't get a pdf file from the current line." 27 | endif 28 | endfunction 29 | 30 | nmap ,bb :call UpdateBoundingBox() 31 | nmap ,abb :g/includegraphics.*viewport/execute ':call UpdateBoundingBox()' 32 | -------------------------------------------------------------------------------- /after/ftplugin/wiki.vim: -------------------------------------------------------------------------------- 1 | iabbrev ALP [[ALP]] 2 | iabbrev AccountSettings [[AccountSettings]] 3 | iabbrev Adapter [[Adapter]] 4 | iabbrev Agent [[Agent]] 5 | iabbrev BBID [[BBID]] 6 | iabbrev BBItemId [[BBItemId]] 7 | iabbrev BCMI [[BCMI]] 8 | iabbrev CalendarItem [[CalendarItem]] 9 | iabbrev CalendarItems [[CalendarItem]]s 10 | iabbrev Capabilities [[Capabilities]] 11 | iabbrev Capability [[Capability]] 12 | iabbrev ClassWaterMark [[ClassWaterMark]] 13 | iabbrev ClassWaterMarks [[ClassWaterMark]]s 14 | iabbrev Command [[Command]] 15 | iabbrev ContactItem [[CalendarItem]] 16 | iabbrev ContactItems [[CalendarItem]]s 17 | iabbrev Create [[Create]] 18 | iabbrev Delete [[Delete]] 19 | iabbrev Device [[Device]] 20 | iabbrev EmailItem [[CalendarItem]] 21 | iabbrev EmailItems [[CalendarItem]]s 22 | iabbrev Event [[Event]] 23 | iabbrev Events [[Event]]s 24 | iabbrev FolderItem [[FolderItem]] 25 | iabbrev FolderItems [[FolderItem]]s 26 | iabbrev FolderWaterMark [[FolderWaterMark]] 27 | iabbrev FolderWaterMarks [[FolderWaterMark]]s 28 | iabbrev Hydrah [[Hydrah]] 29 | iabbrev ItemPresence [[ItemPresence]] 30 | iabbrev ItemType [[ItemType]] 31 | iabbrev MSID [[MSID]] 32 | iabbrev MSItemId [[MSItemId]] 33 | iabbrev MemoItem [[MemoItem]] 34 | iabbrev MemoItems [[MemoItem]]s 35 | iabbrev OrganizationSettings [[OrganizationSettings]] 36 | iabbrev Pattern [[Pattern]] 37 | iabbrev PatternType [[PatternType]] 38 | iabbrev Patterns [[Pattern]]s 39 | iabbrev Result [[Result]] 40 | iabbrev ResultPattern [[ResultPattern]] 41 | iabbrev Retrieve [[Retrieve]] 42 | iabbrev SelectPattern [[SelectPattern]] 43 | iabbrev Session [[Session]] 44 | iabbrev SessionSettings [[SessionSettings]] 45 | iabbrev State [[State]] 46 | iabbrev Sync [[Sync]] 47 | iabbrev ss [[Sync Server]] 48 | iabbrev TaskItem [[TaskItem]] 49 | iabbrev TaskItems [[TaskItem]]s 50 | iabbrev Update [[Update]] 51 | iabbrev VersionMark [[VersionMark]] 52 | iabbrev VersionMarks [[VersionMark]]s 53 | iabbrev WaterMark [[WaterMark]] 54 | iabbrev WaterMarks [[WaterMark]]s 55 | iabbrev bbc [[BlackBerry Core]] 56 | -------------------------------------------------------------------------------- /after/plugin/solarized.vim: -------------------------------------------------------------------------------- 1 | call togglebg#map("t") 2 | -------------------------------------------------------------------------------- /after/plugin/tabular_extra.vim: -------------------------------------------------------------------------------- 1 | AddTabularPattern byspace /\s\+/l0 2 | AddTabularPattern bycomma /,/r0l1 3 | -------------------------------------------------------------------------------- /after/syntax/cpp/stl.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: C++ special highlighting for STL classes and methods 3 | " Maintainer: Jean-Francois Guchens (thanks to Nathan Skvirsky) 4 | " Last Change: 2008 May 02 5 | 6 | " [DQW] For now, this is annoying but there's still potential here 7 | finish 8 | 9 | syn keyword cppSTL abort abs accumulate acos adjacent_difference adjacent_find adjacent_find_if append asctime asin assert assign at atan atan2 atexit atof atoi atol back back_inserter bad bad_alloc bad_cast bad_exception bad_typeid badbit beg begin binary_compose binary_negate binary_search bind2nd binder1st binder2nd bitset bsearch c_str calloc capacity ceil cerr cin clear clearerr clock clog close compare compose1 compose2 construct copy copy_backward copy_n cos cosh count count_if cout ctime data destroy difference_type difftime div domain_error empty end endl eof eofbit equal equal_range erase exception exit exp fabs fail failbit failure fclose feof ferror fflush fgetc fgetpos fgets fill fill_n find find_end find_first_not_of find_first_of find_if find_last_not_of find_last_of first flags flip floor flush fmod fopen for_each fprintf fputc fputs fread free freopen frexp front fscanf fseek fsetpos ftell fwrite gcount generate generate_n get get_temporary_buffer getc getchar getenv getline gets gmtime good goodbit greater greater_equal ignore in includes inner_product inplace_merge insert inserter invalid_argument ios ios_base iostate iota is_heap is_open is_sorted isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit iter_swap iterator_category key_comp ldiv length length_error less less_equal lexicographical_compare lexicographical_compare_3way localtime log log10 logic_error logical_and logical_not logical_or longjmp lower_bound make_heap malloc max max_element max_size mem_fun mem_fun1 mem_fun1_ref mem_fun_ref memchr memcpy memmove memset merge min min_element minus mismatch mktime modf modulus multiplies negate next_permutation npos nth_element numeric_limits open out_of_range overflow_error partial_sort partial_sort_copy partial_sum partition peek perror plus pop pop_back pop_front pop_heap pow power precision prev_permutation printf ptr_fun push push_back push_front push_heap put putback putc putchar puts qsort raise rand random_sample random_sample_n random_shuffle range_error rbegin rdbuf rdstate read realloc reference remove remove_copy remove_copy_if remove_if rename rend replace replace_copy replace_copy_if replace_if reserve reset resize return_temporary_buffer reverse reverse_copy rewind rfind rotate rotate_copy runtime_error scanf search search_n second seekg seekp set_difference set_intersection set_symmetric_difference set_union setbuf setf setjmp setlocale setvbuf signal sin sinh size size_t size_type sort sort_heap splice sprintf sqrt srand sscanf stable_partition stable_sort std str strcat strchr strcmp strcoll strcpy strcspn strerror strftime string strlen strncat strncmp strncpy strpbrk strrchr strspn strstr strtod strtok strtol strtoul strxfrm substr swap swap_ranges sync_with_stdio system tan tanh tellg tellp test time time_t tmpfile tmpnam to_string to_ulong tolower top toupper transform unary_compose unary_negate underflow_error unget ungetc uninitialized_copy uninitialized_copy_n uninitialized_fill uninitialized_fill_n unique unique_copy unsetf upper_bound va_arg value_comp value_type vfprintf vprintf vsprintf width write tr1 boost posix_time 10 | 11 | syn keyword cppSTLtype istreambuf_iterator filebuf string ofstream ifstream stream istream_iterator istringstream ostream ostream_iterator ostringstream fstream auto_ptr pointer pointer_to_binary_function pointer_to_unary_function basic_string bit_vector bitset char_producer deque hash hash_map hash_multimap hash_multiset hash_set list map multimap multiset queue priority_queue rope set stack vector back_insert_iterator iterator bidirectional_iterator bidirectional_iterator_tag forward_iterator forward_iterator_tag front_insert_iterator input_iterator input_iterator_tag insert_iterator istream_iterator iterator_traits ostream_iterator output_iterator output_iterator_tag random_access_iterator random_access_iterator_tag raw_storage_iterator reverse_bidirectional_iterator reverse_iterator sequence_buffer binary_compose binary_function binary_negate binder1st binder2nd divides equal_to unary_compose unary_function unary_negate pair char_traits const_iterator reverse_iterator temporary_buffer shared_ptr any wstring ptime 12 | 13 | " Default highlighting 14 | if version >= 508 || !exists("did_cpp_syntax_inits") 15 | if version < 508 16 | let did_cpp_syntax_inits = 1 17 | command -nargs=+ HiLink hi link 18 | else 19 | command -nargs=+ HiLink hi def link 20 | endif 21 | HiLink cppSTL Identifier 22 | HiLink cppSTLtype Type 23 | delcommand HiLink 24 | endif 25 | 26 | -------------------------------------------------------------------------------- /after/syntax/help.vim: -------------------------------------------------------------------------------- 1 | "***************************************************************************** 2 | "** Name: help.vim - extend standard syntax highlighting for help ** 3 | "** ** 4 | "** Type: syntax file ** 5 | "** ** 6 | "** Author: Christian Habermann ** 7 | "** christian (at) habermann-net (point) de ** 8 | "** ** 9 | "** Copyright: (c) 2002-2004 by Christian Habermann ** 10 | "** ** 11 | "** License: GNU General Public License 2 (GPL 2) or later ** 12 | "** ** 13 | "** This program is free software; you can redistribute it ** 14 | "** and/or modify it under the terms of the GNU General Public ** 15 | "** License as published by the Free Software Foundation; either ** 16 | "** version 2 of the License, or (at your option) any later ** 17 | "** version. ** 18 | "** ** 19 | "** This program is distributed in the hope that it will be ** 20 | "** useful, but WITHOUT ANY WARRANTY; without even the implied ** 21 | "** warrenty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ** 22 | "** PURPOSE. ** 23 | "** See the GNU General Public License for more details. ** 24 | "** ** 25 | "** Version: 1.0.1 ** 26 | "** tested under Linux and Win32, VIM and GVIM 6.2 ** 27 | "** ** 28 | "** History: 0.1.0 12. Dec. 2002 - 21. Feb. 2003 ** 29 | "** initial version, not released ** 30 | "** 1.0.0 6. Apr. 2003 ** 31 | "** no changes, first release ** 32 | "** 1.0.1 3. Mar. 2004 ** 33 | "** marker changed from 0xa7 to $ in order to avoid problems ** 34 | "** with fonts that use codes > 0x7f as multibyte characters ** 35 | "** (e.g. Chinese, Korean, Japanese... fonts) ** 36 | "** ** 37 | "** ** 38 | "***************************************************************************** 39 | "** Description: ** 40 | "** This syntax file extends the standard syntax highlighting for help ** 41 | "** files. This is needed in order to view the C-reference manual ** 42 | "** of the project CRefVim correctly. ** 43 | "** This syntax file is only active for the help file named ** 44 | "** "crefvim.txt". For other help files no extention on syntax ** 45 | "** highlighting is applied. ** 46 | "** ** 47 | "** For futher information see crefvimdoc.txt or do :help crefvimdoc ** 48 | "** ** 49 | "** Happy viming... ** 50 | "***************************************************************************** 51 | 52 | 53 | " extend syntax-highlighting for "crefvim.txt" only (not case-sensitive) 54 | 55 | if tolower(expand("%:t"))=="crefvim.txt" 56 | syn match helpCRVSubStatement "statement[0-9Ns]*" contained 57 | syn match helpCRVSubCondition "condition[0-9]*" contained 58 | syn match helpCRVSubExpression "expression[0-9]*" contained 59 | syn match helpCRVSubExpr "expr[0-9N]" contained 60 | syn match helpCRVSubType "type-name" contained 61 | syn match helpCRVSubIdent "identifier" contained 62 | syn match helpCRVSubIdentList "identifier-list" contained 63 | syn match helpCRVSubOperand "operand[0-9]*" contained 64 | syn match helpCRVSubConstExpr "constant-expression[1-9Ns]*" contained 65 | syn match helpCRVSubClassSpec "storage-class-specifier" contained 66 | syn match helpCRVSubTypeSpec "type-specifier" contained 67 | syn match helpCRVSubEnumList "enumerator-list" contained 68 | syn match helpCRVSubDecl "declarator" contained 69 | syn match helpCRVSubRetType "return-type" contained 70 | syn match helpCRVSubFuncName "function-name" contained 71 | syn match helpCRVSubParamList "parameter-list" contained 72 | syn match helpCRVSubReplList "replacement-list" contained 73 | syn match helpCRVSubNewLine "newline" contained 74 | syn match helpCRVSubMessage "message" contained 75 | syn match helpCRVSubFilename "filename" contained 76 | syn match helpCRVSubDigitSeq "digit-sequence" contained 77 | syn match helpCRVSubMacroNames "macro-name[s]*" contained 78 | syn match helpCRVSubDirective "directive" contained 79 | 80 | 81 | syn match helpCRVignore "\$[a-zA-Z0-9\\\*/\._=()\-+%<>&\^|!~\?:,\[\];{}#\'\" ]\+\$" contains=helpCRVstate 82 | syn match helpCRVstate "[a-zA-Z0-9\\\*/\._=()\-+%<>&\^|!~\?:,\[\];{}#\'\" ]\+" contained contains=helpCRVSub.* 83 | 84 | 85 | hi helpCRVitalic term=italic cterm=italic gui=italic 86 | 87 | hi def link helpCRVstate Comment 88 | hi def link helpCRVSubStatement helpCRVitalic 89 | hi def link helpCRVSubCondition helpCRVitalic 90 | hi def link helpCRVSubExpression helpCRVitalic 91 | hi def link helpCRVSubExpr helpCRVitalic 92 | hi def link helpCRVSubOperand helpCRVitalic 93 | hi def link helpCRVSubType helpCRVitalic 94 | hi def link helpCRVSubIdent helpCRVitalic 95 | hi def link helpCRVSubIdentList helpCRVitalic 96 | hi def link helpCRVSubConstExpr helpCRVitalic 97 | hi def link helpCRVSubClassSpec helpCRVitalic 98 | hi def link helpCRVSubTypeSpec helpCRVitalic 99 | hi def link helpCRVSubEnumList helpCRVitalic 100 | hi def link helpCRVSubDecl helpCRVitalic 101 | hi def link helpCRVSubRetType helpCRVitalic 102 | hi def link helpCRVSubFuncName helpCRVitalic 103 | hi def link helpCRVSubParamList helpCRVitalic 104 | hi def link helpCRVSubReplList helpCRVitalic 105 | hi def link helpCRVSubNewLine helpCRVitalic 106 | hi def link helpCRVSubMessage helpCRVitalic 107 | hi def link helpCRVSubFilename helpCRVitalic 108 | hi def link helpCRVSubDigitSeq helpCRVitalic 109 | hi def link helpCRVSubMacroNames helpCRVitalic 110 | hi def link helpCRVSubDirective helpCRVitalic 111 | hi def link helpCRVignore Ignore 112 | endif 113 | 114 | " vim: ts=8 sw=2 115 | -------------------------------------------------------------------------------- /bin/maketags: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | verbose=0 4 | force=0 5 | code_dir=$(pwd) 6 | 7 | while getopts vfc: opt 8 | do 9 | case $opt in 10 | v) verbose=1 11 | ;; 12 | f) force=1 13 | ;; 14 | c) code_dir=$OPTARG 15 | ;; 16 | esac 17 | done 18 | shift $((OPTIND-1)) 19 | 20 | function vecho 21 | { 22 | if [[ $verbose = 1 ]]; then 23 | echo $@ 24 | fi 25 | } 26 | 27 | function in_git_repo 28 | { 29 | if [[ -n $code_dir ]]; then 30 | (cd $code_dir; git status > /dev/null 2>&1) 31 | else 32 | git status > /dev/null 2>&1 33 | fi 34 | } 35 | 36 | function get_code_dir 37 | { 38 | if in_git_repo; then 39 | (cd $code_dir; git rev-parse --show-toplevel) 40 | else 41 | p4 client -o | grep ^Root | awk '{print $2}' 42 | fi 43 | } 44 | 45 | function get_branch 46 | { 47 | if in_git_repo; then 48 | (cd $code_dir; git branch | grep '^\*' | cut -c3-) 49 | else 50 | p4 client -o | grep ^Client | awk '{print $2}' 51 | fi 52 | } 53 | 54 | if [[ -z $code_dir ]]; then 55 | code_dir=$(get_code_dir) 56 | fi 57 | branch=$(get_branch) 58 | tagbranch=$(echo $branch | tr '/ ' '-') 59 | processes=$(pgrep ctags) 60 | if [[ -n $processes ]]; then 61 | vecho "Killing off: $processes" 62 | pkill ctags 63 | fi 64 | rm -f ~/.vim-tags/*.[0-9][0-9]* 65 | 66 | for dir in $(echo $code_dir/src $code_dir/*/src $code_dir/*/*/src $code_dir/*/*/*/src $code_dir/*/*/*/*/src $code_dir/*/*/*/*/*/src $code_dir/*/*/*/*/*/*/src) 67 | do 68 | if [[ ! -d $dir ]]; then 69 | continue 70 | fi 71 | tagfile=$(echo $dir | tr '/ ' '-' | cut -c2-)-$tagbranch-tags 72 | tagoutput=~/.vim-tags/$tagfile 73 | if [[ $force == 1 ]]; then 74 | rm -f $tagoutput 75 | fi 76 | run=0 77 | if [[ ! -f $tagoutput ]]; then 78 | run=1 79 | elif [[ -n $(find $dir -newer $tagoutput) ]]; then 80 | run=1 81 | fi 82 | if [[ $run = 1 ]]; then 83 | vecho Running CTAGS to $tagfile 84 | ( 85 | tempfile=$tagoutput.$$; 86 | trap "rm -f $tempfile" EXIT; 87 | /usr/local/bin/ctags --recurse -f $tempfile $dir; 88 | mv $tempfile $tagoutput 89 | ) & 90 | fi 91 | done 92 | wait 93 | -------------------------------------------------------------------------------- /colors/lakesidelight.vim: -------------------------------------------------------------------------------- 1 | " Base16 Vim original template by Chris Kempson (https://github.com/chriskempson/base16-vim) 2 | " Scheme: Atelier_Lakeside by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/) 3 | 4 | " This enables the coresponding base16-shell script to run so that 5 | " :colorscheme works in terminals supported by base16-shell scripts 6 | " User must set this variable in .vimrc 7 | " let g:base16_shell_path=base16-builder/output/shell/ 8 | if !has('gui_running') 9 | if exists("g:base16_shell_path") 10 | execute "silent !/bin/sh ".g:base16_shell_path."/Atelier_LakesideLight.".&background.".sh" 11 | endif 12 | endif 13 | 14 | setlocal background=light 15 | 16 | " GUI color definitions 17 | let s:gui00 = "161b1d" 18 | let s:gui01 = "1f292e" 19 | let s:gui02 = "516d7b" 20 | let s:gui03 = "5a7b8c" 21 | let s:gui04 = "7195a8" 22 | let s:gui05 = "7ea2b4" 23 | let s:gui06 = "c1e4f6" 24 | let s:gui07 = "ebf8ff" 25 | let s:gui08 = "d22d72" 26 | let s:gui09 = "935c25" 27 | let s:gui0A = "8a8a0f" 28 | let s:gui0B = "568c3b" 29 | let s:gui0C = "2d8f6f" 30 | let s:gui0D = "257fad" 31 | let s:gui0E = "6b6bb8" 32 | let s:gui0F = "b72dd2" 33 | 34 | let s:guiDWVB = "ff00ff" 35 | let s:guiDWVF = "ffffff" 36 | let s:guiDWBG = "ffff22" 37 | let s:guiDWFG = "000000" 38 | 39 | " Terminal color definitions 40 | let s:cterm00 = "234 " 41 | let s:cterm03 = "243 " 42 | let s:cterm05 = "247 " 43 | let s:cterm07 = "231 " 44 | let s:cterm08 = "161 " 45 | let s:cterm0A = "100 " 46 | let s:cterm0B = "65 " 47 | let s:cterm0C = "29 " 48 | let s:cterm0D = "31 " 49 | let s:cterm0E = "61 " 50 | if exists('base16colorspace') && base16colorspace == "256" 51 | let s:cterm01 = "235 " 52 | let s:cterm02 = "241 " 53 | let s:cterm04 = "246 " 54 | let s:cterm06 = "254 " 55 | let s:cterm09 = "94 " 56 | let s:cterm0F = "164 " 57 | else 58 | let s:cterm01 = "235 " 59 | let s:cterm02 = "241 " 60 | let s:cterm04 = "246 " 61 | let s:cterm06 = "254 " 62 | let s:cterm09 = "94 " 63 | let s:cterm0F = "164 " 64 | endif 65 | 66 | " Theme setup 67 | hi clear 68 | syntax reset 69 | let g:colors_name = "lakesidelight" 70 | 71 | " Highlighting function 72 | fun hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp) 73 | if a:guifg != "" 74 | exec "hi " . a:group . " guifg=#" . s:gui(a:guifg) 75 | endif 76 | if a:guibg != "" 77 | exec "hi " . a:group . " guibg=#" . s:gui(a:guibg) 78 | endif 79 | if a:ctermfg != "" 80 | exec "hi " . a:group . " ctermfg=" . s:cterm(a:ctermfg) 81 | endif 82 | if a:ctermbg != "" 83 | exec "hi " . a:group . " ctermbg=" . s:cterm(a:ctermbg) 84 | endif 85 | if a:attr != "" 86 | exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr 87 | endif 88 | if a:guisp != "" 89 | exec "hi " . a:group . " guisp=#" . a:guisp 90 | endif 91 | endfun 92 | 93 | " Return GUI color for light/dark variants 94 | fun s:gui(color) 95 | if &background == "dark" 96 | return a:color 97 | endif 98 | 99 | if a:color == s:gui00 100 | return s:gui07 101 | elseif a:color == s:gui01 102 | return s:gui06 103 | elseif a:color == s:gui02 104 | return s:gui05 105 | elseif a:color == s:gui03 106 | return s:gui04 107 | elseif a:color == s:gui04 108 | return s:gui03 109 | elseif a:color == s:gui05 110 | return s:gui02 111 | elseif a:color == s:gui06 112 | return s:gui01 113 | elseif a:color == s:gui07 114 | return s:gui00 115 | endif 116 | 117 | return a:color 118 | endfun 119 | 120 | " Return terminal color for light/dark variants 121 | fun s:cterm(color) 122 | if &background == "dark" 123 | return a:color 124 | endif 125 | 126 | if a:color == s:cterm00 127 | return s:cterm07 128 | elseif a:color == s:cterm01 129 | return s:cterm06 130 | elseif a:color == s:cterm02 131 | return s:cterm05 132 | elseif a:color == s:cterm03 133 | return s:cterm04 134 | elseif a:color == s:cterm04 135 | return s:cterm03 136 | elseif a:color == s:cterm05 137 | return s:cterm02 138 | elseif a:color == s:cterm06 139 | return s:cterm01 140 | elseif a:color == s:cterm07 141 | return s:cterm00 142 | endif 143 | 144 | return a:color 145 | endfun 146 | 147 | " Vim editor colors 148 | call hi("Bold", "", "", "", "", "bold", "") 149 | call hi("Debug", s:gui08, "", s:cterm08, "", "", "") 150 | call hi("Directory", s:gui0D, "", s:cterm0D, "", "", "") 151 | call hi("Error", s:gui00, s:gui08, s:cterm00, s:cterm08, "", "") 152 | call hi("ErrorMsg", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") 153 | call hi("Exception", s:gui08, "", s:cterm08, "", "", "") 154 | call hi("FoldColumn", s:gui0C, s:gui01, s:cterm0C, s:cterm01, "", "") 155 | call hi("Folded", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") 156 | call hi("IncSearch", s:gui01, s:gui09, s:cterm01, s:cterm09, "none", "") 157 | call hi("Italic", "", "", "", "", "none", "") 158 | call hi("Macro", s:gui08, "", s:cterm08, "", "", "") 159 | call hi("MatchParen", s:gui00, s:gui03, s:cterm00, s:cterm03, "", "") 160 | call hi("ModeMsg", s:gui0B, "", s:cterm0B, "", "", "") 161 | call hi("MoreMsg", s:gui0B, "", s:cterm0B, "", "", "") 162 | call hi("Question", s:gui0D, "", s:cterm0D, "", "", "") 163 | call hi("Search", s:gui06, s:gui0A, s:cterm06, s:cterm0A, "", "") 164 | call hi("SpecialKey", s:gui03, "", s:cterm03, "", "", "") 165 | call hi("TooLong", s:gui08, "", s:cterm08, "", "", "") 166 | call hi("Underlined", s:gui08, "", s:cterm08, "", "", "") 167 | call hi("Visual", s:guiDWVF, s:guiDWVB, "", s:cterm02, "", "") 168 | call hi("VisualNOS", s:gui08, "", s:cterm08, "", "", "") 169 | call hi("WarningMsg", s:gui08, "", s:cterm08, "", "", "") 170 | call hi("WildMenu", s:gui08, s:gui0A, s:cterm08, "", "", "") 171 | call hi("Title", s:gui0D, "", s:cterm0D, "", "none", "") 172 | call hi("Conceal", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "") 173 | call hi("Cursor", s:gui00, s:gui05, s:cterm00, s:cterm05, "", "") 174 | call hi("NonText", s:gui03, "", s:cterm03, "", "", "") 175 | call hi("Normal", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "") 176 | call hi("LineNr", s:gui02, s:gui01, s:cterm02, s:cterm01, "", "") 177 | call hi("SignColumn", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") 178 | call hi("StatusLine", s:guiDWFG, s:guiDWBG, s:cterm04, s:cterm02, "none", "") 179 | call hi("StatusLineNC", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "") 180 | call hi("VertSplit", s:gui00, s:gui00, s:cterm00, s:cterm00, "none", "") 181 | call hi("ColorColumn", "", s:gui01, "", s:cterm01, "none", "") 182 | call hi("CursorColumn", "", s:gui01, "", s:cterm01, "none", "") 183 | call hi("CursorLine", "", s:gui01, "", s:cterm01, "none", "") 184 | call hi("CursorLineNr", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") 185 | call hi("PMenu", s:gui04, s:gui01, s:cterm04, s:cterm01, "none", "") 186 | call hi("PMenuSel", s:gui01, s:gui04, s:cterm01, s:cterm04, "", "") 187 | call hi("TabLine", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "") 188 | call hi("TabLineFill", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "") 189 | call hi("TabLineSel", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "none", "") 190 | 191 | " Standard syntax highlighting 192 | call hi("Boolean", s:gui09, "", s:cterm09, "", "", "") 193 | call hi("Character", s:gui08, "", s:cterm08, "", "", "") 194 | call hi("Comment", s:gui03, "", s:cterm03, "", "", "") 195 | call hi("Conditional", s:gui0E, "", s:cterm0E, "", "", "") 196 | call hi("Constant", s:gui09, "", s:cterm09, "", "", "") 197 | call hi("Define", s:gui0E, "", s:cterm0E, "", "none", "") 198 | call hi("Delimiter", s:gui0F, "", s:cterm0F, "", "", "") 199 | call hi("Float", s:gui09, "", s:cterm09, "", "", "") 200 | call hi("Function", s:gui0D, "", s:cterm0D, "", "", "") 201 | call hi("Identifier", s:gui08, "", s:cterm08, "", "none", "") 202 | call hi("Include", s:gui0D, "", s:cterm0D, "", "", "") 203 | call hi("Keyword", s:gui0E, "", s:cterm0E, "", "", "") 204 | call hi("Label", s:gui0A, "", s:cterm0A, "", "", "") 205 | call hi("Number", s:gui09, "", s:cterm09, "", "", "") 206 | call hi("Operator", s:gui05, "", s:cterm05, "", "none", "") 207 | call hi("PreProc", s:gui0A, "", s:cterm0A, "", "", "") 208 | call hi("Repeat", s:gui0A, "", s:cterm0A, "", "", "") 209 | call hi("Special", s:gui0C, "", s:cterm0C, "", "", "") 210 | call hi("SpecialChar", s:gui0F, "", s:cterm0F, "", "", "") 211 | call hi("Statement", s:gui08, "", s:cterm08, "", "", "") 212 | call hi("StorageClass", s:gui0A, "", s:cterm0A, "", "", "") 213 | call hi("String", s:gui0B, "", s:cterm0B, "", "", "") 214 | call hi("Structure", s:gui0E, "", s:cterm0E, "", "", "") 215 | call hi("Tag", s:gui0A, "", s:cterm0A, "", "", "") 216 | call hi("Todo", s:gui0A, s:gui01, s:cterm0A, s:cterm01, "", "") 217 | call hi("Type", s:gui0A, "", s:cterm0A, "", "none", "") 218 | call hi("Typedef", s:gui0A, "", s:cterm0A, "", "", "") 219 | call hi("Noise", s:gui01, "", s:cterm01, "", "", "") 220 | 221 | " C highlighting 222 | call hi("cOperator", s:gui0C, "", s:cterm0C, "", "", "") 223 | call hi("cPreCondit", s:gui0E, "", s:cterm0E, "", "", "") 224 | 225 | " C# highlighting 226 | call hi("csClass", s:gui0A, "", s:cterm0A, "", "", "") 227 | call hi("csAttribute", s:gui0A, "", s:cterm0A, "", "", "") 228 | call hi("csModifier", s:gui0E, "", s:cterm0E, "", "", "") 229 | call hi("csType", s:gui08, "", s:cterm08, "", "", "") 230 | call hi("csUnspecifiedStatement", s:gui0D, "", s:cterm0D, "", "", "") 231 | call hi("csContextualStatement", s:gui0E, "", s:cterm0E, "", "", "") 232 | call hi("csNewDecleration", s:gui08, "", s:cterm08, "", "", "") 233 | 234 | " CSS highlighting 235 | call hi("cssBraces", s:gui01, "", s:cterm01, "", "", "") 236 | call hi("cssClassName", s:gui0E, "", s:cterm0E, "", "", "") 237 | call hi("cssColor", s:gui0C, "", s:cterm0C, "", "", "") 238 | 239 | " Diff highlighting 240 | call hi("DiffAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "") 241 | call hi("DiffChange", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") 242 | call hi("DiffDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "") 243 | call hi("DiffText", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "") 244 | call hi("DiffAdded", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "") 245 | call hi("DiffFile", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") 246 | call hi("DiffNewFile", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "") 247 | call hi("DiffLine", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "") 248 | call hi("DiffRemoved", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") 249 | 250 | " Git highlighting 251 | call hi("gitCommitOverflow", s:gui08, "", s:cterm08, "", "", "") 252 | " call hi("gitCommitSummary", s:gui0B, "", s:cterm0B, "", "", "") 253 | call hi("gitCommitSummary", s:gui05, "", s:cterm05, "none", "none", "") 254 | 255 | " GitGutter highlighting 256 | call hi("GitGutterAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "") 257 | call hi("GitGutterChange", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "") 258 | call hi("GitGutterDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "") 259 | call hi("GitGutterChangeDelete", s:gui0E, s:gui01, s:cterm0E, s:cterm01, "", "") 260 | 261 | " HTML highlighting 262 | call hi("htmlBold", s:gui0A, "", s:cterm0A, "", "", "") 263 | call hi("htmlItalic", s:gui0E, "", s:cterm0E, "", "", "") 264 | call hi("htmlEndTag", s:gui01, "", s:cterm01, "", "", "") 265 | call hi("htmlTag", s:gui01, "", s:cterm01, "", "", "") 266 | 267 | " JavaScript highlighting 268 | call hi("javaScript", s:gui05, "", s:cterm05, "", "", "") 269 | call hi("javaScriptBraces", s:gui05, "", s:cterm05, "", "", "") 270 | call hi("javaScriptNumber", s:gui09, "", s:cterm09, "", "", "") 271 | " pangloss/vim-javascript highlighting 272 | call hi("jsOperator", s:gui0D, "", s:cterm0D, "", "", "") 273 | call hi("jsStatement", s:gui0E, "", s:cterm0E, "", "", "") 274 | call hi("jsReturn", s:gui0E, "", s:cterm0E, "", "", "") 275 | call hi("jsThis", s:gui08, "", s:cterm08, "", "", "") 276 | call hi("jsClassDefinition", s:gui0A, "", s:cterm0A, "", "", "") 277 | call hi("jsFunction", s:gui0E, "", s:cterm0E, "", "", "") 278 | call hi("jsFuncName", s:gui0D, "", s:cterm0D, "", "", "") 279 | call hi("jsFuncCall", s:gui0D, "", s:cterm0D, "", "", "") 280 | call hi("jsClassFuncName", s:gui0D, "", s:cterm0D, "", "", "") 281 | call hi("jsClassMethodType", s:gui0E, "", s:cterm0E, "", "", "") 282 | call hi("jsRegexpString", s:gui0C, "", s:cterm0C, "", "", "") 283 | call hi("jsGlobalObjects", s:gui0A, "", s:cterm0A, "", "", "") 284 | call hi("jsGlobalNodeObjects", s:gui0A, "", s:cterm0A, "", "", "") 285 | call hi("jsExceptions", s:gui0A, "", s:cterm0A, "", "", "") 286 | call hi("jsBuiltins", s:gui0A, "", s:cterm0A, "", "", "") 287 | 288 | " Mail highlighting 289 | call hi("mailQuoted1", s:gui0A, "", s:cterm0A, "", "", "") 290 | call hi("mailQuoted2", s:gui0B, "", s:cterm0B, "", "", "") 291 | call hi("mailQuoted3", s:gui0E, "", s:cterm0E, "", "", "") 292 | call hi("mailQuoted4", s:gui0C, "", s:cterm0C, "", "", "") 293 | call hi("mailQuoted5", s:gui0D, "", s:cterm0D, "", "", "") 294 | call hi("mailQuoted6", s:gui0A, "", s:cterm0A, "", "", "") 295 | call hi("mailURL", s:gui0D, "", s:cterm0D, "", "", "") 296 | call hi("mailEmail", s:gui0D, "", s:cterm0D, "", "", "") 297 | 298 | " Markdown highlighting 299 | call hi("markdownCode", s:gui0B, "", s:cterm0B, "", "", "") 300 | call hi("markdownError", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "") 301 | call hi("markdownCodeBlock", s:gui0B, "", s:cterm0B, "", "", "") 302 | call hi("markdownHeadingDelimiter", s:gui0D, "", s:cterm0D, "", "", "") 303 | 304 | " NERDTree highlighting 305 | call hi("NERDTreeDirSlash", s:gui0D, "", s:cterm0D, "", "", "") 306 | call hi("NERDTreeExecFile", s:gui05, "", s:cterm05, "", "", "") 307 | 308 | " PHP highlighting 309 | call hi("phpMemberSelector", s:gui05, "", s:cterm05, "", "", "") 310 | call hi("phpComparison", s:gui05, "", s:cterm05, "", "", "") 311 | call hi("phpParent", s:gui05, "", s:cterm05, "", "", "") 312 | 313 | " Python highlighting 314 | call hi("pythonOperator", s:gui0E, "", s:cterm0E, "", "", "") 315 | call hi("pythonRepeat", s:gui0E, "", s:cterm0E, "", "", "") 316 | 317 | " Ruby highlighting 318 | call hi("rubyAttribute", s:gui0D, "", s:cterm0D, "", "", "") 319 | call hi("rubyConstant", s:gui0A, "", s:cterm0A, "", "", "") 320 | call hi("rubyInterpolation", s:gui0B, "", s:cterm0B, "", "", "") 321 | call hi("rubyInterpolationDelimiter", s:gui0F, "", s:cterm0F, "", "", "") 322 | call hi("rubyRegexp", s:gui0C, "", s:cterm0C, "", "", "") 323 | call hi("rubySymbol", s:gui0B, "", s:cterm0B, "", "", "") 324 | call hi("rubyStringDelimiter", s:gui0B, "", s:cterm0B, "", "", "") 325 | 326 | " SASS highlighting 327 | call hi("sassidChar", s:gui08, "", s:cterm08, "", "", "") 328 | call hi("sassClassChar", s:gui09, "", s:cterm09, "", "", "") 329 | call hi("sassInclude", s:gui0E, "", s:cterm0E, "", "", "") 330 | call hi("sassMixing", s:gui0E, "", s:cterm0E, "", "", "") 331 | call hi("sassMixinName", s:gui0D, "", s:cterm0D, "", "", "") 332 | 333 | " Signify highlighting 334 | call hi("SignifySignAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "") 335 | call hi("SignifySignChange", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "") 336 | call hi("SignifySignDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "") 337 | 338 | " Spelling highlighting 339 | call hi("SpellBad", "", s:gui00, "", s:cterm00, "undercurl", s:gui08) 340 | call hi("SpellLocal", "", s:gui00, "", s:cterm00, "undercurl", s:gui0C) 341 | call hi("SpellCap", "", s:gui00, "", s:cterm00, "undercurl", s:gui0D) 342 | call hi("SpellRare", "", s:gui00, "", s:cterm00, "undercurl", s:gui0E) 343 | 344 | " neovim terminal 345 | if has('nvim') 346 | hi! link TermCursor Cursor 347 | hi TermCursorNC ctermfg=241 ctermbg=29 guifg=s:gui02 guibg=s:gui0c guisp=NONE cterm=NONE gui=NONE 348 | let g:terminal_color_0 = "#" . s:gui07 349 | let g:terminal_color_1 = "#" . s:gui0F 350 | let g:terminal_color_2 = "#" . s:gui05 351 | let g:terminal_color_3 = "#" . s:gui03 352 | let g:terminal_color_4 = "#" . s:gui04 353 | let g:terminal_color_5 = "#" . s:gui02 354 | let g:terminal_color_6 = "#" . s:gui01 355 | let g:terminal_color_7 = "#" . s:gui00 356 | let g:terminal_color_8 = "#" . s:gui08 357 | let g:terminal_color_9 = "#" . s:gui09 358 | let g:terminal_color_10 = "#" . s:gui0A 359 | let g:terminal_color_11 = "#" . s:gui0B 360 | let g:terminal_color_12 = "#" . s:gui0C 361 | let g:terminal_color_13 = "#" . s:gui0D 362 | let g:terminal_color_14 = "#" . s:gui0E 363 | let g:terminal_color_15 = "#" . s:gui01 364 | endif 365 | 366 | " Remove functions 367 | delf hi 368 | delf gui 369 | delf cterm 370 | 371 | " Remove color variables 372 | unlet s:gui00 s:gui01 s:gui02 s:gui03 s:gui04 s:gui05 s:gui06 s:gui07 s:gui08 s:gui09 s:gui0A s:gui0B s:gui0C s:gui0D s:gui0E s:gui0F s:guiDWVF s:guiDWVB s:guiDWFG s:guiDWBG 373 | unlet s:cterm00 s:cterm01 s:cterm02 s:cterm03 s:cterm04 s:cterm05 s:cterm06 s:cterm07 s:cterm08 s:cterm09 s:cterm0A s:cterm0B s:cterm0C s:cterm0D s:cterm0E s:cterm0F 374 | 375 | -------------------------------------------------------------------------------- /colors/navajo-night.vim: -------------------------------------------------------------------------------- 1 | " Vim colour file 2 | " Maintainer: Matthew Hawkins 3 | " Last Change: Mon, 22 Apr 2002 15:28:04 +1000 4 | " URI: http://mh.dropbear.id.au/vim/navajo-night.png 5 | " 6 | " This colour scheme uses a "navajo-black" background 7 | " I have added colours for the statusbar and for spell checking 8 | " as taken from Cream (http://cream.sf.net/) 9 | 10 | 11 | set background=dark 12 | hi clear 13 | if exists("syntax_on") 14 | syntax reset 15 | endif 16 | 17 | let g:colors_name = "navajo-night" 18 | 19 | hi Normal ctermfg=White guifg=White guibg=#304c60 20 | " hi Normal ctermfg=White guifg=White guibg=#134371 21 | 22 | hi SpecialKey term=bold ctermfg=darkblue guifg=Yellow 23 | hi NonText term=bold ctermfg=darkblue cterm=bold gui=none guifg=#7f7f7f 24 | hi Directory term=bold ctermfg=darkblue guifg=Yellow 25 | hi ErrorMsg term=standout ctermfg=grey ctermbg=darkred cterm=bold gui=none guifg=Yellow guibg=Red 26 | hi IncSearch term=reverse cterm=reverse gui=reverse 27 | hi Search term=reverse ctermbg=White ctermfg=Black cterm=reverse guibg=Black guifg=Yellow 28 | hi MoreMsg term=bold ctermfg=green gui=none guifg=#d174a8 29 | hi ModeMsg term=bold cterm=bold gui=none 30 | hi LineNr term=underline ctermfg=darkcyan ctermbg=grey gui=none guifg=#5ad5d5 31 | hi Question term=standout ctermfg=darkgreen gui=none guifg=#d174a8 32 | hi StatusLine term=bold,reverse cterm=bold,reverse gui=none guifg=Black guibg=#e7e77f 33 | hi StatusLineNC term=reverse cterm=reverse gui=none guifg=#a1a1a1 guibg=Black 34 | hi VertSplit term=reverse cterm=reverse gui=none guifg=Black guibg=#8f8f8f 35 | hi Title term=bold ctermfg=green gui=none guifg=#74ff74 36 | hi PmenuSel term=bold,reverse cterm=bold,reverse gui=none guifg=#e7e77f guibg=Black 37 | hi Pmenu term=bold,reverse cterm=bold,reverse gui=none guifg=Black guibg=#e7e77f 38 | hi MoreMsg term=bold,reverse cterm=bold,reverse gui=none guifg=#ffff00 39 | 40 | "+++ Cream: 41 | "hi Visual term=reverse cterm=reverse gui=reverse guifg=#3f3f3f guibg=White 42 | "+++ 43 | hi VisualNOS term=bold,underline cterm=bold,underline gui=reverse guifg=#414141 guibg=Black 44 | hi WarningMsg term=standout ctermfg=darkred gui=none guifg=Cyan 45 | hi WildMenu term=standout ctermfg=White ctermbg=darkyellow guifg=White guibg=Blue 46 | hi Folded term=standout ctermfg=darkblue ctermbg=grey guifg=White guibg=NONE guifg=#afcfef 47 | hi FoldColumn term=standout ctermfg=darkblue ctermbg=grey guifg=#ffff74 guibg=#3f3f3f 48 | hi DiffAdd term=bold ctermbg=darkblue guibg=Black 49 | hi DiffChange term=bold ctermbg=darkmagenta guibg=#124a32 50 | hi DiffDelete term=bold ctermfg=darkblue ctermbg=blue cterm=bold gui=none guifg=#522719 guibg=#09172f 51 | hi DiffText term=reverse ctermbg=darkblue cterm=bold gui=none guibg=#007f9f 52 | hi Cursor gui=reverse guifg=#ffff00 guibg=black 53 | hi lCursor guifg=fg guibg=bg 54 | hi Match term=bold,reverse ctermbg=Blue ctermfg=Yellow cterm=bold,reverse gui=none,reverse guifg=Blue guibg=Yellow 55 | 56 | " Colours for syntax highlighting 57 | hi Comment term=bold ctermfg=darkblue guifg=#e7e77f 58 | hi Constant term=underline ctermfg=darkred guifg=#ffc213 59 | hi Special term=bold ctermfg=darkgreen guifg=#bfbfef 60 | hi Identifier term=underline ctermfg=darkcyan cterm=NONE guifg=#ef9f9f 61 | hi Statement term=bold ctermfg=darkred cterm=bold gui=none guifg=#5ad5d5 62 | hi PreProc term=underline ctermfg=darkmagenta guifg=#74ff74 63 | hi Type term=underline ctermfg=green gui=none guifg=#e194e8 64 | hi Ignore ctermfg=grey cterm=bold guifg=bg 65 | hi String term=none ctermfg=darkred guifg=#ff88aa 66 | 67 | hi Error term=reverse ctermfg=grey ctermbg=darkred cterm=bold gui=none guifg=Black guibg=Cyan 68 | hi Todo term=standout ctermfg=darkblue ctermbg=Blue guifg=Yellow guibg=Blue 69 | 70 | "+++ Cream: statusbar 71 | " Colours for statusbar 72 | "hi User1 gui=none guifg=#565656 guibg=#0c0c0c 73 | "hi User2 gui=none guifg=White guibg=#0c0c0c 74 | "hi User3 gui=none guifg=Yellow guibg=#0c0c0c 75 | "hi User4 gui=none guifg=Cyan guibg=#0c0c0c 76 | highlight User1 gui=none guifg=#999933 guibg=#45637f 77 | highlight User2 gui=none guifg=#e7e77f guibg=#45637f 78 | highlight User3 gui=none guifg=Black guibg=#45637f 79 | highlight User4 gui=none guifg=#33cc99 guibg=#45637f 80 | "+++ 81 | 82 | "+++ Cream: selection 83 | highlight Visual gui=none guifg=Black guibg=#aacc77 84 | "+++ 85 | 86 | "+++ Cream: bookmarks 87 | highlight Cream_ShowMarksHL ctermfg=blue ctermbg=lightblue cterm=bold guifg=Black guibg=#aacc77 gui=none 88 | "+++ 89 | 90 | "+++ Cream: spell check 91 | " Colour misspelt words 92 | "hi BadWord ctermfg=White ctermbg=darkred cterm=bold guifg=Yellow guibg=#522719 gui=none 93 | " mathematically correct: 94 | "highlight BadWord ctermfg=black ctermbg=lightblue gui=NONE guifg=White guibg=#003333 95 | " adjusted: 96 | highlight BadWord ctermfg=black ctermbg=lightblue gui=NONE guifg=#ff9999 guibg=#003333 97 | "+++ 98 | 99 | hi link MyTagListTitle Identifier 100 | hi MyTagListTagName guibg=#e7e77f guifg=Black 101 | hi link MyTagListComment Comment 102 | hi link MyTagListFileName Folded 103 | 104 | 105 | -------------------------------------------------------------------------------- /colors/tolerable.vim: -------------------------------------------------------------------------------- 1 | " Vim color file 2 | " Maintainer: Ian Langworth 3 | " Last Change: 2004 Dec 24 4 | " Email: 5 | 6 | " Color settings inspired by BBEdit for Mac OS, plus I liked 7 | " the low-contrast comments from the 'oceandeep' colorscheme 8 | 9 | set background=light 10 | hi clear 11 | if exists("syntax_on") 12 | syntax reset 13 | endif 14 | let g:colors_name="tolerable" 15 | 16 | hi Cursor guifg=white guibg=darkgreen 17 | 18 | hi Normal gui=none guifg=black guibg=white 19 | hi NonText gui=none guifg=orange guibg=white 20 | 21 | hi Statement gui=none guifg=blue 22 | hi Special gui=none guifg=red 23 | hi Constant gui=none guifg=darkred 24 | hi Comment gui=none guifg=#555555 25 | hi Preproc gui=none guifg=darkcyan 26 | hi Type gui=none guifg=darkmagenta 27 | hi Identifier gui=none guifg=darkgreen 28 | hi Title gui=none guifg=black 29 | 30 | hi StatusLine gui=none guibg=#333333 guifg=white 31 | hi StatusLineNC gui=none guibg=#333333 guifg=white 32 | hi VertSplit gui=none guibg=#333333 guifg=white 33 | 34 | hi Visual gui=none guibg=green guifg=black 35 | hi Search gui=none guibg=yellow 36 | hi Directory gui=none guifg=darkblue 37 | hi WarningMsg gui=none guifg=red 38 | hi Error gui=none guifg=white guibg=red 39 | hi Todo gui=none guifg=black guibg=yellow 40 | 41 | hi MoreMsg gui=none 42 | hi ModeMsg gui=none 43 | 44 | -------------------------------------------------------------------------------- /colors/xoria256.vim: -------------------------------------------------------------------------------- 1 | " Vim color file 2 | " 3 | " Name: xoria256.vim 4 | " Version: 1.1 5 | " Maintainer: Dmitriy Y. Zotikov (xio) 6 | " 7 | " Should work in recent 256 color terminals. 88-color terms like urxvt are 8 | " unsupported. 9 | " 10 | " Don't forget to install 'ncurses-term' and set TERM to xterm-256color or 11 | " similar value. 12 | " 13 | " Color numbers (0-255) see: 14 | " http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html 15 | 16 | 17 | 18 | " Bla-bla ---------------------------------------------------------------------- 19 | 20 | if &t_Co != 256 && ! has("gui_running") 21 | echomsg "" 22 | echomsg "err: please use GUI or a 256-color terminal (so that t_Co=256 could be set)" 23 | echomsg "" 24 | finish 25 | endif 26 | 27 | set background=dark 28 | 29 | hi clear 30 | 31 | if exists("syntax_on") 32 | syntax reset 33 | endif 34 | 35 | let colors_name = "xoria256" 36 | 37 | 38 | 39 | " The real part ---------------------------------------------------------------- 40 | 41 | "" General colors 42 | hi Normal ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none 43 | hi CursorColumn ctermbg=238 guibg=#444444 44 | hi Cursor ctermbg=214 guibg=#ffaf00 45 | hi CursorLine ctermbg=238 guibg=#444444 46 | hi FoldColumn ctermfg=248 guifg=#a8a8a8 ctermbg=bg guibg=bg 47 | hi Folded ctermfg=255 guifg=#afafdf ctermbg=60 guibg=#1c1c1c 48 | hi IncSearch ctermfg=0 guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none 49 | hi NonText ctermfg=248 guifg=#a8a8a8 cterm=bold gui=bold 50 | hi Pmenu ctermfg=0 guifg=#000000 ctermbg=246 guibg=#949494 51 | hi PmenuSbar ctermbg=243 guibg=#767676 52 | hi PmenuSel ctermfg=0 guifg=#000000 ctermbg=243 guibg=#767676 53 | hi PmenuThumb ctermbg=252 guibg=#d0d0d0 54 | hi Search ctermfg=0 guifg=#ffffff ctermbg=149 guibg=#577faf gui=bold 55 | hi SignColumn ctermfg=248 guifg=#a8a8a8 56 | hi SpecialKey ctermfg=77 guifg=#5fdf5f 57 | hi StatusLine guifg=#000000 ctermbg=239 guibg=#afdf87 cterm=bold gui=bold 58 | hi StatusLineNC ctermbg=237 guibg=#3a3a3a cterm=none gui=none 59 | hi TabLine ctermfg=fg guifg=fg ctermbg=242 guibg=#666666 cterm=underline gui=underline 60 | hi TabLineFill ctermfg=fg guifg=fg ctermbg=242 guibg=#666666 cterm=underline gui=underline 61 | hi VertSplit ctermfg=237 guifg=#3a3a3a ctermbg=237 guibg=#3a3a3a cterm=none gui=none 62 | hi Visual ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff 63 | hi VIsualNOS ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff cterm=none gui=none 64 | hi WildMenu ctermfg=0 guifg=#000000 ctermbg=184 guibg=#dfdf00 cterm=bold gui=bold 65 | 66 | "" Syntax highlighting 67 | hi Comment ctermfg=244 guifg=#808080 68 | hi Constant ctermfg=229 guifg=#ffffaf 69 | hi Error ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000 70 | hi ErrorMsg ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000 71 | hi Identifier ctermfg=182 guifg=#dfafdf cterm=none 72 | "hi Ignore ctermfg=238 guifg=#444444 73 | hi LineNr ctermfg=248 guifg=#a8a8a8 74 | hi MatchParen ctermfg=188 guifg=#dfdfdf ctermbg=68 guibg=#5f87df cterm=bold gui=bold 75 | hi Number ctermfg=180 guifg=#dfaf87 76 | hi PreProc ctermfg=150 guifg=#afdf87 77 | hi Special ctermfg=174 guifg=#df8787 78 | hi Statement ctermfg=110 guifg=#87afdf cterm=none gui=none 79 | hi Todo ctermfg=0 guifg=#000000 ctermbg=184 guibg=#dfdf00 80 | hi Type ctermfg=146 guifg=#afafdf cterm=none gui=none 81 | hi Underlined ctermfg=39 guifg=#00afff cterm=underline gui=underline 82 | 83 | "" Special 84 | """ .diff 85 | hi diffAdded ctermfg=150 guifg=#afdf87 86 | hi diffRemoved ctermfg=174 guifg=#df8787 87 | """ vimdiff 88 | hi diffAdd ctermfg=bg guifg=bg ctermbg=151 guibg=#afdfaf 89 | "hi diffDelete ctermfg=bg guifg=bg ctermbg=186 guibg=#dfdf87 cterm=none gui=none 90 | hi diffDelete ctermfg=bg guifg=bg ctermbg=246 guibg=#949494 cterm=none gui=none 91 | hi diffChange ctermfg=bg guifg=bg ctermbg=181 guibg=#dfafaf 92 | hi diffText ctermfg=bg guifg=bg ctermbg=174 guibg=#df8787 cterm=none gui=none 93 | 94 | " vim: set expandtab tabstop=2 shiftwidth=2 smarttab softtabstop=2: 95 | -------------------------------------------------------------------------------- /data/vimside/.gitignore: -------------------------------------------------------------------------------- 1 | ENSIME_LOG 2 | VIMSIDE_LOG 3 | -------------------------------------------------------------------------------- /data/vimside/ensime_config.vim: -------------------------------------------------------------------------------- 1 | 2 | " full path to this file 3 | let s:full_path=expand(':p') 4 | " full path to this file's directory 5 | let s:full_dir=fnamemodify(s:full_path, ':h') 6 | " file name 7 | let s:file_name=fnamemodify(s:full_path, ':t') 8 | 9 | let s:scala_home = '/usr/local/scala' 10 | if s:scala_home == '' 11 | throw "SCALA_HOME not set in file " . s:full_path 12 | endif 13 | let s:java_home = '/usr/local/jdk' 14 | if s:java_home == '' 15 | throw "JAVA_HOME not set in file " . s:full_path 16 | endif 17 | 18 | let compile_jars = g:SExp( 19 | \ g:Str(s:full_dir . "/build/classes") 20 | \ ) 21 | let source_roots = g:SExp( 22 | \ g:Str(s:full_dir . "/src/main/java"), 23 | \ g:Str(s:full_dir . "/src/main/scala") 24 | \ ) 25 | let reference_source_roots = g:SExp( 26 | \ g:Str(s:java_home . "/src"), 27 | \ g:Str(s:scala_home . "/src") 28 | \ ) 29 | let include_index = g:SExp( 30 | \ g:Str('com\\.megaannum\\.\*') 31 | \ ) 32 | let exclude_index = g:SExp( 33 | \ g:Str('com\\.megaannum\\.core\\.xmlconfig\\.compiler\\*') 34 | \ ) 35 | let compiler_args = g:SExp( 36 | \ g:Str("-Ywarn-dead-code") 37 | \ ) 38 | 39 | " :alignSingleLineCaseStatements_maxArrowIndent 20 40 | let formatting_prefs = g:SExp( 41 | \ Key(":alignParameters"), g:Bool(1), 42 | \ Key(":alignSingleLineCaseStatements"), g:Bool(0), 43 | \ Key(":compactStringConcatenation"), g:Bool(1), 44 | \ Key(":compactControlReadability"), g:Bool(1), 45 | \ Key(":doubleIndentClassDeclaration"), g:Bool(1), 46 | \ Key(":indentLocalDefs"), g:Bool(0), 47 | \ Key(":indentPackageBlocks"), g:Bool(0), 48 | \ Key(":indentSpaces"), g:Int(2), 49 | \ Key(":indentWithTabs"), g:Bool(0), 50 | \ Key(":multilineScaladocCommentsStartOnFirstLine"), g:Bool(0) 51 | \ ) 52 | 53 | call vimside#sexp#AddTo_List(formatting_prefs, 54 | \ Key(":placeScaladocAsterisksBeneathSecondAsterisk"), g:Bool(0), 55 | \ Key(":preserveDanglingCloseParenthesis"), g:Bool(1), 56 | \ Key(":preserveSpaceBeforeArguments"), g:Bool(0), 57 | \ Key(":rewriteArrowSymbols"), g:Bool(0), 58 | \ Key(":spaceBeforeColon"), g:Bool(0), 59 | \ Key(":spaceInsideBrackets"), g:Bool(0), 60 | \ Key(":spaceInsideParentheses"), g:Bool(0), 61 | \ Key(":spacesWithinPatternBinders"), g:Bool(1) 62 | \ ) 63 | 64 | let g:ensime_config = g:SExp([ 65 | \ Key(":root-dir"), g:Str(s:full_dir), 66 | \ Key(":name"), g:Str("test"), 67 | \ Key(":package"), g:Str("com.megaannum"), 68 | \ Key(":version"), g:Str("1.0"), 69 | \ Key(":compile-jars"), compile_jars, 70 | \ Key(":compiler-args"), compiler_args, 71 | \ Key(":disable-index-on-startup"), g:Bool(0), 72 | \ Key(":source-roots"), source_roots, 73 | \ Key(":reference-source-roots"), reference_source_roots, 74 | \ Key(":target"), g:Str(s:full_dir . "/build/classes"), 75 | \ Key(":only-include-in-index"), include_index, 76 | \ Key(":exclude-from-index"), exclude_index, 77 | \ Key(":formatting-prefs"), formatting_prefs 78 | \ ] ) 79 | 80 | -------------------------------------------------------------------------------- /data/vimside/options_user.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================ 2 | " This file, example_options_user.vim will NOT be read by the Vimside 3 | " code. 4 | " To adjust option values, copy this file to 'options_user.vim' and 5 | " then make changes. 6 | " ============================================================================ 7 | 8 | " full path to this file 9 | let s:full_path=expand(':p') 10 | 11 | " full path to this file's directory 12 | let s:full_dir=fnamemodify(s:full_path, ':h') 13 | 14 | function! g:VimsideOptionsUserLoad(owner) 15 | let owner = a:owner 16 | 17 | "-------------- 18 | " Enable logging 19 | call owner.Set("ensime-log-enabled", 1) 20 | call owner.Set("vimside-log-enabled", 1) 21 | "-------------- 22 | 23 | "-------------- 24 | " Output logs and ensime port file to local dir 25 | " If you start Vim is some project sub-directory, this will place 26 | " things in that directory (which may not be what you want). 27 | " call owner.Set("vimside-use-cwd-as-output-dir", 0) 28 | "-------------- 29 | 30 | "-------------- 31 | " Also load project specific options 32 | " call owner.Set("vimside-project-options-enabled", 1) 33 | " call owner.Set("vimside-project-options-file-name", "options_project.vim") 34 | "-------------- 35 | 36 | "-------------- 37 | " Defined Java versions: '1.5', '1.6', '1.7' 38 | " Defined Scala versions: '2.9.2', '2.10.0' 39 | " Minor version numbers not needed 40 | " Scala version MUST match 'ensime-dist-dir' used. 41 | call owner.Set("vimside-java-version", '1.6') 42 | call owner.Set("vimside-scala-version", '2.10.0') 43 | "-------------- 44 | 45 | "-------------- 46 | " Where is Ensime installed 47 | call owner.Set("ensime-install-path", $HOME . "/.vim/bundle/ensime") 48 | " call owner.Set("ensime-install-path", $HOME . "/vimfiles/vim-addons/ensime") 49 | 50 | " Which build version of Ensime to use. 51 | " Must be directory under 'ensime-install-path' directory 52 | " call owner.Set("ensime-dist-dir", "ensime_2.9.2-0.9.8.1") 53 | call owner.Set("ensime-dist-dir", "ensime_2.10.0-SNAPSHOT-0.9.7") 54 | 55 | " Or, full path to Ensime build version 56 | " call owner.Set("ensime-dist-path", "SOME_PATH_TO_ENSIME_BUILD_DIR") 57 | "-------------- 58 | 59 | 60 | "-------------- 61 | " To run against ensime test project code 62 | " Location of test directory 63 | call owner.Set("test-ensime-file-dir", s:full_dir) 64 | " Uncomment to run against demonstration test code 65 | call owner.Set("test-ensime-file-use", 1) 66 | " The Ensime Config information is in a file called 'ensime_config.vim' 67 | call owner.Set("ensime-config-file-name", "ensime_config.vim") 68 | "-------------- 69 | 70 | "-------------- 71 | " To run against one of your own projects 72 | " The Ensime Config information is in a file called '_ensime' 73 | " Emacs Ensime calls the file '.ensime' - you can call it 74 | " whatever you want as long as you set its name here. 75 | " call owner.Set("ensime-config-file-name", "_ensime") 76 | "-------------- 77 | 78 | "-------------- 79 | " Vimside uses Forms library 80 | call owner.Set("forms-use", 1) 81 | "-------------- 82 | 83 | "-------------- 84 | " Open source brower in its own tab 85 | " call owner.Set("tailor-forms-sourcebrowser-open-in-tab", 1) 86 | "-------------- 87 | 88 | "-------------- 89 | " Hover Options 90 | call owner.Set("vimside-hover-balloon-enabled", 0) 91 | call owner.Set("vimside-hover-term-balloon-enabled", 0) 92 | " call owner.Set("tailor-hover-term-balloon-fg", "red") 93 | " call owner.Set("tailor-hover-term-balloon-bg", "white") 94 | " 95 | " The following Hover Options should normally not be changed 96 | " call owner.Set("tailor-hover-updatetime", 600) 97 | " one character and hover move triggered 98 | " call owner.Set("tailor-hover-max-char-mcounter", 0) 99 | " call owner.Set("tailor-hover-cmdline-job-time", 300) 100 | " call owner.Set("tailor-hover-term-job-time", 300) 101 | "-------------- 102 | 103 | 104 | "-------------- 105 | " Selection using 'highlight' or 'visual' 106 | " call owner.Set("tailor-expand-selection-information", 'visual') 107 | "-------------- 108 | 109 | "-------------- 110 | " Search options 111 | " call owner.Set("tailor-symbol-search-do-incremental", 0) 112 | " call owner.Set("tailor-symbol-search-close-empty-display", 1) 113 | "-------------- 114 | 115 | "-------------- 116 | " Re-order which unix browser command to try first 117 | " call owner.Set("tailor-browser-unix-commands", ['firefox', 'xdg-open', 'opera']) 118 | "-------------- 119 | 120 | "-------------- 121 | " Typecheck file on write 122 | " call owner.Set('tailor-type-check-file-on-write', 0) 123 | "-------------- 124 | 125 | "-------------- 126 | " Refactor rename, extract local and extract metod 127 | " call owner.Set('tailor-refactor-rename-pattern-enable', 1) 128 | " call owner.Set('tailor-refactor-rename-pattern', '[^ =:;()[\]]\+') 129 | " call owner.Set('tailor-refactor-extract-local-pattern-enable', 1) 130 | " call owner.Set('tailor-refactor-extract-local-pattern', '[^ =:;()[\]]\+') 131 | " call owner.Set('tailor-refactor-extract-method-pattern-enable', 1) 132 | " call owner.Set('tailor-refactor-extract-method-pattern', '[^ =:;()[\]]\+') 133 | "-------------- 134 | 135 | 136 | " call owner.Set("tailor-symbol-at-point-location-same-file", "same_window.vim") 137 | " call owner.Set("tailor-symbol-at-point-location-same-file", "split_window.vim") 138 | " call owner.Set("tailor-symbol-at-point-location-same-file", "vsplit_window.vim") 139 | 140 | " call owner.Set("tailor-symbol-at-point-location-diff-file", "same_window.vim") 141 | " call owner.Set("tailor-symbol-at-point-location-diff-file", "split_window.vim") 142 | " call owner.Set("tailor-symbol-at-point-location-diff-file", "vsplit_window.vim") 143 | " call owner.Set("tailor-symbol-at-point-location-diff-file", "tab") 144 | 145 | 146 | " call owner.Set("tailor-uses-of-symbol-at-point-location", "same_window") 147 | " call owner.Set("tailor-uses-of-symbol-at-point-location", "split_window") 148 | " call owner.Set("tailor-uses-of-symbol-at-point-location", "vsplit_window") 149 | " call owner.Set("tailor-uses-of-symbol-at-point-location", "tab") 150 | 151 | " call owner.Set("tailor-repl-config-location", "same_window") 152 | " call owner.Set("tailor-repl-config-location", "split_window") 153 | " call owner.Set("tailor-repl-config-location", "vsplit_window") 154 | " call owner.Set("tailor-repl-config-location", "tab") 155 | endfunction 156 | 157 | -------------------------------------------------------------------------------- /ftdetect/gradle.vim: -------------------------------------------------------------------------------- 1 | au BufRead,BufNewFile *.gradle set filetype=groovy 2 | -------------------------------------------------------------------------------- /ftdetect/tex.vim: -------------------------------------------------------------------------------- 1 | au BufRead,BufNewFile *.tex set filetype=tex 2 | -------------------------------------------------------------------------------- /ftplugin/cpp.vim: -------------------------------------------------------------------------------- 1 | let b:c_no_curly_error = 1 2 | -------------------------------------------------------------------------------- /ftplugin/java.vim: -------------------------------------------------------------------------------- 1 | setlocal formatoptions=crq 2 | setlocal textwidth=80 3 | setlocal foldmethod=marker 4 | setlocal foldmarker=//{,//} 5 | setlocal foldlevel=0 6 | setlocal sw=4 sts=4 ts=4 7 | setlocal noexpandtab 8 | 9 | if !exists("*s:CodeOrTestFile") 10 | function! s:CodeOrTestFile(precmd) 11 | let current = expand('%:p') 12 | let other = current 13 | if current =~ "/src/main/.*/\%(blogs|news\)/" 14 | let other = substitute(current, "/main/", "/test/", "") 15 | let other = substitute(other, "/blogs/", "/tests/", "") 16 | let other = substitute(other, "/news/", "/tests/", "") 17 | let other = substitute(other, ".java$", "Test.java", "") 18 | elseif current =~ "/src/test/.*/actions/tests/" 19 | let other = substitute(current, "/test/", "/main/", "") 20 | let other = substitute(other, "/tests/", "/blogs/", "") 21 | let other = substitute(other, "Test.java$", ".java", "") 22 | elseif current =~ "/src/main/" 23 | let other = substitute(current, "/main/", "/test/", "") 24 | let other = substitute(other, ".java$", "Test.java", "") 25 | elseif current =~ "/src/test/" 26 | let other = substitute(current, "/test/", "/main/", "") 27 | let other = substitute(other, "Test.java$", ".java", "") 28 | endif 29 | if &switchbuf =~ "^use" 30 | let i = 1 31 | let bufnum = winbufnr(i) 32 | while bufnum != -1 33 | let filename = fnamemodify(bufname(bufnum), ':p') 34 | if filename == other 35 | execute ":sbuffer " . filename 36 | return 37 | endif 38 | let i += 1 39 | let bufnum = winbufnr(i) 40 | endwhile 41 | endif 42 | if other != '' 43 | if strlen(a:precmd) != 0 44 | execute a:precmd 45 | endif 46 | execute 'edit ' . fnameescape(other) 47 | else 48 | echoerr "Alternate has evaluated to nothing." 49 | endif 50 | endfunction 51 | endif 52 | 53 | com! -buffer JavaSwitchHere :call s:CodeOrTestFile('') 54 | com! -buffer JavaSwitchRight :call s:CodeOrTestFile('wincmd l') 55 | com! -buffer JavaSwitchSplitRight :call s:CodeOrTestFile('let b:curspr=&spr | set nospr | vsplit | wincmd l | if b:curspr | set spr | endif | unlet b:curspr') 56 | com! -buffer JavaSwitchLeft :call s:CodeOrTestFile('wincmd h') 57 | com! -buffer JavaSwitchSplitLeft :call s:CodeOrTestFile('let b:curspr=&spr | set nospr | vsplit | wincmd h | if b:curspr | set spr | endif | unlet b:curspr') 58 | com! -buffer JavaSwitchAbove :call s:CodeOrTestFile('wincmd k') 59 | com! -buffer JavaSwitchSplitAbove :call s:CodeOrTestFile('let b:cursb=&sb | set nosb | split | wincmd k | if b:cursb | set sb | endif | unlet b:cursb') 60 | com! -buffer JavaSwitchBelow :call s:CodeOrTestFile('wincmd j') 61 | com! -buffer JavaSwitchSplitBelow :call s:CodeOrTestFile('let b:cursb=&sb | set nosb | split | wincmd j | if b:cursb | set sb | endif | unlet b:cursb') 62 | 63 | nmap ,of :JavaSwitchHere 64 | nmap ,ol :JavaSwitchRight 65 | nmap ,oL :JavaSwitchSplitRight 66 | nmap ,oh :JavaSwitchLeft 67 | nmap ,oH :JavaSwitchSplitLeft 68 | nmap ,ok :JavaSwitchAbove 69 | nmap ,oK :JavaSwitchSplitAbove 70 | nmap ,oj :JavaSwitchBelow 71 | nmap ,oJ :JavaSwitchSplitBelow 72 | 73 | function! JavaUnhangBraces() 74 | :%s/) {/)\r{\s*$/eg 75 | :%s/try\zs {/\r{\s*$/eg 76 | :%s/else\zs {/\r{\s*$/eg 77 | :%s/throws.*\zs {\s*$/\r{/eg 78 | :%s/}\zs\s\+\zeelse/\r/eg 79 | :%s/}\zs\s\+\zecatch/\r/eg 80 | :%s/\%(class\|interface\|enum\).*\zs {\s*$/\r{/eg 81 | :%s/class.*\zs\s*{$/\r{/eg 82 | :g/^\%({\|else\|catch\)/normal == 83 | endfunction 84 | 85 | function! JavaHangBraces() 86 | :g/^\s*{/-join 87 | :g/^\s*\%(catch\|else\)/-join 88 | endfunction 89 | -------------------------------------------------------------------------------- /ftplugin/markdown.vim: -------------------------------------------------------------------------------- 1 | setlocal tw=0 2 | imap jw :wa 3 | -------------------------------------------------------------------------------- /ftplugin/ruby.vim: -------------------------------------------------------------------------------- 1 | setlocal norelativenumber 2 | setlocal ts=2 sts=2 sw=2 3 | -------------------------------------------------------------------------------- /ftplugin/scala.vim: -------------------------------------------------------------------------------- 1 | setlocal formatoptions=crq 2 | setlocal textwidth=100 3 | setlocal foldmethod=marker 4 | setlocal foldmarker=//{,//} 5 | setlocal foldlevel=0 6 | setlocal ts=2 sts=2 sw=2 7 | setlocal expandtab 8 | 9 | "----------------------------------------------------------------------------- 10 | " SBT Quickfix settings 11 | "----------------------------------------------------------------------------- 12 | let g:quickfix_load_mapping = ",qf" 13 | let g:quickfix_next_mapping = ",qn" 14 | 15 | "----------------------------------------------------------------------------- 16 | " Transforming from ⇒and ←to => and <- and back again 17 | "----------------------------------------------------------------------------- 18 | function! scala#UnicodeCharsToNiceChars() 19 | let view = winsaveview() 20 | norm!mz 21 | try 22 | undojoin 23 | catch /undojoin/ 24 | endtry 25 | v/^\s*\*/s/⇒/=>/eg 26 | v/^\s*\*/s/←/<-/eg 27 | norm!`z 28 | call winrestview(view) 29 | endfunction 30 | 31 | function! scala#NiceCharsToUnicodeChars() 32 | let view = winsaveview() 33 | norm!mz 34 | try 35 | undojoin 36 | catch /undojoin/ 37 | endtry 38 | v/^\s*\*/s/=>/⇒/eg 39 | v/^\s*\*/s/<-/←/eg 40 | norm!`z 41 | call winrestview(view) 42 | endfunction 43 | 44 | map ,SU :call scala#NiceCharsToUnicodeChars() 45 | map ,SA :call scala#UnicodeCharsToNiceChars() 46 | 47 | function! ScalaImportFromTag(tag) 48 | let tags = taglist(a:tag) 49 | let import = '' 50 | for t in tags 51 | let pack = substitute(system('grep ^package ' . t['filename'] . ' | head | cut -f2 -d" "'), '\n\+$', '', '') 52 | if pack != '' 53 | let import = 'import ' . pack . '.' . a:tag 54 | break 55 | endif 56 | endfor 57 | 58 | if import != '' 59 | normal mz 60 | execute ':/package/+ normal o' . import 61 | call SortScalaImports() 62 | normal `z 63 | else 64 | echoerr 'Unable to find proper import for ' . a:tag 65 | endif 66 | endfunction 67 | 68 | nmap ,it :call ScalaImportFromTag(expand("")) 69 | 70 | "----------------------------------------------------------------------------- 71 | " Transitioning between test files and source files 72 | "----------------------------------------------------------------------------- 73 | if !exists("*s:CodeOrTestFile") 74 | function! s:CodeOrTestFile(precmd) 75 | let current = expand('%:p') 76 | let other = current 77 | let specExt = "Spec.scala" 78 | if current =~ "/npl/" 79 | let specExt = "Test.scala" 80 | endif 81 | if current =~ "/src/main/" 82 | let other = substitute(current, "/main/", "/it/", "") 83 | let other = substitute(other, ".scala$", specExt, "") 84 | if !filereadable(other) 85 | let other = substitute(current, "/main/", "/test/", "") 86 | let other = substitute(other, ".scala$", specExt, "") 87 | endif 88 | elseif current =~ "/src/test/" 89 | let other = substitute(current, "/test/", "/main/", "") 90 | let other = substitute(other, specExt . "$", ".scala", "") 91 | elseif current =~ "/src/it/" 92 | let other = substitute(current, "/it/", "/main/", "") 93 | let other = substitute(other, specExt . "$", ".scala", "") 94 | elseif current =~ "/app/model/" 95 | let other = substitute(current, "/app/model/", "/test/", "") 96 | let other = substitute(other, ".scala$", specExt, "") 97 | elseif current =~ "/app/controllers/" 98 | let other = substitute(current, "/app/", "/test/scala/", "") 99 | let other = substitute(other, ".scala$", specExt, "") 100 | elseif current =~ "/test/scala/controllers/" 101 | let other = substitute(current, "/test/scala/", "/app/", "") 102 | let other = substitute(other, specExt . "$", ".scala", "") 103 | elseif current =~ "/test/" 104 | let other = substitute(current, "/test/", "/app/model/", "") 105 | let other = substitute(other, specExt . "$", ".scala", "") 106 | endif 107 | if &switchbuf =~ "^use" 108 | let i = 1 109 | let bufnum = winbufnr(i) 110 | while bufnum != -1 111 | let filename = fnamemodify(bufname(bufnum), ':p') 112 | if filename == other 113 | execute ":sbuffer " . filename 114 | return 115 | endif 116 | let i += 1 117 | let bufnum = winbufnr(i) 118 | endwhile 119 | endif 120 | if other != '' 121 | if strlen(a:precmd) != 0 122 | execute a:precmd 123 | endif 124 | execute 'edit ' . fnameescape(other) 125 | else 126 | echoerr "Alternate has evaluated to nothing." 127 | endif 128 | endfunction 129 | endif 130 | 131 | com! -buffer ScalaSwitchHere :call s:CodeOrTestFile('') 132 | com! -buffer ScalaSwitchRight :call s:CodeOrTestFile('wincmd l') 133 | com! -buffer ScalaSwitchSplitRight :call s:CodeOrTestFile('let b:curspr=&spr | set nospr | vsplit | wincmd l | if b:curspr | set spr | endif | unlet b:curspr') 134 | com! -buffer ScalaSwitchLeft :call s:CodeOrTestFile('wincmd h') 135 | com! -buffer ScalaSwitchSplitLeft :call s:CodeOrTestFile('let b:curspr=&spr | set nospr | vsplit | wincmd h | if b:curspr | set spr | endif | unlet b:curspr') 136 | com! -buffer ScalaSwitchAbove :call s:CodeOrTestFile('wincmd k') 137 | com! -buffer ScalaSwitchSplitAbove :call s:CodeOrTestFile('let b:cursb=&sb | set nosb | split | wincmd k | if b:cursb | set sb | endif | unlet b:cursb') 138 | com! -buffer ScalaSwitchBelow :call s:CodeOrTestFile('wincmd j') 139 | com! -buffer ScalaSwitchSplitBelow :call s:CodeOrTestFile('let b:cursb=&sb | set nosb | split | wincmd j | if b:cursb | set sb | endif | unlet b:cursb') 140 | 141 | nmap ,of :ScalaSwitchHere 142 | nmap ,ol :ScalaSwitchRight 143 | nmap ,oL :ScalaSwitchSplitRight 144 | nmap ,oh :ScalaSwitchLeft 145 | nmap ,oH :ScalaSwitchSplitLeft 146 | nmap ,ok :ScalaSwitchAbove 147 | nmap ,oK :ScalaSwitchSplitAbove 148 | nmap ,oj :ScalaSwitchBelow 149 | nmap ,oJ :ScalaSwitchSplitBelow 150 | 151 | function! ExternalScalariform() 152 | if &readonly == 1 153 | echomsg "Current buffer is read-only. Can't Scalariform it." 154 | else 155 | :normal mm 156 | :%!/webdev/Tools/lazy/bin/scalariform --stdin 157 | :normal `m 158 | endif 159 | endfunction 160 | 161 | com! -buffer Scalariform :call ExternalScalariform() 162 | nmap ,sf :Scalariform 163 | -------------------------------------------------------------------------------- /ftplugin/tex.vim: -------------------------------------------------------------------------------- 1 | " this is mostly a matter of taste. but LaTeX looks good with just a bit 2 | " of indentation. 3 | setlocal sw=2 4 | setlocal tw=100 5 | setlocal spell 6 | setlocal fdl=0 7 | setlocal fdm=marker 8 | setlocal fmr=<<<,>>> 9 | setlocal thesaurus=~/.vim/thesaurus/thesaurus-en-short.txt 10 | 11 | imap jj :w 12 | imap jw :w 13 | imap ;;; \\ldots 14 | 15 | let g:tex_isk="48-57,a-z,A-Z,192-255,_" 16 | -------------------------------------------------------------------------------- /spell/en.utf-8.add: -------------------------------------------------------------------------------- 1 | Akka 2 | SBT 3 | Heisenbugs 4 | EventBus 5 | ActorSystem 6 | akka 7 | testkit 8 | ActorRefs 9 | programmatically 10 | DeathWatch 11 | TODO 12 | Stateful 13 | app's 14 | unbecome 15 | FSM 16 | proxying 17 | #nifinitum 18 | HashedWheelTimer 19 | scheduleOnce 20 | AntiPatterns 21 | idempotency 22 | remoting 23 | App 24 | Akka's 25 | MicroKernel 26 | API 27 | UntypedActor 28 | UntypedActorFactory 29 | ActorRef 30 | deconstruct 31 | OO 32 | JVM 33 | InfoQ 34 | scala 35 | composability 36 | app 37 | STM 38 | Changelog 39 | livelocks 40 | apps 41 | sbt 42 | stateful 43 | UAP 44 | refactor 45 | screencasts 46 | snuck 47 | Dataflow 48 | Adamantium 49 | ScalaTest 50 | mixin 51 | ImplicitSender 52 | TestKit 53 | testActor 54 | EventSource 55 | expectMsg 56 | sendEvent 57 | TestEventSource 58 | ActorSystems 59 | actorOf 60 | ActorLogging 61 | ParallelTestExecution 62 | ScalaTest's 63 | InvalidActorNameException 64 | something's 65 | EventSourceSpy 66 | CountDownLatch 67 | eventSourceReceive 68 | CountDown 69 | ActorSys 70 | fishForMessage 71 | ScalaDoc 72 | ignoreMsg 73 | expectMsgPF 74 | AltimeterSpec 75 | receiveWhile 76 | AltitudeUpdates 77 | TestActorRef 78 | AttendantResponsiveness 79 | FlightAttendant 80 | maxResponseTimeMS 81 | ActorContext 82 | CoPilot 83 | LeadFlightAttendant 84 | PilotProvider 85 | Iterable 86 | actorFor 87 | ActorPath 88 | ControlSurfaces 89 | doesNotExist 90 | ActorContexts 91 | ActorCell 92 | NoDatabaseConnectionException 93 | AllForOneStrategy 94 | SupervisorStrategy 95 | OneForOneStrategy 96 | ActorKilledException 97 | ActorInitializationFailedException 98 | ActorContext's 99 | unwatch 100 | MyActor's 101 | preRestart 102 | MyActor 103 | preStart 104 | IsolatedLifeCycle 105 | IsolatedLifeCycleSupervisor 106 | postRestart 107 | supervisorStrategy 108 | FlightAttendants 109 | ActorInitializationException 110 | OneForOneStrategyFactory 111 | IsolatedResumeSupervisor 112 | startControls 113 | childStarter 114 | IsolatedStopSupervisor 115 | startPeople 116 | GiveMeControl 117 | CoPilots 118 | AutoPilot 119 | newPilot 120 | refactorings 121 | WebSocket 122 | ArithmeticException 123 | rateOfClimb 124 | altitudeCalculator 125 | ReadyToGo 126 | IsolatedLifeCycleSupervisor's 127 | AutoPilot's 128 | CoPilot's 129 | ActorSystem's 130 | commitData 131 | transactionId 132 | pendingCommit 133 | databaseOffline 134 | databaseOnline 135 | coffeeType 136 | DrinkingBehaviour 137 | standardBehaviour 138 | deserialize 139 | FlyingBehaviour 140 | FlightData 141 | bankCalc 142 | elevCalc 143 | DrinkingResolution 144 | FeelingSober 145 | etc 146 | WeatherBehaviour 147 | HeadingIndicator 148 | onTransition 149 | whenUnhandled 150 | unhandled 151 | orElse 152 | flyingStateHandler 153 | FSMs 154 | TestFSMRef 155 | PreparingToFly 156 | routees 157 | routee 158 | UnfastenSeatbelts 159 | FastenSeatbelts 160 | TestProbe 161 | callButton 162 | TestProbes 163 | TestProbe's 164 | BroadcastRouter 165 | PassengerSupervisor 166 | IsolatedStopSupervisor's 167 | PassengerSupervisor's 168 | RandomRouter 169 | substitutibility 170 | Tuple2 171 | #eralizer 172 | deserializer 173 | serializers 174 | deserializers 175 | serializer 176 | deserialization 177 | config 178 | serializable 179 | sendOff 180 | alterOff 181 | flatMap 182 | foreach 183 | TelnetServer 184 | Iteratees 185 | Iteratee 186 | Adlana 187 | Marisette 188 | Lachion 189 | Arrad 190 | Valgranoth 191 | Cambion 192 | Substories 193 | Kerym 194 | Fariq 195 | Keshlam 196 | Marrisette 197 | Marvule 198 | Keshlam's 199 | Thunderhammer 200 | Lizzanna 201 | Liara 202 | Merriweather 203 | Grubblyplan 204 | Alanis 205 | Lakesong 206 | hitpoints 207 | Athelon 208 | Koshella 209 | Marceline 210 | Ulraag 211 | Kilgrade 212 | Grubblyplank 213 | Athelonians 214 | sodalite 215 | Gaelin 216 | lay 217 | Gaelin's 218 | Vaxelor 219 | Thau 220 | Thau's 221 | transmutative 222 | Malek 223 | Dwarvish 224 | Baylen 225 | Foristole 226 | Chronos 227 | Ashlita's 228 | MetalWorks 229 | -------------------------------------------------------------------------------- /spell/en.utf-8.add.spl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derekwyatt/vim-config/b3c744cf4a6d085755acca0fd484c839c9892c64/spell/en.utf-8.add.spl -------------------------------------------------------------------------------- /syntax/pom.vim: -------------------------------------------------------------------------------- 1 | runtime! syntax/xml.vim 2 | -------------------------------------------------------------------------------- /syntax/wiki.vim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derekwyatt/vim-config/b3c744cf4a6d085755acca0fd484c839c9892c64/syntax/wiki.vim -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | " 2 | " Derek Wyatt's Vim Configuration 3 | " 4 | " It's got stuff in it. 5 | " 6 | 7 | "----------------------------------------------------------------------------- 8 | " Global Stuff 9 | "----------------------------------------------------------------------------- 10 | 11 | function! RunningInsideGit() 12 | let result = system('env | grep ^GIT_') 13 | if result == "" 14 | return 0 15 | else 16 | return 1 17 | endif 18 | endfunction 19 | 20 | let g:jellybeans_overrides = { 21 | \ 'Cursor': { 'guibg': 'ff00ee', 'guifg': '000000' }, 22 | \ 'Search': { 'guifg': '00ffff', 'attr': 'underline' }, 23 | \ 'StatusLine': { 'guibg': 'ffb964', 'guifg': '000000', 'attr': 'bold' } 24 | \} 25 | 26 | let g:indexer_debugLogLevel = 2 27 | 28 | " Get Vundle up and running 29 | set nocompatible 30 | filetype off 31 | 32 | call plug#begin('~/.vim/plugged') 33 | " Plug 'bfredl/nvim-miniyank' 34 | Plug 'hashivim/vim-terraform' 35 | Plug 'henrik/vim-indexed-search' 36 | Plug 'GEverding/vim-hocon' 37 | Plug 'MarcWeber/vim-addon-completion' 38 | Plug 'vim-scripts/VisIncr' 39 | Plug 'easymotion/vim-easymotion' 40 | Plug 'qpkorr/vim-bufkill' 41 | Plug 'clones/vim-genutils' 42 | Plug 'derekwyatt/vim-fswitch' 43 | Plug 'derekwyatt/vim-scala' 44 | Plug 'drmingdrmer/xptemplate' 45 | Plug 'elzr/vim-json' 46 | Plug 'endel/vim-github-colorscheme' 47 | Plug 'godlygeek/tabular' 48 | Plug 'gregsexton/gitv' 49 | Plug 'kien/ctrlp.vim' 50 | Plug 'nanotech/jellybeans.vim' 51 | if has("gui") 52 | Plug 'nathanaelkane/vim-indent-guides' 53 | endif 54 | Plug 'mileszs/ack.vim' 55 | Plug 'sjl/gundo.vim' 56 | Plug 'tpope/vim-fugitive' 57 | Plug 'tpope/vim-surround' 58 | Plug 'tpope/vim-unimpaired' 59 | Plug 'vim-scripts/gnupg.vim' 60 | Plug 'vim-scripts/matchit.zip' 61 | Plug 'xolox/vim-misc' 62 | call plug#end() 63 | 64 | " Add xptemplate global personal directory value 65 | if has("unix") 66 | set runtimepath+=~/.vim/xpt-personal 67 | endif 68 | 69 | " Set filetype stuff to on 70 | filetype on 71 | filetype plugin on 72 | filetype indent on 73 | 74 | " Tabstops are 2 spaces 75 | set tabstop=2 76 | set shiftwidth=2 77 | set softtabstop=2 78 | set expandtab 79 | set autoindent 80 | 81 | " By default, I don't like wrapping 82 | set nowrap 83 | 84 | " Printing options 85 | set printoptions=header:0,duplex:long,paper:letter 86 | 87 | " set the search scan to wrap lines 88 | set wrapscan 89 | 90 | " I'm happy to type the case of things. I tried the ignorecase, smartcase 91 | " thing but it just wasn't working out for me 92 | set noignorecase 93 | 94 | " set the forward slash to be the slash of note. Backslashes suck 95 | set shellslash 96 | if has("unix") 97 | set shell=zsh 98 | else 99 | set shell=ksh.exe 100 | endif 101 | 102 | " Make command line two lines high 103 | set ch=2 104 | 105 | " set visual bell -- i hate that damned beeping 106 | set vb 107 | 108 | " Allow backspacing over indent, eol, and the start of an insert 109 | set backspace=2 110 | 111 | " Make sure that unsaved buffers that are to be put in the background are 112 | " allowed to go in there (ie. the "must save first" error doesn't come up) 113 | set hidden 114 | 115 | " Make the 'cw' and like commands put a $ at the end instead of just deleting 116 | " the text and replacing it 117 | set cpoptions=ces$ 118 | " Neovim seems to make cw include any trailing space, and my fingers can't adjust 119 | nnoremap cw ce 120 | 121 | function! DerekFugitiveStatusLine() 122 | let status = fugitive#statusline() 123 | let trimmed = substitute(status, '\[Git(\(.*\))\]', '\1', '') 124 | let trimmed = substitute(trimmed, '\(\w\)\w\+[_/]\ze', '\1/', '') 125 | let trimmed = substitute(trimmed, '/[^_]*\zs_.*', '', '') 126 | if len(trimmed) == 0 127 | return "" 128 | else 129 | return '(' . trimmed[0:10] . ')' 130 | endif 131 | endfunction 132 | 133 | " Set the status line the way i like it 134 | set stl=%f\ %m\ %r%{DerekFugitiveStatusLine()}\ Line:%l/%L[%p%%]\ Col:%v\ Buf:#%n\ [%b][0x%B] 135 | 136 | " tell VIM to always put a status line in, even if there is only one window 137 | set laststatus=2 138 | 139 | " Don't update the display while executing macros 140 | set lazyredraw 141 | 142 | " Don't show the current command in the lower right corner. In OSX, if this is 143 | " set and lazyredraw is set then it's slow as molasses, so we unset this 144 | set showcmd 145 | 146 | " Show the current mode 147 | set showmode 148 | 149 | " Switch on syntax highlighting. 150 | syntax on 151 | 152 | " Hide the mouse pointer while typing 153 | set mousehide 154 | 155 | " Set up the gui cursor to look nice 156 | set guicursor=n-v-c:block-Cursor-blinkon0,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor,r-cr:hor20-Cursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175 157 | 158 | " set the gui options the way I like 159 | set guioptions=acg 160 | 161 | " Setting this below makes it sow that error messages don't disappear after one second on startup. 162 | "set debug=msg 163 | 164 | " This is the timeout used while waiting for user input on a multi-keyed macro 165 | " or while just sitting and waiting for another key to be pressed measured 166 | " in milliseconds. 167 | " 168 | " i.e. for the ",d" command, there is a "timeoutlen" wait period between the 169 | " "," key and the "d" key. If the "d" key isn't pressed before the 170 | " timeout expires, one of two things happens: The "," command is executed 171 | " if there is one (which there isn't) or the command aborts. 172 | set timeoutlen=500 173 | 174 | " Keep some stuff in the history 175 | set history=100 176 | 177 | " These commands open folds 178 | set foldopen=block,insert,jump,mark,percent,quickfix,search,tag,undo 179 | 180 | " When the page starts to scroll, keep the cursor 8 lines from the top and 8 181 | " lines from the bottom 182 | set scrolloff=8 183 | 184 | " Allow the cursor to go in to "invalid" places 185 | set virtualedit=all 186 | 187 | " Disable encryption (:X) 188 | " set key= 189 | 190 | " Make the command-line completion better 191 | set wildmenu 192 | 193 | " Same as default except that I remove the 'u' option 194 | set complete=.,w,b,t 195 | 196 | " When completing by tag, show the whole tag, not just the function name 197 | set showfulltag 198 | 199 | " Disable it... every time I hit the limit I unset this anyway. It's annoying 200 | set textwidth=0 201 | 202 | " get rid of the silly characters in separators 203 | set fillchars = "" 204 | 205 | " Add ignorance of whitespace to diff 206 | set diffopt+=iwhite 207 | 208 | " Enable search highlighting 209 | set hlsearch 210 | 211 | " Incrementally match the search 212 | set incsearch 213 | 214 | " Add the unnamed register to the clipboard 215 | set clipboard+=unnamed 216 | 217 | " Automatically read a file that has changed on disk 218 | set autoread 219 | 220 | set grepprg=grep\ -nH\ $* 221 | 222 | " Line numbering 223 | set number 224 | set relativenumber 225 | 226 | augroup terminalstuff 227 | au! BufNew,BufNewFile,BufEnter,BufWinEnter term://* setlocal nonumber norelativenumber 228 | augroup END 229 | 230 | " Types of files to ignore when autocompleting things 231 | set wildignore+=*.o,*.class,*.git,*.svn 232 | 233 | " Various characters are "wider" than normal fixed width characters, but the 234 | " default setting of ambiwidth (single) squeezes them into "normal" width, which 235 | " sucks. Setting it to double makes it awesome. 236 | set ambiwidth=single 237 | 238 | " OK, so I'm gonna remove the VIM safety net for a while and see if kicks my ass 239 | set nobackup 240 | set nowritebackup 241 | set noswapfile 242 | 243 | " dictionary for english words 244 | " I don't actually use this much at all and it makes my life difficult in general 245 | "set dictionary=$VIM/words.txt 246 | 247 | " Let the syntax highlighting for Java files allow cpp keywords 248 | let java_allow_cpp_keywords = 1 249 | 250 | " I don't want to have the default keymappings for my scala plugin evaluated 251 | let g:scala_use_default_keymappings = 0 252 | 253 | " System default for mappings is now the "," character 254 | let mapleader = "," 255 | 256 | " Some GUI stuff 257 | let g:lightTheme = 'lakesidelight' 258 | let g:darkTheme = 'xoria256' 259 | command! Light :execute ':colorscheme ' . g:lightTheme . ' | set background=light' 260 | command! Dark :execute ':colorscheme ' . g:darkTheme . ' | set background=dark' 261 | 262 | " Wipe out all buffers 263 | nmap ,wa :call BWipeoutAll() 264 | 265 | " Toggle paste mode 266 | nmap ,p :set invpaste:set paste? 267 | 268 | " cd to the directory containing the file in the buffer 269 | nmap ,cd :lcd %:h 270 | nmap ,cr :lcd =FindCodeDirOrRoot() 271 | nmap ,md :!mkdir -p %:p:h 272 | 273 | " Turn off that stupid highlight search 274 | nmap ,n :nohls 275 | 276 | " put the vim directives for my file editing settings in 277 | nmap ,vi ovim:set ts=2 sts=2 sw=2:vim600:fdm=marker fdl=1 fdc=0: 278 | 279 | " The following beast is something i didn't write... it will return the 280 | " syntax highlighting group that the current "thing" under the cursor 281 | " belongs to -- very useful for figuring out what to change as far as 282 | " syntax highlighting goes. 283 | nmap ,qq :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" 284 | 285 | " Make shift-insert work like in Xterm 286 | map 287 | map! 288 | 289 | " set text wrapping toggles 290 | nmap WimwikiIndex 291 | nmap ,ww :set invwrap 292 | nmap ,wW :windo set invwrap 293 | 294 | " allow command line editing like emacs 295 | cnoremap 296 | cnoremap 297 | cnoremap 298 | cnoremap 299 | cnoremap 300 | cnoremap 301 | cnoremap b 302 | cnoremap 303 | cnoremap f 304 | cnoremap 305 | cnoremap 306 | 307 | function! SwitchToTerminal() 308 | let termbuf = bufname('term://*') 309 | if termbuf == '' 310 | vsplit 311 | wincmd L 312 | vertical resize 100 313 | terminal 314 | else 315 | let winnr = bufwinnr(termbuf) 316 | execute ':' . winnr . 'wincmd w' 317 | normal GA 318 | endif 319 | nunmap 320 | tnoremap :call LeaveTerminal() 321 | endfunction 322 | 323 | function! LeaveTerminal() 324 | execute ':' . winnr('#') . 'wincmd w' 325 | tunmap 326 | nmap :call SwitchToTerminal() 327 | imap :call SwitchToTerminal() 328 | endfunction 329 | 330 | function! WindowLayout() 331 | let termbuf = bufname('term://*') 332 | let wincount = winnr('$') 333 | let width = 416 334 | if termbuf != '' 335 | let winnr = bufwinnr(termbuf) 336 | execute ':' . winnr . 'wincmd w' 337 | wincmd L 338 | vertical resize 100 339 | let width = width - 100 340 | let wincount = wincount - 1 341 | endif 342 | if wincount == 1 343 | :1wincmd w 344 | wincmd H 345 | execute ':vertical resize ' . width 346 | elseif wincount == 2 347 | :1wincmd w 348 | wincmd H 349 | execute ':vertical resize ' . width / 2 350 | :2wincmd w 351 | execute ':vertical resize ' . width / 2 352 | elseif termbuf != '' 353 | let wincount = wincount - 1 354 | if wincount == 3 355 | :1wincmd w 356 | wincmd H 357 | execute ':vertical resize ' . width / 2 358 | :2wincmd w 359 | resize 52 360 | elseif wincount == 4 361 | :1wincmd w 362 | execute ':vertical resize ' . width / 2 363 | resize 52 364 | :3wincmd w 365 | resize 52 366 | endif 367 | endif 368 | endfunction 369 | 370 | " Maps to make handling windows a bit easier 371 | "noremap ,h :wincmd h 372 | "noremap ,j :wincmd j 373 | "noremap ,k :wincmd k 374 | "noremap ,l :wincmd l 375 | "noremap ,sb :wincmd p 376 | noremap :vertical resize -10 377 | noremap :resize +10 378 | noremap :resize -10 379 | noremap :vertical resize +10 380 | noremap ,s8 :vertical resize 83 381 | noremap ,cj :wincmd j:close 382 | noremap ,ck :wincmd k:close 383 | noremap ,ch :wincmd h:close 384 | noremap ,cl :wincmd l:close 385 | noremap ,cc :close 386 | noremap ,cw :cclose 387 | noremap ,ml L 388 | noremap ,mk K 389 | noremap ,mh H 390 | noremap ,mj J 391 | noremap > 392 | noremap + 393 | noremap + 394 | noremap > 395 | noremap ,cq :1wincmd w 396 | noremap ,ca :2wincmd w 397 | noremap ,cw :3wincmd w 398 | noremap ,cs :4wincmd w 399 | noremap ,c3 :call WindowLayout() 400 | noremap ,cz :execute ':' . g:lastWindowNumber . 'wincmd w' 401 | imap :call SwitchToTerminal() 402 | nmap :call SwitchToTerminal() 403 | 404 | " Edit the vimrc file 405 | nmap ,ev :e ~/.vimrc 406 | nmap ,sv :so ~/.vimrc 407 | 408 | " Make horizontal scrolling easier 409 | nmap 10zl 410 | nmap 10zh 411 | 412 | " Add a GUID to the current line 413 | imap d =substitute(substitute(system("uuidgen"), '.$', '', 'g'), '\\(\\u\\)', '\\l\\1', 'g') 414 | imap D =substitute(system("/usr/local/opt/coreutils/libexec/gnubin/date -u '+%Y-%m-%dT%H:%M:%S.%3NZ'"), '.$', '', 'g') 415 | 416 | " Toggle fullscreen mode 417 | nmap :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0) 418 | 419 | " Underline the current line with '=' 420 | nmap ,u= :t.\|s/./=/g\|:nohls 421 | nmap ,u- :t.\|s/./-/g\|:nohls 422 | nmap ,u~ :t.\|s/./\\~/g\|:nohls 423 | 424 | " Shrink the current window to fit the number of lines in the buffer. Useful 425 | " for those buffers that are only a few lines 426 | nmap ,sw :execute ":resize " . line('$') 427 | 428 | " Use the bufkill plugin to eliminate a buffer but keep the window layout 429 | nmap ,bd :BD 430 | nmap ,bw :BW 431 | 432 | " Use CTRL-E to replace the original ',' mapping 433 | nnoremap , 434 | 435 | " Alright... let's try this out 436 | imap jj 437 | " imap jw :w 438 | cmap jj 439 | 440 | " I like jj - Let's try something else fun 441 | imap ,fn =expand('%:t:r') 442 | 443 | " Clear the text using a motion / text object and then move the character to the 444 | " next word 445 | nmap ,C :set opfunc=ClearTextg@ 446 | vmap ,C :call ClearText(visual(), 1) 447 | 448 | " Make the current file executable 449 | nmap ,x :w:!chmod 755 %:e 450 | 451 | " Digraphs 452 | " Alpha 453 | inoremap a* 454 | " Beta 455 | inoremap b* 456 | " Gamma 457 | inoremap g* 458 | " Delta 459 | inoremap d* 460 | " Epslion 461 | inoremap e* 462 | " Lambda 463 | inoremap l* 464 | " Eta 465 | inoremap y* 466 | " Theta 467 | inoremap h* 468 | " Mu 469 | inoremap m* 470 | " Rho 471 | inoremap r* 472 | " Pi 473 | inoremap p* 474 | " Phi 475 | inoremap f* 476 | 477 | " ergonomics 478 | inoremap ( 479 | inoremap ) 480 | inoremap { 481 | inoremap } 482 | inoremap * 483 | inoremap _ 484 | 485 | function! ClearText(type, ...) 486 | let sel_save = &selection 487 | let &selection = "inclusive" 488 | let reg_save = @@ 489 | if a:0 " Invoked from Visual mode, use '< and '> marks 490 | silent exe "normal! '<" . a:type . "'>r w" 491 | elseif a:type == 'line' 492 | silent exe "normal! '[V']r w" 493 | elseif a:type == 'line' 494 | silent exe "normal! '[V']r w" 495 | elseif a:type == 'block' 496 | silent exe "normal! `[\`]r w" 497 | else 498 | silent exe "normal! `[v`]r w" 499 | endif 500 | let &selection = sel_save 501 | let @@ = reg_save 502 | endfunction 503 | 504 | " Syntax coloring lines that are too long just slows down the world 505 | set synmaxcol=2048 506 | 507 | " I don't like it when the matching parens are automatically highlighted 508 | let loaded_matchparen = 1 509 | 510 | " Highlight the current line and column 511 | " Don't do this - It makes window redraws painfully slow 512 | set nocursorline 513 | set nocursorcolumn 514 | 515 | if has("mac") 516 | let g:main_font = "Source\\ Code\\ Pro\\ Medium:h10" 517 | " let g:main_font = "Fira\\ Code\\ Retina:h10" 518 | let g:small_font = "Source\\ Code\\ Pro\\ Medium:h2" 519 | else 520 | let g:main_font = "DejaVu\\ Sans\\ Mono\\ 9" 521 | let g:small_font = "DejaVu\\ Sans\\ Mono\\ 2" 522 | endif 523 | 524 | "----------------------------------------------------------------------------- 525 | " Vimwiki 526 | "----------------------------------------------------------------------------- 527 | let g:vimwiki_list = [ { 'path': '~/code/stuff/vimwiki/TDC', 'path_html': '~/code/stuff/vimwiki/TDC_html' } ] 528 | let g:vimwiki_hl_headers = 1 529 | let g:vimwiki_hl_cb_checked = 1 530 | nmap ,vw :VimwikiIndex 531 | augroup derek_vimwiki 532 | au! 533 | au BufEnter *.wiki setlocal textwidth=100 534 | augroup END 535 | 536 | "----------------------------------------------------------------------------- 537 | " Indent Guides 538 | "----------------------------------------------------------------------------- 539 | let g:indent_guides_color_change_percent = 1.1 540 | "let g:indent_guides_guide_size = 1 541 | let g:indent_guides_enable_on_vim_startup = 1 542 | 543 | "----------------------------------------------------------------------------- 544 | " Fugitive 545 | "----------------------------------------------------------------------------- 546 | " Thanks to Drew Neil 547 | autocmd User fugitive 548 | \ if get(b:, 'fugitive_type', '') =~# '^\%(tree\|blob\)$' | 549 | \ noremap .. :edit %:h | 550 | \ endif 551 | autocmd BufReadPost fugitive://* set bufhidden=delete 552 | 553 | :command! Gammend :Gcommit --amend 554 | 555 | "----------------------------------------------------------------------------- 556 | " NERD Tree Plugin Settings 557 | "----------------------------------------------------------------------------- 558 | " Toggle the NERD Tree on an off with F7 559 | nmap :NERDTreeToggle 560 | 561 | " Close the NERD Tree with Shift-F7 562 | nmap :NERDTreeClose 563 | 564 | " Show the bookmarks table on startup 565 | let NERDTreeShowBookmarks=1 566 | 567 | " Don't display these kinds of files 568 | let NERDTreeIgnore=[ '\.ncb$', '\.suo$', '\.vcproj\.RIMNET', '\.obj$', 569 | \ '\.ilk$', '^BuildLog.htm$', '\.pdb$', '\.idb$', 570 | \ '\.embed\.manifest$', '\.embed\.manifest.res$', 571 | \ '\.intermediate\.manifest$', '^mt.dep$' ] 572 | 573 | "----------------------------------------------------------------------------- 574 | " GPG Stuff 575 | "----------------------------------------------------------------------------- 576 | if has("mac") 577 | let g:GPGExecutable = "gpg2" 578 | let g:GPGUseAgent = 0 579 | endif 580 | 581 | "----------------------------------------------------------------------------- 582 | " AG (SilverSearcher) Settings 583 | "----------------------------------------------------------------------------- 584 | let g:ackprg = 'ag --nogroup --nocolor --column --vimgrep' 585 | let g:ack_wildignore = 0 586 | let b:ack_filetypes = '' 587 | 588 | let g:ack_mappings = { 589 | \ "t": "T", 590 | \ "T": "TgTj", 591 | \ "O": "", 592 | \ "o": ":ccl", 593 | \ "go": "j", 594 | \ "h": "K", 595 | \ "H": "Kb", 596 | \ "v": "HbJt", 597 | \ "gv": "HbJ" } 598 | 599 | function! AgRoot(pattern) 600 | let dir = FindCodeDirOrRoot() 601 | if exists('b:ack_filetypes') 602 | let ft = b:ack_filetypes 603 | else 604 | let ft = '' 605 | endif 606 | let cmd = ':Ack! ' . ft . ' ' . a:pattern . ' ' . dir 607 | execute cmd 608 | endfunction 609 | 610 | function! AgProjectRoot(pattern) 611 | let dir = FindCodeDirOrRoot() 612 | let current = expand('%:p') 613 | let thedir = substitute(current, '^\(' . dir . '/[^/]\+\).*', '\1', '') 614 | if exists('b:ack_filetypes') 615 | let ft = b:ack_filetypes 616 | else 617 | let ft = '' 618 | endif 619 | execute ':Ack! ' . ft . ' ' . a:pattern . ' ' . thedir 620 | endfunction 621 | 622 | command! -nargs=+ AgRoot call AgRoot() 623 | command! -nargs=+ AgProjectRoot call AgProjectRoot() 624 | 625 | nmap ,sr :AgRoot 626 | nmap ,sp :AgProjectRoot 627 | 628 | "----------------------------------------------------------------------------- 629 | " FSwitch mappings 630 | "----------------------------------------------------------------------------- 631 | " nmap ,of :FSHere 632 | " nmap ,ol :FSRight 633 | " nmap ,oL :FSSplitRight 634 | " nmap ,oh :FSLeft 635 | " nmap ,oH :FSSplitLeft 636 | " nmap ,ok :FSAbove 637 | " nmap ,oK :FSSplitAbove 638 | " nmap ,oj :FSBelow 639 | " nmap ,oJ :FSSplitBelow 640 | 641 | "----------------------------------------------------------------------------- 642 | " XPTemplate settings 643 | "----------------------------------------------------------------------------- 644 | let g:xptemplate_brace_complete = '' 645 | 646 | "----------------------------------------------------------------------------- 647 | " TwitVim settings 648 | "----------------------------------------------------------------------------- 649 | let twitvim_enable_perl = 1 650 | let twitvim_browser_cmd = 'firefox' 651 | nmap ,tw :FriendsTwitter 652 | nmap ,tm :UserTwitter 653 | nmap ,tM :MentionsTwitter 654 | function! TwitVimMappings() 655 | nmap U :exe ":UnfollowTwitter " . expand("") 656 | nmap F :exe ":FollowTwitter " . expand("") 657 | nmap 7 :BackTwitter 658 | nmap 8 :ForwardTwitter 659 | nmap 1 :PreviousTwitter 660 | nmap 2 :NextTwitter 661 | endfunction 662 | augroup derek_twitvim 663 | au! 664 | au FileType twitvim call TwitVimMappings() 665 | augroup END 666 | 667 | "----------------------------------------------------------------------------- 668 | " CtrlP Settings 669 | "----------------------------------------------------------------------------- 670 | function! LaunchForThisGitProject(cmd) 671 | let dirs = split(expand('%:p:h'), '/') 672 | let target = '/' 673 | while len(dirs) != 0 674 | let d = '/' . join(dirs, '/') 675 | if isdirectory(d . '/.git') 676 | let target = d 677 | break 678 | else 679 | let dirs = dirs[:-2] 680 | endif 681 | endwhile 682 | if target == '/' 683 | echoerr "Project directory resolved to '/'" 684 | else 685 | execute ":" . a:cmd . " " . target 686 | endif 687 | endfunction 688 | 689 | let g:ctrlp_regexp = 1 690 | let g:ctrlp_switch_buffer = 'E' 691 | let g:ctrlp_tabpage_position = 'c' 692 | let g:ctrlp_working_path_mode = 'rc' 693 | let g:ctrlp_root_markers = ['.project.root'] 694 | let g:ctrlp_user_command = 'find %s -type f | grep -v -E "\.idea/|\.git/|/build/|/project/project|/target/config-classes|/target/docker|/target/k8s|/target/protobuf_external|/target/scala-2\.[0-9]*/api|/target/scala-2\.[0-9]*/classes|/target/scala-2\.[0-9]*/e2etest-classes|/target/scala-2\.[0-9]*/it-classes|/target/scala-2\.[0-9]*/resolution-cache|/target/scala-2\.[0-9]*/sbt-0.13|/target/scala-2\.[0-9]*/test-classes|/target/streams|/target/test-reports|/target/universal|\.jar$"' 695 | let g:ctrlp_max_depth = 30 696 | let g:ctrlp_max_files = 0 697 | let g:ctrlp_open_new_file = 'r' 698 | let g:ctrlp_open_multiple_files = '1ri' 699 | let g:ctrlp_match_window = 'max:40' 700 | let g:ctrlp_prompt_mappings = { 701 | \ 'PrtSelectMove("j")': [''], 702 | \ 'PrtSelectMove("k")': [''], 703 | \ 'PrtHistory(-1)': ['', ''], 704 | \ 'PrtHistory(1)': ['', ''] 705 | \ } 706 | nmap ,fb :CtrlPBuffer 707 | nmap ,ff :CtrlP . 708 | nmap ,ft :CtrlPTag 709 | nmap ,fF :execute ":CtrlP " . expand('%:p:h') 710 | nmap ,fr :call LaunchForThisGitProject("CtrlP") 711 | nmap ,fm :CtrlPMixed 712 | nmap ,fC :CtrlPClearCache 713 | 714 | "----------------------------------------------------------------------------- 715 | " Gundo Settings 716 | "----------------------------------------------------------------------------- 717 | nmap :GundoToggle 718 | 719 | "----------------------------------------------------------------------------- 720 | " Conque Settings 721 | "----------------------------------------------------------------------------- 722 | let g:ConqueTerm_FastMode = 1 723 | let g:ConqueTerm_ReadUnfocused = 1 724 | let g:ConqueTerm_InsertOnEnter = 1 725 | let g:ConqueTerm_PromptRegex = '^-->' 726 | let g:ConqueTerm_TERM = 'xterm' 727 | 728 | "----------------------------------------------------------------------------- 729 | " Branches and Tags 730 | "----------------------------------------------------------------------------- 731 | let g:last_known_branch = {} 732 | 733 | function! FindCodeDirOrRoot() 734 | let filedir = expand('%:p:h') 735 | if isdirectory(filedir) 736 | if HasGitRepo(filedir) 737 | let cmd = 'bash -c "(cd ' . filedir . '; git rev-parse --show-toplevel 2>/dev/null)"' 738 | let gitdir = system(cmd) 739 | if strlen(gitdir) == 0 740 | return '/' 741 | else 742 | return gitdir[:-2] " chomp 743 | endif 744 | else 745 | return '/' 746 | endif 747 | else 748 | return '/' 749 | endif 750 | endfunction 751 | 752 | function! HasGitRepo(path) 753 | let result = system('cd ' . a:path . '; git rev-parse --show-toplevel') 754 | if result =~# 'fatal:.*' 755 | return 0 756 | else 757 | return 1 758 | endif 759 | endfunction 760 | 761 | function! GetThatBranch(root) 762 | if a:root != '/' 763 | if !has_key(g:last_known_branch, a:root) 764 | let g:last_known_branch[a:root] = '' 765 | endif 766 | return g:last_known_branch[a:root] 767 | else 768 | return '' 769 | endif 770 | endfunction 771 | 772 | function! UpdateThatBranch(root) 773 | if a:root != '/' 774 | let g:last_known_branch[a:root] = GetThisBranch(a:root) 775 | endif 776 | endfunction 777 | 778 | function! GetThisBranch(root) 779 | let file = a:root . '/.current_branch' 780 | if filereadable(file) 781 | return substitute(readfile(file)[0], '/', '-', 'g') 782 | elseif HasGitRepo(a:root) 783 | return substitute(fugitive#head(), '/', '-', 'g') 784 | else 785 | throw "You're not in a git repo" 786 | endif 787 | endfunction 788 | 789 | function! ListTagFiles(thisdir, thisbranch, isGit) 790 | let fs = split(glob($HOME . '/.vim-tags/*-tags'), "\n") 791 | let ret = [] 792 | for f in fs 793 | let fprime = substitute(f, '^.*/' . a:thisdir, '', '') 794 | if a:isGit 795 | if match(f, '-' . a:thisbranch . '-') != -1 796 | call add(ret, f) 797 | endif 798 | elseif fprime !=# f 799 | call add(ret, f) 800 | endif 801 | endfor 802 | return ret 803 | endfunction 804 | 805 | function! MaybeRunBranchSwitch() 806 | let root = FindCodeDirOrRoot() 807 | let isGit = HasGitRepo(expand('%:p:h')) 808 | if root != "/" 809 | let thisbranch = GetThisBranch(root) 810 | let thatbranch = GetThatBranch(root) 811 | if thisbranch != '' 812 | let codedir = substitute(root, '/', '-', 'g')[1:] 813 | let fs = ListTagFiles(codedir, thisbranch, isGit) 814 | if len(fs) != 0 815 | execute 'setlocal tags=' . join(fs, ",") 816 | endif 817 | if thisbranch != thatbranch 818 | call UpdateThatBranch(root) 819 | CtrlPClearCache 820 | endif 821 | endif 822 | endif 823 | endfunction 824 | 825 | function! MaybeRunMakeTags() 826 | let root = FindCodeDirOrRoot() 827 | if root != "/" 828 | call system("~/bin/maketags -c " . root . " &") 829 | endif 830 | endfunction 831 | 832 | augroup dw_git 833 | au! 834 | au BufEnter * call MaybeRunBranchSwitch() 835 | au BufWritePost *.scala,*.js,*.java,*.conf call MaybeRunMakeTags() 836 | augroup END 837 | 838 | augroup dw_scala 839 | au! 840 | au BufEnter *.scala setl breakindent linebreak showbreak=.. breakindentopt=min:80 841 | au BufEnter *.scala let b:ack_filetypes='--scala --java --json' 842 | augroup END 843 | 844 | command! RunBranchSwitch call MaybeRunBranchSwitch() 845 | 846 | "----------------------------------------------------------------------------- 847 | " Functions 848 | "----------------------------------------------------------------------------- 849 | function! BWipeoutAll() 850 | let lastbuf = bufnr('$') 851 | let ids = sort(filter(range(1, lastbuf), 'bufexists(v:val)'), 'n') 852 | execute ":" . ids[0] . "," . lastbuf . "bwipeout" 853 | endfunction 854 | 855 | function! BdRegex(regex) 856 | let re = substitute(substitute(a:regex, '^\.\*', '', ''), '\.\*$', '', '') 857 | let ids = sort(filter(range(1, bufnr('$')), 'bufexists(v:val) && bufname(v:val) =~ ".*' . re . '.*"'), 'n') 858 | for id in ids 859 | let name = bufname(id) 860 | execute ":" . id . "bwipeout" 861 | echo "Deleted: " . name 862 | endfor 863 | endfunction 864 | 865 | command! -nargs=1 BdRegex call BdRegex() 866 | 867 | function! CloseBufferIfNoFile() 868 | let lastbuf = bufnr('$') 869 | let ids = sort(filter(range(1, lastbuf), 'bufexists(v:val) && buflisted(v:val) && bufloaded(v:val)'), 'n') 870 | for b in ids 871 | let name = bufname(b) 872 | if !filereadable(name) 873 | execute ':' . b . 'bwipeout!' 874 | endif 875 | endfor 876 | endfunction 877 | 878 | if !exists('g:bufferJumpList') 879 | let g:bufferJumpList = {} 880 | endif 881 | 882 | function! IndentToNextBraceInLineAbove() 883 | :normal 0wk 884 | :normal "vyf( 885 | let @v = substitute(@v, '.', ' ', 'g') 886 | :normal j"vPl 887 | endfunction 888 | 889 | nmap ,ii :call IndentToNextBraceInLineAbove() 890 | 891 | function! DiffCurrentFileAgainstAnother(snipoff, replacewith) 892 | let currentFile = expand('%:p') 893 | let otherfile = substitute(currentFile, "^" . a:snipoff, a:replacewith, '') 894 | only 895 | execute "vertical diffsplit " . otherfile 896 | endfunction 897 | 898 | command! -nargs=+ DiffCurrent call DiffCurrentFileAgainstAnother() 899 | 900 | function! RunSystemCall(systemcall) 901 | let output = system(a:systemcall) 902 | let output = substitute(output, "\n", '', 'g') 903 | return output 904 | endfunction 905 | 906 | function! HighlightAllOfWord(onoff) 907 | if a:onoff == 1 908 | :augroup highlight_all 909 | :au! 910 | :au CursorMoved * silent! exe printf('match Search /\<%s\>/', expand('')) 911 | :augroup END 912 | else 913 | :au! highlight_all 914 | match none /\<%s\>/ 915 | endif 916 | endfunction 917 | 918 | :nmap ,ha :call HighlightAllOfWord(1) 919 | :nmap ,hA :call HighlightAllOfWord(0) 920 | 921 | function! LengthenCWD() 922 | let cwd = getcwd() 923 | if cwd == '/' 924 | return 925 | endif 926 | let lengthend = substitute(cwd, '/[^/]*$', '', '') 927 | if lengthend == '' 928 | let lengthend = '/' 929 | endif 930 | if cwd != lengthend 931 | exec ":lcd " . lengthend 932 | endif 933 | endfunction 934 | 935 | :nmap ,ld :call LengthenCWD() 936 | 937 | function! ShortenCWD() 938 | let cwd = split(getcwd(), '/') 939 | let filedir = split(expand("%:p:h"), '/') 940 | let i = 0 941 | let newdir = "" 942 | while i < len(filedir) 943 | let newdir = newdir . "/" . filedir[i] 944 | if len(cwd) == i || filedir[i] != cwd[i] 945 | break 946 | endif 947 | let i = i + 1 948 | endwhile 949 | exec ":lcd /" . newdir 950 | endfunction 951 | 952 | :nmap ,sd :call ShortenCWD() 953 | 954 | function! RedirToYankRegisterF(cmd, ...) 955 | let cmd = a:cmd . " " . join(a:000, " ") 956 | redir @*> 957 | exe cmd 958 | redir END 959 | endfunction 960 | 961 | command! -complete=command -nargs=+ RedirToYankRegister 962 | \ silent! call RedirToYankRegisterF() 963 | 964 | function! ToggleMinimap() 965 | if exists("s:isMini") && s:isMini == 0 966 | let s:isMini = 1 967 | else 968 | let s:isMini = 0 969 | end 970 | 971 | if (s:isMini == 0) 972 | " save current visible lines 973 | let s:firstLine = line("w0") 974 | let s:lastLine = line("w$") 975 | 976 | " make font small 977 | exe "set guifont=" . g:small_font 978 | " highlight lines which were visible 979 | let s:lines = "" 980 | for i in range(s:firstLine, s:lastLine) 981 | let s:lines = s:lines . "\\%" . i . "l" 982 | 983 | if i < s:lastLine 984 | let s:lines = s:lines . "\\|" 985 | endif 986 | endfor 987 | 988 | exe 'match Visible /' . s:lines . '/' 989 | hi Visible guibg=lightblue guifg=black term=bold 990 | nmap 10j 991 | nmap 10k 992 | else 993 | exe "set guifont=" . g:main_font 994 | hi clear Visible 995 | nunmap 996 | nunmap 997 | endif 998 | endfunction 999 | 1000 | command! ToggleMinimap call ToggleMinimap() 1001 | 1002 | " I /literally/ never use this and it's pissing me off 1003 | " nnoremap :ToggleMinimap 1004 | 1005 | "----------------------------------------------------------------------------- 1006 | " Auto commands 1007 | "----------------------------------------------------------------------------- 1008 | augroup derek_xsd 1009 | au! 1010 | au BufEnter *.xsd,*.wsdl,*.xml setl tabstop=4 shiftwidth=4 1011 | augroup END 1012 | 1013 | augroup Binary 1014 | au! 1015 | au BufReadPre *.bin let &bin=1 1016 | au BufReadPost *.bin if &bin | %!xxd 1017 | au BufReadPost *.bin set filetype=xxd | endif 1018 | au BufWritePre *.bin if &bin | %!xxd -r 1019 | au BufWritePre *.bin endif 1020 | au BufWritePost *.bin if &bin | %!xxd 1021 | au BufWritePost *.bin set nomod | endif 1022 | augroup END 1023 | 1024 | "----------------------------------------------------------------------------- 1025 | " Fix constant spelling mistakes 1026 | "----------------------------------------------------------------------------- 1027 | 1028 | iab Acheive Achieve 1029 | iab acheive achieve 1030 | iab Alos Also 1031 | iab alos also 1032 | iab Aslo Also 1033 | iab aslo also 1034 | iab Becuase Because 1035 | iab becuase because 1036 | iab Bianries Binaries 1037 | iab bianries binaries 1038 | iab Bianry Binary 1039 | iab bianry binary 1040 | iab Charcter Character 1041 | iab charcter character 1042 | iab Charcters Characters 1043 | iab charcters characters 1044 | iab Exmaple Example 1045 | iab exmaple example 1046 | iab Exmaples Examples 1047 | iab exmaples examples 1048 | iab Fone Phone 1049 | iab fone phone 1050 | iab Lifecycle Life-cycle 1051 | iab lifecycle life-cycle 1052 | iab Lifecycles Life-cycles 1053 | iab lifecycles life-cycles 1054 | iab Seperate Separate 1055 | iab seperate separate 1056 | iab Seureth Suereth 1057 | iab seureth suereth 1058 | iab Shoudl Should 1059 | iab shoudl should 1060 | iab Taht That 1061 | iab taht that 1062 | iab Teh The 1063 | iab teh the 1064 | 1065 | "----------------------------------------------------------------------------- 1066 | " Set up the window colors and size 1067 | "----------------------------------------------------------------------------- 1068 | if has('gui_running') || has('gui_vimr') 1069 | set background=light 1070 | colorscheme xoria256 1071 | if has('gui_running') 1072 | exe "set guifont=" . g:main_font 1073 | if !exists("g:vimrcloaded") 1074 | winpos 0 0 1075 | if !&diff 1076 | winsize 130 120 1077 | else 1078 | winsize 227 120 1079 | endif 1080 | let g:vimrcloaded = 1 1081 | endif 1082 | endif 1083 | endif 1084 | :nohls 1085 | 1086 | "----------------------------------------------------------------------------- 1087 | " Local system overrides 1088 | "----------------------------------------------------------------------------- 1089 | if filereadable($HOME . "/.vimrc.local") 1090 | execute "source " . $HOME . "/.vimrc.local" 1091 | endif 1092 | -------------------------------------------------------------------------------- /xpt-personal/ftplugin/_common/personal.xpt.vim: -------------------------------------------------------------------------------- 1 | " Move me to your own fptlugin/_common and config your personal information. 2 | " 3 | " Here is the place to set personal preferences; "priority=personal" is the 4 | " highest which overrides any other XPTvar setting. 5 | " 6 | " You can also set personal variables with 'g:xptemplate_vars' in your .vimrc. 7 | XPTemplate priority=personal 8 | 9 | function! BinaryToHex(binvalue, eolchar, commchar) 10 | let b = a:binvalue 11 | let dec = 0 12 | let c = 0 13 | while b != 0 14 | let r = b % 10 15 | let b = b / 10 16 | if r != 0 17 | let dec = dec + pow(2, c) 18 | endif 19 | let c = c + 1 20 | endwhile 21 | return printf("0x%X%s %s %s", substitute(string(dec), '..$', "", ""), a:eolchar, a:commchar, a:binvalue) 22 | endfunction 23 | 24 | XPTvar $author Derek Wyatt 25 | XPTvar $email derek@derekwyatt.org 26 | 27 | " if () ** { 28 | " else ** { 29 | XPTvar $BRif '\n' 30 | 31 | " } ** else { 32 | XPTvar $BRel '\n' 33 | 34 | " for () ** { 35 | " while () ** { 36 | " do ** { 37 | XPTvar $BRloop '\n' 38 | 39 | " struct name ** { 40 | XPTvar $BRstc '\n' 41 | 42 | " int fun() ** { 43 | " class name ** { 44 | XPTvar $BRfun '\n' 45 | 46 | " int fun ** ( 47 | " class name ** ( 48 | XPTvar $SPfun '' 49 | 50 | " int fun( ** arg ** ) 51 | " if ( ** condition ** ) 52 | " for ( ** statement ** ) 53 | " [ ** a, b ** ] 54 | " { ** 'k' : 'v' ** } 55 | XPTvar $SParg '' 56 | 57 | " if ** ( 58 | " while ** ( 59 | " for ** ( 60 | XPTvar $SPcmd ' ' 61 | 62 | " a = a ** + ** 1 63 | " (a, ** b, ** ) 64 | " a ** = ** b 65 | XPTvar $SPop ' ' 66 | 67 | XPTvar $CommChar '//' 68 | XPTvar $EOLChar '' 69 | 70 | XPT " wrap=phrase hint="..." 71 | "`phrase^" 72 | 73 | XPT ' wrap=phrase hint='...' 74 | '`phrase^' 75 | 76 | XPT bin2hex wrap=binary hint=Convers\ binary\ to\ Hex 77 | XSET binary|post=BinaryToHex(V(), $EOLChar, $CommChar) 78 | `binary^ 79 | -------------------------------------------------------------------------------- /xpt-personal/ftplugin/_common/personal_example.xpt.vim: -------------------------------------------------------------------------------- 1 | " Move me to your own fptlugin/_common and config your personal information. 2 | " 3 | " Here is the place to set personal preferences; "priority=personal" is the 4 | " highest which overrides any other XPTvar setting. 5 | " 6 | " You can also set personal variables with 'g:xptemplate_vars' in your .vimrc. 7 | XPTemplate priority=personal 8 | 9 | 10 | " XPTvar $author you have not yet set $author variable 11 | " XPTvar $email you have not yet set $email variable 12 | 13 | XPT yoursnippet " tips here 14 | bla bla 15 | 16 | -------------------------------------------------------------------------------- /xpt-personal/ftplugin/cpp/cpp.xpt.vim: -------------------------------------------------------------------------------- 1 | 2 | XPTemplate priority=personal 3 | 4 | let s:f = g:XPTfuncs() 5 | 6 | function! s:f.year(...) 7 | return strftime("%Y") 8 | endfunction 9 | 10 | function! InsertNameSpace(beginOrEnd) 11 | let dir = expand('%:p:h') 12 | let ext = expand('%:e') 13 | if ext == 'cpp' 14 | let dir = FSReturnCompanionFilenameString('%') 15 | let dir = fnamemodify(dir, ':h') 16 | endif 17 | let idx = stridx(dir, 'include/') 18 | let nsstring = '' 19 | if idx != -1 20 | let dir = strpart(dir, idx + strlen('include') + 1) 21 | let nsnames = split(dir, '/') 22 | let nsdecl = join(nsnames, ' { namespace ') 23 | let nsdecl = 'namespace '.nsdecl.' {' 24 | if a:beginOrEnd == 0 25 | let nsstring = nsdecl 26 | else 27 | for i in nsnames 28 | let nsstring = nsstring.'} ' 29 | endfor 30 | let nsstring = nsstring . '// end of namespace '.join(nsnames, '::') 31 | endif 32 | let nsstring = nsstring 33 | endif 34 | 35 | return nsstring 36 | endfunction 37 | 38 | function! InsertNameSpaceBegin() 39 | return InsertNameSpace(0) 40 | endfunction 41 | 42 | function! InsertNameSpaceEnd() 43 | return InsertNameSpace(1) 44 | endfunction 45 | 46 | function! GetNSFName(snipend) 47 | let dirAndFile = expand('%:p') 48 | let idx = stridx(dirAndFile, 'include') 49 | if idx != -1 50 | let fname = strpart(dirAndFile, idx + strlen('include') + 1) 51 | else 52 | let fname = expand('%:t') 53 | endif 54 | if a:snipend == 1 55 | let fname = expand(fname.':r') 56 | endif 57 | 58 | return fname 59 | endfunction 60 | 61 | function! GetNSFNameDefine() 62 | let dir = expand('%:p:h') 63 | let ext = toupper(expand('%:e')) 64 | let idx = stridx(dir, 'include') 65 | if idx != -1 66 | let subdir = strpart(dir, idx + strlen('include') + 1) 67 | let define = substitute(subdir, '/', '_', 'g') 68 | let define = define ."_".expand('%:t:r')."_" . ext 69 | let define = toupper(define) 70 | let define = substitute(define, '^_\+', '', '') 71 | return define 72 | else 73 | return toupper(expand('%:t:r'))."_" . ext 74 | endif 75 | endfunction 76 | 77 | function! GetHeaderForCurrentSourceFile() 78 | let header=FSReturnCompanionFilenameString('%') 79 | if stridx(header, '/include/') == -1 80 | let header = substitute(header, '^.*/include/', '', '') 81 | else 82 | let header = substitute(header, '^.*/include/', '', '') 83 | endif 84 | 85 | return header 86 | endfunction 87 | 88 | function! s:f.getNamespaceFilename(...) 89 | return GetNSFName(0) 90 | endfunction 91 | 92 | function! s:f.getNamespaceFilenameDefine(...) 93 | return GetNSFNameDefine() 94 | endfunction 95 | 96 | function! s:f.getHeaderForCurrentSourceFile(...) 97 | return GetHeaderForCurrentSourceFile() 98 | endfunction 99 | 100 | function! s:f.insertNamespaceEnd(...) 101 | return InsertNameSpaceEnd() 102 | endfunction 103 | 104 | function! s:f.insertNamespaceBegin(...) 105 | return InsertNameSpaceBegin() 106 | endfunction 107 | 108 | function! s:f.returnSkeletonsFromPrototypes(...) 109 | return protodef#ReturnSkeletonsFromPrototypesForCurrentBuffer({ 'includeNS' : 0}) 110 | endfunction 111 | 112 | function! s:f.insertVariableAtTheEnd(type, varname) 113 | endfunction 114 | 115 | XPT var hint=Creates\ accessors\ for\ a\ variable 116 | /** 117 | * Returns the value of the `variableName^ variable. 118 | * 119 | * @return A const reference to the `variableName^. 120 | */ 121 | const `variableType^& get`variableName^() const; 122 | 123 | /** 124 | * Sets the value of the `variableName^ variable. 125 | * 126 | * @param value The value to set for `variableName^. 127 | */ 128 | void set`variableName^(const `variableType^& value); 129 | `variableType^ m_`variableName^SV('\(.\)','\l\1','')^^; 130 | 131 | 132 | XPT test hint=Unit\ test\ cpp\ file\ definition 133 | // 134 | // `getNamespaceFilename()^ 135 | // 136 | // 137 | // Copyright (c) `year()^ 138 | // 139 | 140 | class `fileRoot()^ : public ... 141 | { 142 | CPPUNIT_TEST_SUITE(`fileRoot()^); 143 | CPPUNIT_TEST(test); 144 | CPPUNIT_TEST_SUITE_END(); 145 | 146 | public: 147 | void test`Function^() 148 | { 149 | `cursor^ 150 | } 151 | }; 152 | 153 | CPPUNIT_TEST_SUITE_REGISTRATION(`fileRoot()^); 154 | 155 | 156 | XPT tf hint=Test\ function\ definition 157 | void test`Name^() 158 | { 159 | `cursor^ 160 | } 161 | 162 | 163 | XPT namespace hint=Namespace 164 | namespace `name^ 165 | { 166 | `cursor^ 167 | } 168 | 169 | 170 | XPT usens hint=using\ namespace 171 | using namespace `name^; 172 | 173 | 174 | XPT try hint=Try/catch\ block 175 | try 176 | { 177 | `what^ 178 | }`...^ 179 | catch (`Exception^& e) 180 | { 181 | `handler^ 182 | }`...^ 183 | 184 | 185 | XPT tsp hint=Typedef\ of\ a\ smart\ pointer 186 | typedef std::tr1::shared_ptr<`type^> `type^Ptr; 187 | 188 | 189 | XPT tcsp hint=Typedef\ of\ a\ smart\ const\ pointer 190 | typedef std::tr1::shared_ptr `type^CPtr; 191 | 192 | 193 | XPT main hint=C++\ main\ including\ #includes 194 | #include 195 | #include 196 | #include 197 | #include 198 | 199 | using namespace std; 200 | 201 | int main(int argc, char** argv) 202 | { 203 | `cursor^ 204 | 205 | return 0; 206 | } 207 | 208 | 209 | XPT lam hint=Lambda 210 | [`&^](`param^`...^, `param^`...^) { `cursor^ } 211 | 212 | XPT initi hint=Initializer\ list\ for\ non-strings 213 | { `i^`...^, `i^`...^ } 214 | 215 | XPT inits hint=Initializer\ list\ for\ strings 216 | { "`s^"`...^, "`s^"`...^ } 217 | 218 | XPT m hint=Member\ variable 219 | `int^ m_`name^; 220 | 221 | XPT imp hint=specific\ C++\ implementation\ file 222 | // 223 | // `getNamespaceFilename()^ 224 | // 225 | // Copyright (c) `year()^ Research In Motion 226 | // 227 | 228 | #include "`getHeaderForCurrentSourceFile()^" 229 | 230 | `insertNamespaceBegin()^ 231 | 232 | `returnSkeletonsFromPrototypes()^`cursor^ 233 | `insertNamespaceEnd()^ 234 | 235 | 236 | XPT h hint=specific\ C++\ header\ file 237 | // 238 | // `getNamespaceFilename()^ 239 | // 240 | // Copyright (c) `year()^ Research In Motion 241 | // 242 | 243 | #ifndef `getNamespaceFilenameDefine()^ 244 | #define `getNamespaceFilenameDefine()^ 245 | 246 | `insertNamespaceBegin()^ 247 | 248 | /** 249 | * @brief `classDescription^ 250 | */ 251 | class `fileRoot()^ 252 | { 253 | public: 254 | /** 255 | * Constructor 256 | */ 257 | `fileRoot()^(); 258 | 259 | /** 260 | * Destructor 261 | */ 262 | virtual ~`fileRoot()^(); 263 | 264 | `cursor^ 265 | private: 266 | }; 267 | 268 | `insertNamespaceEnd()^ 269 | 270 | #endif // `getNamespaceFilenameDefine()^ 271 | 272 | 273 | XPT functor hint=Functor\ definition 274 | struct `FunctorName^ 275 | { 276 | `void^ operator()(`argument^`...^, `arg^`...^)` const^ 277 | } 278 | 279 | 280 | XPT class hint=Class\ declaration 281 | class `className^ 282 | { 283 | public: 284 | `explicit ^`className^(`argument^`...^, `arg^`...^); 285 | virtual ~`className^(); 286 | `cursor^ 287 | private: 288 | }; 289 | 290 | 291 | XPT wcerr hint=Basic\ std::wcerr\ statement 292 | std::wcerr << `expression^`...^ << `expression^`...^ << std::endl; 293 | 294 | 295 | XPT wcout hint=Basic\ std::wcout\ statement 296 | std::wcout << `expression^`...^ << `expression^`...^ << std::endl; 297 | 298 | 299 | XPT cerr hint=Basic\ std::cerr\ statement 300 | std::cerr << `expression^`...^ << `expression^`...^ << std::endl; 301 | 302 | 303 | XPT cout hint=Basic\ std::cout\ statement 304 | std::cout << `expression^`...^ << `expression^`...^ << std::endl; 305 | 306 | 307 | XPT outcopy hint=Using\ an\ iterator\ to\ outout\ to\ stdout 308 | std::copy(`list^.begin(), `list^.end(), std::ostream_iterator<`std::string^>(std::cout, \"\\n\")); 309 | 310 | 311 | XPT cf wrap=message hint=CPPUNIT_FAIL 312 | CPPUNIT_FAIL("`message^"); 313 | 314 | 315 | XPT ca wrap=condition hint=CPPUNIT_ASSERT 316 | CPPUNIT_ASSERT(`condition^); 317 | 318 | 319 | XPT cae hint=CPPUNIT_ASSERT_EQUAL 320 | CPPUNIT_ASSERT_EQUAL(`expected^, `actual^); 321 | 322 | 323 | XPT cade hint=CPPUNIT_ASSERT_DOUBLES_EQUAL 324 | CPPUNIT_ASSERT_DOUBLES_EQUAL(`expected^, `actual^, `delta^); 325 | 326 | 327 | XPT cam hint=CPPUNIT_ASSERT_MESSAGE 328 | CPPUNIT_ASSERT_MESSAGE(`message^, `condition^); 329 | 330 | 331 | XPT cat hint=CPPUNIT_ASSERT_THROW 332 | CPPUNIT_ASSERT_THROW(`expression^, `ExceptionType^); 333 | 334 | 335 | XPT cant wrap=expression hint=CPPUNIT_ASSERT_NO_THROW 336 | CPPUNIT_ASSERT_NO_THROW(`expression^); 337 | 338 | 339 | XPT sc wrap=value hint=static_cast<>\(\) 340 | static_cast<`to_type^>(`value^) 341 | 342 | 343 | XPT rc wrap=value hint=reinterpret_cast<>\(\) 344 | reinterpret_cast<`to_type^>(`value^) 345 | 346 | 347 | XPT cc wrap=value hint=const_cast<>\(\) 348 | const_cast<`to_type^>(`value^) 349 | 350 | 351 | XPT dc wrap=value hint=dynamic_cast<>\(\) 352 | dynamic_cast<`to_type^>(`value^) 353 | 354 | 355 | XPT { wrap=code hint={\ indented\ code\ block\ } 356 | { 357 | `code^ 358 | } 359 | 360 | 361 | XPT {_ wrap=code hint={\ inline\ code\ block\ } 362 | { `code^ } 363 | 364 | 365 | XPT \( wrap=code hint=\(\ indented\ code\ block\ \) 366 | ( 367 | `code^ 368 | ) 369 | 370 | 371 | XPT \(_ wrap=code hint=\(\ inline\ code\ block\ \) 372 | ( `code^ ) 373 | 374 | 375 | XPT bindf hint=boost::bind\ function\ call 376 | boost::bind(`function^, `param^`...^, `param^`...^) 377 | 378 | 379 | XPT bindftor hint=boost::bind\ function\ object 380 | XSET ftortype|post=S(S(V(), '.*', "<&>", ''), '', '', '') 381 | boost::bind`ftortype^(`functor^, `param^`...^, `param^`...^) 382 | 383 | 384 | XPT bindmem hint=boost::bind\ member\ function 385 | boost::bind(&`class^::`function^, `instance^, `param^`...^, `param^`...^) 386 | 387 | 388 | XPT vec hint=std::vector 389 | std::vector<`type^> 390 | 391 | 392 | XPT map hint=std::map 393 | std::map<`typeA^, `typeB^> 394 | 395 | 396 | XPT typedef hint=typedef\ 'type'\ 'called' 397 | typedef `type^ `called^ 398 | 399 | 400 | XPT s hint=std::string 401 | std::string 402 | 403 | 404 | XPT foriter hint=for\ \(type::iterator\ i\ =\ var.begin;\ i\ !=\ var.end;\ ++i\) 405 | for (`type^::iterator = `i^ = `var^.begin(); `i^ != `var^.end(); ++i) 406 | { 407 | `cursor^ 408 | } 409 | 410 | 411 | XPT forciter hint=for\ \(type::const_iterator\ i\ =\ var.begin;\ i\ !=\ var.end;\ ++i\) 412 | for (`type^::const_iterator = `i^ = `var^.begin(); `i^ != `var^.end(); ++i) 413 | { 414 | `cursor^ 415 | } 416 | 417 | 418 | XPT forriter hint=for\ \(type::reverse_iterator\ i\ =\ var.begin;\ i\ !=\ var.end;\ ++i\) 419 | for (`type^::reverse_iterator = `i^ = `var^.begin(); `i^ != `var^.end(); ++i) 420 | { 421 | `cursor^ 422 | } 423 | 424 | 425 | XPT copy hint=std::copy\(src.begin,\ src.end,\ dest.begin\) 426 | std::copy(`src^.begin(), `src^.end(), `dest^.begin()) 427 | 428 | 429 | XPT foreach hint=std::for_each\(seq.begin,\ seq.end,\ function\) 430 | std::for_each(`seq^.begin(), `seq^.end(), `function^) 431 | 432 | 433 | XPT find hint=std::find\(seq.begin,\ seq.end,\ value\) 434 | std::find(`seq^.begin(), `seq^.end(), `value^) 435 | 436 | 437 | XPT findif hint=std::find_if\(seq.begin,\ seq.end,\ predicate\) 438 | std::find_if(`seq^.begin(), `seq^.end(), `predicate^) 439 | 440 | 441 | XPT transform hint=std::transform\(seq.begin,\ seq.end,\ result.begin,\ unary_operator\) 442 | std::transform(`seq^.begin(), `seq^.end(), `result^.begin(), `unary_operator^) 443 | 444 | 445 | XPT replace hint=std::replace\(seq.begin,\ seq.end,\ oldvalue,\ newvalue\) 446 | std::replace(`seq^.begin(), `seq^.end(), `oldvalue^, `newvalue^) 447 | 448 | 449 | XPT replaceif hint=std::replace_if\(seq.begin,\ seq.end,\ predicate,\ newvalue\) 450 | std::replace(`seq^.begin(), `seq^.end(), `predicate^, `newvalue^) 451 | 452 | 453 | XPT sort hint=std::sort\(seq.begin,\ seq.end,\ predicate\) 454 | std::replace(`seq^.begin(), `seq^.end(), `predicate^) 455 | 456 | 457 | XPT fun hint=function\ definition 458 | XSET class|post=S(V(), '.*[^:]', '&::', '') 459 | `int^ `class^`name^(`param^`...^, `param^`...^)` const^ 460 | { 461 | `cursor^ 462 | } 463 | 464 | 465 | XPT funh hint=function\ declaration 466 | `int^ `class^`name^(`param^`...^, `param^`...^)` const^; 467 | 468 | 469 | -------------------------------------------------------------------------------- /xpt-personal/ftplugin/dot/dot.xpt.vim: -------------------------------------------------------------------------------- 1 | XPTemplate priority=personal 2 | 3 | XPTinclude 4 | \ _common/personal 5 | 6 | XPT digraph hint=new\ directed\ graph 7 | XSET graphname=expand('%:t:r') 8 | digraph `graphname^ { 9 | rankdir=LR; 10 | fontname=Calibri; 11 | node [fontname=Calibri]; 12 | edge [fontname=Calibri]; 13 | node [shape=point, style=invis]; 14 | edge [style=invis]; 15 | L1 -> L2 -> L3 -> L4 -> L5 -> L6; 16 | 17 | node [shape=Mrecord style=filled]; 18 | node [fillcolor=steelblue fontcolor=white]; 19 | `cursor^ 20 | 21 | edge [style=solid]; 22 | 23 | { rank=same; L1; } 24 | { rank=same; L2; } 25 | { rank=same; L3; } 26 | { rank=same; L4; } 27 | { rank=same; L5; } 28 | { rank=same; L6; } 29 | } 30 | // vim:tw=0 sw=2 tw=0: 31 | -------------------------------------------------------------------------------- /xpt-personal/ftplugin/java/java.xpt.vim: -------------------------------------------------------------------------------- 1 | 2 | XPTemplate priority=personal 3 | 4 | XPTinclude 5 | \ _common/personal 6 | \ _common/java 7 | \ _printf/c.like 8 | 9 | XPTvar $BRif ' ' 10 | XPTvar $BRloop ' ' 11 | XPTvar $BRfun ' ' 12 | XPTvar $author 'Derek Wyatt' 13 | XPTvar $email derek.wyatt@primal.com 14 | 15 | let s:f = g:XPTfuncs() 16 | 17 | function! s:f.year(...) 18 | return strftime("%Y") 19 | endfunction 20 | 21 | function! s:f.getPackageForFile(...) 22 | let dir = expand('%:p:h') 23 | let regexes = [ 24 | \ [ '/src/main/java', '/src/main/java' ], 25 | \ [ '/src/test/java', '/src/test/java' ] 26 | \ ] 27 | for e in regexes 28 | let idx = match(dir, e[0]) 29 | if idx != -1 30 | let subdir = strpart(dir, idx + strlen(e[1]) + 1) 31 | let package = substitute(subdir, '/', '.', 'g') 32 | return package 33 | endif 34 | endfor 35 | return '' 36 | endfunction 37 | 38 | function! s:f.classname(...) 39 | return expand('%:t:r') 40 | endfunction 41 | 42 | function! s:f.classNameFromSpec(...) 43 | return substitute(s:f.classname(), 'Test$', '', '') 44 | endfunction 45 | 46 | function! s:f.getFilenameWithPackage(...) 47 | let package = s:f.getPackageForFile() 48 | if strlen(package) == 0 49 | return expand('%:t:r') 50 | else 51 | return package . '.' . expand('%:t:r') 52 | endif 53 | endfunction 54 | 55 | function! s:f.getPackageLine(...) 56 | let package = s:f.getPackageForFile() 57 | if strlen(package) == 0 58 | return '' 59 | else 60 | return "package " . package 61 | endif 62 | endfunction 63 | 64 | XPT file hint=Standard\ Java\ source\ file 65 | `getPackageLine()^; 66 | 67 | public class `classname()^ { 68 | public `classname()^(`$SParg^`ctorParam^`$SParg^)`$BRfun^{ 69 | `cursor^ 70 | } 71 | } 72 | 73 | XPT testfile hint=JUnit\ Test 74 | `getPackageLine()^; 75 | 76 | import static org.junit.Assert.*; 77 | import org.junit.Test; 78 | 79 | public class `classname()^ { 80 | `cursor^ 81 | } 82 | 83 | XPT t hint=Test\ method 84 | @Test 85 | public void `testname^() { 86 | `cursor^ 87 | } 88 | 89 | XPT package hint=package\ for\ this\ file 90 | `getPackageLine()^; 91 | 92 | XPT p hint=System.out.println\(...\) 93 | System.out.println(`cursor^); 94 | 95 | XPT void hint=void\ method 96 | public void `methodName^(`args^) { 97 | `cursor^ 98 | } 99 | 100 | XPT msgif hint=if\ (message\ instanceof\ ...) 101 | if (message instanceof `classname^) { 102 | `classname^ `m^ = (`classname^)message; 103 | `cursor^ 104 | } 105 | 106 | XPT actor hint=Untyped\ Actor 107 | public class `classname()^ extends UntypedActor { 108 | public void onReceive(Object message) throws Exception { 109 | if (message instanceof `classname^) { 110 | `classname^ `m^ = (`classname^)message; 111 | `cursor^ 112 | } 113 | } 114 | } 115 | 116 | XPT singleton hint=Canonical\ Singleton 117 | /** 118 | * `classname()^ 119 | */ 120 | public class `classname()^ { 121 | /** 122 | * The "Bill Pugh" solution: 123 | * http://en.wikipedia.org/wiki/Singleton_pattern#The_solution_of_Bill_Pugh 124 | */ 125 | private static class `classname()^Holder { 126 | public static final `classname()^ instance = new `classname()^(); 127 | } 128 | 129 | /** 130 | * Constructor 131 | */ 132 | private `classname()^() { 133 | `cursor^ 134 | } 135 | 136 | /** 137 | * Retrieves the single instance of the `classname()^. 138 | * 139 | * @return The single instance of `classname()^. 140 | */ 141 | public static `classname()^ getInstance() { 142 | return `classname()^Holder.instance; 143 | } 144 | } 145 | 146 | XPT _printfElts hidden 147 | XSET elts|pre=Echo('') 148 | XSET elts=c_printf_elts( R( 'pattern' ), ',' ) 149 | "`pattern^"`elts^ 150 | 151 | XPT sformat hint=String.format\(""...\) 152 | String.format(`:_printfElts:^) 153 | -------------------------------------------------------------------------------- /xpt-personal/ftplugin/mail/mail.xpt.vim: -------------------------------------------------------------------------------- 1 | XPTemplate priority=personal 2 | 3 | XPTinclude 4 | \ _common/personal 5 | 6 | XPT href wrap=link hint=\\`title^ 8 | 9 | XPT p wrap=paragraph hint=

...

10 |

`paragraph^

11 | 12 | XPT i wrap=phrase hint=... 13 | `phrase^ 14 | 15 | XPT b wrap=phrase hint=... 16 | `phrase^ 17 | 18 | XPT t wrap=phrase hint=... 19 | <`tag^>`phrase^ 20 | 21 | XPT pre hint= 22 |
23 | `cursor^
24 | 
25 | -------------------------------------------------------------------------------- /xpt-personal/ftplugin/pom/pom.xpt.vim: -------------------------------------------------------------------------------- 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 '' 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 " .. 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=... 59 | 60 | `groupId^ 61 | `artifactId^ 62 | `version^ 63 | 64 | 65 | XPT new hint=New\ POM\ file 66 | 70 | 4.0.0 71 | 72 | com.primal 73 | `artifact^ 74 | 0.1-SNAPSHOT 75 | `name^ 76 | 77 | 78 | UTF-8 79 | 2.0.3` `property...{{^ 80 | `Include:__tag^` `property...^`}}^ 81 | 82 | 83 | 84 | 85 | primal-thirdparty 86 | http://maven.primal.com:8081/nexus/content/repositories/thirdparty/ 87 | 88 | 89 | 90 | 91 | 92 | com.typesafe.akka 93 | akka-actor 94 | ${akka.version} 95 | 96 | 97 | 98 | 99 | 100 | 101 | org.codehaus.mojo 102 | exec-maven-plugin 103 | 1.2.1 104 | 105 | com.primal.Main 106 | 107 | 108 | 109 | 110 | 111 | 112 | org.apache.maven.plugins 113 | maven-compiler-plugin 114 | 115 | 1.5 116 | 1.5 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /xpt-personal/ftplugin/sbt/sbt.xpt.vim: -------------------------------------------------------------------------------- 1 | 2 | XPTemplate priority=personal 3 | 4 | let s:f = g:XPTfuncs() 5 | 6 | function! s:f.getCurrentDir(...) 7 | return expand('%:p:h:t') 8 | endfunction 9 | 10 | XPT new hint=Creates\ a\ new\ build.sbt\ file 11 | XSET name|def=getCurrentDir() 12 | name := "`name^" 13 | 14 | version := "`0.1^" 15 | 16 | scalaVersion := "`2.9.1^" 17 | `^ 18 | 19 | XPT mod hint=New\ module\ for\ dependency 20 | "`groupId^" % "`artifactId^" % "`revision^" 21 | 22 | XPT dep hint=libraryDependencies\ ++=\ Seq\(...\) 23 | libraryDependencies ++= Seq( 24 | "`groupId^" % "`artifactId^" % "`revision^" 25 | ) 26 | -------------------------------------------------------------------------------- /xpt-personal/ftplugin/scala/scala.xpt.vim: -------------------------------------------------------------------------------- 1 | 2 | XPTemplate priority=personal 3 | 4 | XPTvar $BRif ' ' 5 | XPTvar $BRel \n 6 | XPTvar $BRloop ' ' 7 | XPTvar $BRfun ' ' 8 | XPTvar $author 'Derek Wyatt' 9 | XPTvar $email derek@derekwyatt.org 10 | 11 | XPTinclude 12 | \ _common/personal 13 | \ java/java 14 | 15 | let s:f = g:XPTfuncs() 16 | 17 | function! s:f.year(...) 18 | return strftime("%Y") 19 | endfunction 20 | 21 | function! s:f.getPackageForFile(...) 22 | let dir = expand('%:p:h') 23 | let regexes = [ 24 | \ [ '/src/main/scala', '/src/main/scala' ], 25 | \ [ '/src/test/scala', '/src/test/scala' ], 26 | \ [ '/src/it/scala', '/src/it/scala' ], 27 | \ [ '/src/multi-jvm/scala', '/src/multi-jvm/scala' ], 28 | \ [ '/app/model/scala', '/app/model/scala' ], 29 | \ [ '/app/controllers', '/app' ], 30 | \ [ '/test/scala', '/test/scala' ] ] 31 | for e in regexes 32 | let idx = match(dir, e[0]) 33 | if idx != -1 34 | let subdir = strpart(dir, idx + strlen(e[1]) + 1) 35 | let package = substitute(subdir, '/', '.', 'g') 36 | return package 37 | endif 38 | endfor 39 | return '' 40 | endfunction 41 | 42 | function! s:f.classname(...) 43 | return expand('%:t:r') 44 | endfunction 45 | 46 | function! s:f.multijvmObject(...) 47 | return substitute(s:f.classname(), 'Spec$', 'MultiJvmSpec', '') 48 | endfunction 49 | 50 | function! s:f.multijvmBase(...) 51 | return substitute(s:f.classname(), 'Spec$', 'Base', '') 52 | endfunction 53 | 54 | function! s:f.classNameFromSpec(...) 55 | return substitute(s:f.classname(), '\%(Spec\|Test\)$', '', '') 56 | endfunction 57 | 58 | function! s:f.classNameFromTest(...) 59 | return substitute(s:f.classname(), 'Test$', '', '') 60 | endfunction 61 | 62 | function! s:f.multiJvmNode(num, ...) 63 | let className = substitute(s:f.classname(), 'Spec$', 'MultiJvmNode', '') . a:num 64 | let class = join(['class ' . className . ' extends AkkaRemoteSpec(' . s:f.multijvmObject() . '.nodeConfigs(' . (a:num - 1). '))', 65 | \ ' with ImplicitSender', 66 | \ ' with ' . s:f.multijvmBase() . ' {', 67 | \ ' import ' . s:f.multijvmObject() . '._', 68 | \ ' import ' . s:f.classNameFromSpec() . '._', 69 | \ ' val nodes = NrOfNodes', 70 | \ '', 71 | \ ' "' . s:f.classNameFromSpec() . '" should {', 72 | \ ' }', 73 | \ '}'], "\n") 74 | return class 75 | endfunction 76 | 77 | function! s:f.multiJvmNodes(num, ...) 78 | let n = 1 79 | let s = '' 80 | while n <= a:num 81 | let s = s . s:f.multiJvmNode(n) . "\n" 82 | let n = n + 1 83 | endwhile 84 | return s 85 | endfunction 86 | 87 | function! s:f.getFilenameWithPackage(...) 88 | let package = s:f.getPackageForFile() 89 | if strlen(package) == 0 90 | return expand('%:t:r') 91 | else 92 | return package . '.' . expand('%:t:r') 93 | endif 94 | endfunction 95 | 96 | function! s:f.getPackageLine(...) 97 | let package = s:f.getPackageForFile() 98 | if strlen(package) == 0 99 | return '' 100 | else 101 | return "package " . package 102 | endif 103 | endfunction 104 | 105 | function! s:f.getCurrentDir(...) 106 | return expand('%:p:h:t') 107 | endfunction 108 | 109 | XPT impakka hint=Imports\ basic\ akka\ stuff 110 | import akka.actor.{Actor, ActorRef, ActorSystem, Props} 111 | 112 | XPT file hint=Standard\ Scala\ source\ file 113 | // 114 | // `getFilenameWithPackage()^ 115 | // 116 | // Copyright (c) `year()^ Derek Wyatt (derek@derekwyatt.org) 117 | // 118 | `getPackageLine()^ 119 | `cursor^ 120 | 121 | XPT main hint=Creates\ a\ "Main"\ object 122 | object `objectName^ { 123 | def main(args: Array[String]) { 124 | `cursor^ 125 | } 126 | } 127 | 128 | XPT app hint=Creates\ an\ "App"\ object 129 | object `classname()^ extends App { 130 | `cursor^ 131 | } 132 | 133 | XPT afun hint=Creates\ an\ anonymous\ function 134 | () => { 135 | `cursor^ 136 | } 137 | 138 | XPT cc hint=Creates\ a\ case\ class 139 | final case class `className^(`...^`attrName^: `type^`...^) 140 | 141 | XPT cobj hint=Creates\ a\ case\ object 142 | case object `objectName^ 143 | 144 | XPT case hint=Creates\ a\ case\ statement 145 | case `matchAgainst^ => 146 | 147 | XPT akkamain hint=Creates\ a\ simple\ Akka\ App\ for\ PoC 148 | import akka.actor._ 149 | 150 | class MyActor extends Actor { 151 | def receive = { 152 | case _ => 153 | } 154 | } 155 | 156 | object Main { 157 | val sys = ActorSystem() 158 | def main(args: Array[String]) { 159 | val a = sys.actorOf(Props[MyActor], "MyActor") 160 | `cursor^ 161 | } 162 | } 163 | 164 | XPT specfile hint=Creates\ a\ new\ Specs2\ test\ file 165 | `getPackageLine()^ 166 | 167 | import org.specs2.mutable._ 168 | 169 | class `classname()^ extends Specification { 170 | "`classNameFromSpec()^" should { 171 | "`spec^" in { 172 | `cursor^ 173 | } 174 | } 175 | } 176 | 177 | XPT wrapin wrap=code hint=Wraps\ in\ a\ block 178 | `prefix^ { 179 | `code^ 180 | } 181 | 182 | XPT match hint=Creates\ a\ pattern\ matching\ sequence 183 | `target^ match { 184 | `...^case `matchTo^ => `statement^ 185 | `...^ 186 | } 187 | 188 | XPT spec hint=Creates\ a\ new\ specs2\ test 189 | "`spec^" in { 190 | `cursor^ 191 | } 192 | 193 | XPT wst hint=Creates\ a\ new\ WordSpec\ test 194 | "`spec^" in { 195 | `cursor^ 196 | } 197 | 198 | XPT groupwordspec hint=Creates\ a\ new\ WordSpec\ test\ group 199 | "`spec^" should { 200 | `cursor^ 201 | } 202 | 203 | XPT filewordspec hint=Creates\ a\ new\ WordSpec\ test\ file 204 | `getPackageLine()^ 205 | 206 | import org.scalatest.{WordSpec, Matchers} 207 | 208 | class `classname()^ extends WordSpec with Matchers { 209 | "`classNameFromSpec()^" should { 210 | `cursor^ 211 | } 212 | } 213 | 214 | XPT tdcflatspec hint=Creates\ a\ TDC\ specific\ FlatSpec\ test\ file 215 | `getPackageLine()^ 216 | 217 | import com.netsuite.tdc.TDCFlatSpec 218 | 219 | class `classname()^ extends TDCFlatSpec { 220 | "`classNameFromSpec()^" should "`description^" in { 221 | `cursor^ 222 | } 223 | } 224 | 225 | XPT tdcakkaspec hint=Creates\ a\ TDC\ specific\ Akka\ test\ file 226 | `getPackageLine()^ 227 | 228 | import com.netsuite.tdc.TDCAkkaTest 229 | 230 | class `classname()^ extends TDCAkkaTest { 231 | "`classNameFromSpec()^" should "`description^" in { 232 | `cursor^ 233 | } 234 | } 235 | 236 | XPT flatspec hint=Creates\ a\ new\ FlatSpec\ test\ file 237 | `getPackageLine()^ 238 | 239 | import org.scalatest.{ FlatSpec, Matchers } 240 | 241 | class `classname()^ extends FlatSpec with Matchers { 242 | "`classNameFromSpec()^" should "`description^" in { 243 | `cursor^ 244 | } 245 | } 246 | 247 | XPT fileflatspec hint=Creates\ a\ new\ FlatSpec\ test\ file 248 | `getPackageLine()^ 249 | 250 | import org.scalatest.{ FlatSpec, Matchers } 251 | 252 | class `classname()^ extends FlatSpec with Matchers { 253 | "`classNameFromSpec()^" should "`do someting^" in { 254 | `cursor^ 255 | } 256 | } 257 | 258 | XPT eorp hint=envOrNone.orElse.propOrNone 259 | envOrNone("`Variable^").orElse(propOrNone("`property^")) 260 | 261 | XPT rcv hint=Akka\ Receive\ def 262 | def `receive^: Receive = { 263 | `cursor^ 264 | } 265 | 266 | XPT actor hint=Akka\ Actor\ class 267 | class `ActorName^ extends Actor with LazyLogging { 268 | def receive = { 269 | `cursor^ 270 | } 271 | } 272 | 273 | XPT aactor hint=Anonymous\ Akka\ Actor 274 | actorOf(new Actor { 275 | def receive = { 276 | `cursor^ 277 | } 278 | }) 279 | 280 | XPT akkaimp hint=Common\ Akka\ Imports 281 | import akka.actor._ 282 | import akka.actor.Actor._ 283 | import akka.config.Supervision._ 284 | 285 | XPT ssf hint=self.sender.foreach\(_\ !\ ...\) 286 | self.sender.foreach(_ ! `message^) 287 | 288 | XPT proj hint=SBT\ Project 289 | import sbt._ 290 | 291 | class `project^Project(info: ProjectInfo) extends `DefaultProject^(info) { 292 | `cursor^ 293 | } 294 | 295 | XPT projDepend hint=SBT\ Project\ dependency 296 | XSET type=ChooseStr( 'provided', 'test', 'compile' ) 297 | lazy val `depName^ = "`package^" % "`name^" % "`version^" % "`type^" 298 | 299 | XPT package hint=package\ for\ this\ file 300 | `getPackageLine()^ 301 | 302 | XPT akkatest hint=Test\ file\ for\ Akka\ code 303 | `getPackageLine()^ 304 | 305 | import akka.actor.{ ActorSystem, Props, Actor, ActorRef } 306 | import akka.testkit.{ TestKit, TestProbe } 307 | import org.scalatest.{ FlatSpecLike, Matchers } 308 | 309 | class `classname()^ extends TestKit(ActorSystem()) with FlatSpecLike with Matchers { 310 | 311 | "`classNameFromSpec()^" should "`do something^" in { 312 | `cursor^ 313 | } 314 | } 315 | 316 | XPT multijvm hint=Multi\ JVM\ Test\ for\ Scala 317 | `getPackageLine()^ 318 | 319 | import akka.remote.{AkkaRemoteSpec, AbstractRemoteActorMultiJvmSpec} 320 | import akka.testkit.{TestKit, ImplicitSender} 321 | import com.typesafe.config.{Config, ConfigFactory} 322 | import org.scalatest.{WordSpec, BeforeAndAfterAll} 323 | import org.scalatest.matchers.MustMatchers 324 | 325 | object `multijvmObject()^ extends AbstractRemoteActorMultiJvmSpec { 326 | override def NrOfNodes = `numberOfNodes^ 327 | def commonConfig = ConfigFactory.parseString(""" 328 | akka.actor.provider = "akka.remote.RemoteActorRefProvider", 329 | akka.remote.transport = "akka.remote.netty.NettyRemoteTransport" 330 | """) 331 | } 332 | 333 | trait `multijvmBase()^ extends WordSpec 334 | with BeforeAndAfterAll 335 | with MustMatchers { 336 | override def beforeAll(configMap: Map[String, Any]) { 337 | } 338 | override def afterAll(configMap: Map[String, Any]) { 339 | } 340 | } 341 | 342 | `expandNodes...^ 343 | XSETm expandNodes...|post 344 | `multiJvmNodes(R("numberOfNodes"))^ 345 | XSETm END 346 | 347 | XPT bookblock wrap=code hint=Wraps\ a\ block\ of\ code\ in\ BEGIN/END 348 | // FILE_SECTION_BEGIN{`name^} 349 | `code^ 350 | // FILE_SECTION_END{`name^} 351 | 352 | XPT mod hint=New\ module\ for\ dependency 353 | "`groupId^" `%%^ "`artifactId^" % "`revision^" 354 | 355 | XPT be hint=x\ must\ be\ \(y\) 356 | `object^ must be (`target^) 357 | 358 | XPT notbe hint=x\ must\ not\ be\ \(y\) 359 | `object^ must not be (`target^) 360 | 361 | XPT sbt hint=Creates\ a\ new\ build.sbt\ file 362 | XSET name|def=getCurrentDir() 363 | name := "`name^" 364 | 365 | version := "`0.1^" 366 | 367 | scalaVersion := "`2.12.2^" 368 | `^ 369 | 370 | XPT dep hint=libraryDependencies\ :=\ Seq\(...\) 371 | libraryDependencies := Seq( 372 | "`groupId^" % "`artifactId^" % "`revision^", 373 | "org.scalatest" %% "scalatest" % "3.0.1" % "test" 374 | ) 375 | 376 | XPT extension hint=Creates\ a\ new\ Akka\ Extension 377 | import akka.actor.{ Extension => AkkaExtension, ExtensionId => AkkaExtensionId, ExtensionIdProvider => AkkaExtensionIdProvider } 378 | 379 | class `extensionName^(system: ExtendedActorSystem) extends AkkaExtension { 380 | `cursor^ 381 | } 382 | 383 | object `extensionName^ extends AkkaExtensionId[`extensionName^] with AkkaExtensionIdProvider { 384 | def lookup() = this 385 | def createExtension(system: ExtendedActorSystem): `extensionName^ = new `extensionName^(system) 386 | } 387 | 388 | XPT auviktest hint=Creates\ a\ new\ Auivk\ style\ Akka\ test\ file 389 | `getPackageLine()^ 390 | 391 | import com.auvik.npl.common.AkkaTest 392 | 393 | class `classname()^ extends AkkaTest { 394 | "`classNameFromSpec()^" should "`description^" in { 395 | `cursor^ 396 | } 397 | } 398 | -------------------------------------------------------------------------------- /xpt-personal/ftplugin/sh/sh.xpt.vim: -------------------------------------------------------------------------------- 1 | XPTemplate priority=personal 2 | 3 | XPTinclude 4 | \ _common/personal 5 | 6 | let s:f = g:XPTfuncs() 7 | 8 | XPT optparse hint=BASH\ option\ parsing 9 | opts=$(getopt -o h`short^ --long host,`long^ -n "${0##*/}" -- "$@") 10 | if [ $? != 0 ]; then exit 1; fi 11 | 12 | mydir="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 13 | me=${BASH_SOURCE[0]} 14 | me=${me##*/} 15 | 16 | function usage 17 | { 18 | cat <... 18 | 19 | 20 | 21 |

`TO BE WRITTEN^

22 |
23 |
24 | `cursor^ 25 |
26 | ..XPT 27 | 28 | 29 | XPT simpleType hint=... 30 | 31 | 32 | 33 |

`TO BE WRITTEN^

34 |
35 |
36 | `cursor^ 37 |
38 | ..XPT 39 | 40 | 41 | XPT documentation hint=... 42 | 43 | 44 |

`cursor^

45 |
46 |
47 | ..XPT 48 | 49 | 50 | XPT sequence hint=... 51 | 52 | `cursor^ 53 | 54 | 55 | 56 | XPT attr hint=attr="value" 57 | `attr^="`value^" 58 | ..XPT 59 | 60 | 61 | XPT tag wrap=content hint=... 62 | <`tag^ `attr...{{^ `Include:attr^`}}^> 63 | `content^ 64 | 65 | ..XPT 66 | 67 | 68 | XPT element hint= 69 | 70 | 71 | 72 |

`TO BE WRITTEN^

73 |
74 |
75 |
76 | `cursor^ 77 | ..XPT 78 | 79 | 80 | XPT extension hint=... 81 | 82 | 83 | `cursor^ 84 | 85 | 86 | ..XPT 87 | 88 | 89 | XPT enumeration hint= 90 | 91 | ..XPT 92 | 93 | 94 | XPT restriction hint= 95 | 96 | `cursor^ 97 | 98 | ..XPT 99 | 100 | 101 | XPT stringEnum hint=... 102 | 103 | `...^ 104 | `...^ 105 | 106 | ..XPT 107 | 108 | 109 | XPT typ hint=Add\ a\ type\ previously\ defined 110 | XSET typename=getTypeNames() 111 | tns:``typename^ 112 | ..XPT 113 | 114 | XPT p hint=

...

115 |

`cursor^

116 | ..XPT 117 | 118 | --------------------------------------------------------------------------------