├── .backup └── .gitignore ├── .gitignore ├── .gitmodules ├── .swp └── .gitignore ├── .undo └── .gitignore ├── README.md ├── after ├── ftplugin │ ├── markdown.vim │ └── vader-result.vim └── syntax │ └── html.vim ├── autoload ├── extra_ale_fixers.vim ├── file_search.vim ├── js_tools.vim ├── json.vim ├── snippet_functions.vim ├── startup │ ├── autocmd.vim │ ├── command_abbreviations.vim │ ├── common.vim │ ├── keybinds.vim │ └── spelling_corrections.vim ├── test_json.vader ├── vader_tools.vim └── w0rp │ ├── string.vader │ └── string.vim ├── colors └── darkspectrum.vim ├── doc ├── matchit.txt └── xml-plugin.txt ├── ftdetect ├── json.vim └── less.vim ├── ftplugin ├── ale-preview-selection.vim ├── c.vim ├── cmake.vim ├── cpp.vim ├── css.vim ├── d.vim ├── debchangelog.vim ├── file-search.vim ├── gitcommit.vim ├── go.vim ├── gohtmltmpl.vim ├── help.vim ├── html.vim ├── html_snip_helper.vim ├── htmldjango.vim ├── htmljinja.vim ├── java.vim ├── javascript.vim ├── jproperties.vim ├── json.vim ├── jsp.vim ├── less.vim ├── lua.vim ├── markdown.vim ├── objc.vim ├── php.vim ├── po.vim ├── ps1.vim ├── pug.vim ├── python.vim ├── python_vimisort.vim ├── qf.vim ├── rst.vim ├── ruby.vim ├── rust.vim ├── scss.vim ├── sh.vim ├── snippet.vim ├── sql.vim ├── terraform-vars.vim ├── terraform.vim ├── toml.vim ├── typescript.vim ├── typescriptreact.vim ├── vader.vim ├── vim.vim ├── xml.vim ├── xml_plugin.vim └── yaml.vim ├── gvimrc ├── indent └── less.vim ├── keybinds.vim ├── plugin ├── autoswap.vim ├── python-imports.vim ├── rainbow.vim └── zoom.vim ├── python-import-paths.vim ├── snippets ├── _.snippets ├── autoit.snippets ├── c.snippets ├── cpp.snippets ├── css.snippets ├── d.snippets ├── go.snippets ├── html.snippets ├── htmljinja.snippets ├── java.snippets ├── javascript.snippets ├── jsp.snippets ├── mako.snippets ├── markdown.snippets ├── mysql.snippets ├── objc.snippets ├── perl.snippets ├── php.snippets ├── python.snippets ├── rst.snippets ├── ruby.snippets ├── sh.snippets ├── snippet.snippets ├── sql.snippets ├── tcl.snippets ├── tex.snippets ├── typescript.snippets ├── vim.snippets ├── xml.snippets ├── xsd.snippets ├── xslt.snippets └── zsh.snippets ├── spell └── en.utf-8.add ├── syntax ├── go-template-LICENSE.txt ├── gohtmltmpl.vim ├── gotexttmpl.vim ├── javascript.vim ├── markdown.vim ├── modules │ ├── es6-promise.vim │ ├── es6-proxy.vim │ ├── es6-regexp.vim │ ├── es6-set.vim │ ├── es6-string.vim │ ├── es6-symbol.vim │ ├── js-browser.vim │ └── js-doc.vim ├── pekwm.vim ├── po.vim └── vim.vim └── vimrc /.backup/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .directory 2 | .DS_Store 3 | /.VimballRecord 4 | /.netrwhist 5 | /doc/tags 6 | /spell/en.utf-8.add.spl 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "bundle/nerdtree"] 2 | path = pack/git-plugins/start/nerdtree 3 | url = https://github.com/scrooloose/nerdtree.git 4 | [submodule "bundle/nerdtree-project"] 5 | path = pack/git-plugins/start/nerdtree-project 6 | url = https://github.com/janlay/NERD-tree-project.git 7 | [submodule "bundle/vim-pug"] 8 | path = pack/git-plugins/start/vim-pug 9 | url = https://github.com/digitaltoad/vim-pug.git 10 | [submodule "bundle/tlib_vim"] 11 | path = pack/git-plugins/start/tlib_vim 12 | url = https://github.com/tomtom/tlib_vim.git 13 | [submodule "bundle/vim-addon-mw-utils"] 14 | path = pack/git-plugins/start/vim-addon-mw-utils 15 | url = https://github.com/MarcWeber/vim-addon-mw-utils.git 16 | [submodule "bundle/snipmate"] 17 | path = pack/git-plugins/start/snipmate 18 | url = https://github.com/garbas/vim-snipmate.git 19 | [submodule "bundle/ale"] 20 | path = pack/git-plugins/start/ale 21 | url = https://github.com/dense-analysis/ale.git 22 | ignore = all 23 | [submodule "bundle/vader"] 24 | path = pack/git-plugins/start/vader 25 | url = https://github.com/junegunn/vader.vim.git 26 | [submodule "bundle/python-tools"] 27 | path = pack/git-plugins/start/python-tools 28 | url = https://github.com/w0rp/python_tools.git 29 | ignore = all 30 | [submodule "bundle/vim-misc"] 31 | path = pack/git-plugins/start/vim-misc 32 | url = https://github.com/xolox/vim-misc.git 33 | [submodule "bundle/vim-reload"] 34 | path = pack/git-plugins/start/vim-reload 35 | url = https://github.com/xolox/vim-reload.git 36 | [submodule "bundle/typescript-vim"] 37 | path = pack/git-plugins/start/typescript-vim 38 | url = https://github.com/w0rp/typescript-vim.git 39 | [submodule "bundle/lightline"] 40 | path = pack/git-plugins/start/lightline 41 | url = https://github.com/w0rp/lightline.vim.git 42 | [submodule "pack/git-plugins/start/vim-ps1"] 43 | path = pack/git-plugins/start/vim-ps1 44 | url = https://github.com/PProvost/vim-ps1.git 45 | [submodule "pack/git-plugins/start/splitjoin.vim"] 46 | path = pack/git-plugins/start/splitjoin.vim 47 | url = https://github.com/AndrewRadev/splitjoin.vim.git 48 | [submodule "pack/git-plugins/start/vim-js-pretty-template"] 49 | path = pack/git-plugins/start/vim-js-pretty-template 50 | url = https://github.com/Quramy/vim-js-pretty-template.git 51 | [submodule "pack/git-plugins/start/vim-easy-align"] 52 | path = pack/git-plugins/start/vim-easy-align 53 | url = https://github.com/junegunn/vim-easy-align.git 54 | [submodule "pack/git-plugins/start/neural"] 55 | path = pack/git-plugins/start/neural 56 | url = https://github.com/dense-analysis/neural.git 57 | [submodule "pack/git-plugins/start/vim-hugo"] 58 | path = pack/git-plugins/start/vim-hugo 59 | url = https://github.com/phelipetls/vim-hugo.git 60 | -------------------------------------------------------------------------------- /.swp/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /.undo/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # w0rp's Vim files 2 | 3 | This repository contains w0rp's Vim files. They aren't for everyone, but he sure likes them. 4 | 5 | ## Installation on Linux 6 | 7 | Assuming you are using Ubuntu/Debian. 8 | 9 | ```bash 10 | sudo apt install vim git 11 | git clone --recursive https://github.com/w0rp/vim.git ~/.vim 12 | ``` 13 | 14 | That's it. Now you are using Vim like w0rp on Linux. 15 | 16 | ## Installation on Windows 17 | 18 | 1. Install git: https://git-scm.com/download/win 19 | 2. Install vim: https://www.vim.org/download.php#pc 20 | 3. Do this: 21 | 22 | ```bash 23 | git clone --recursive https://github.com/w0rp/vim.git ~/vimfiles 24 | ``` 25 | 26 | That's it. Now you are using Vim like w0rp on Windows. 27 | 28 | ## Installation on Mac OSX 29 | 30 | 1. Install git: https://git-scm.com/download/mac 31 | 2. Install MacVim: https://macvim-dev.github.io/macvim/ 32 | 3. Do this: 33 | 34 | ```bash 35 | git clone --recursive https://github.com/w0rp/vim.git ~/.vim 36 | ``` 37 | 38 | Open System Preferences > Keyboard > Shortcuts > App Shortcuts 39 | 40 | Add MacVim as an application, and you want to redefine ridiculous keybinds 41 | for at least the following menu items. 42 | 43 | ``` 44 | Close 45 | Close Window 46 | Find... 47 | Hide MacVim 48 | List Errors 49 | Make 50 | New Window 51 | Open... 52 | Print 53 | Quit MacVim 54 | ``` 55 | 56 | `gvimrc` in the Vim configuration files maps Command keys to Ctrl keys in Vim, 57 | so you can treat Command keybinds as if they are Ctrl keybinds. 58 | -------------------------------------------------------------------------------- /after/ftplugin/markdown.vim: -------------------------------------------------------------------------------- 1 | setlocal expandtab 2 | setlocal colorcolumn=81 3 | setlocal textwidth=80 4 | 5 | if has('gui_running') 6 | setlocal spell 7 | endif 8 | -------------------------------------------------------------------------------- /after/ftplugin/vader-result.vim: -------------------------------------------------------------------------------- 1 | function! QuitVaderResult() abort 2 | let l:test_filename = matchlist( 3 | \ getline(search('\vStarting Vader: .*\.vader', 'nw')), 4 | \ '\v: (.*)$' 5 | \)[1] 6 | 7 | for l:win_info in getwininfo() 8 | if expand('#' . l:win_info.bufnr . ':p') ==# l:test_filename 9 | :q! 10 | execute 'normal ' . l:win_info.tabnr . 'gt' 11 | return 12 | endif 13 | endfor 14 | 15 | :q! 16 | endfunction 17 | 18 | noremap :call QuitVaderResult() 19 | -------------------------------------------------------------------------------- /after/syntax/html.vim: -------------------------------------------------------------------------------- 1 | syn region djangotagmarkers start="{{" end="}}" 2 | syn region djangovariablemarkers start="{%" end="%}" 3 | 4 | hi def link djangotagmarkers PreProc 5 | hi def link djangovariablemarkers PreProc 6 | 7 | -------------------------------------------------------------------------------- /autoload/extra_ale_fixers.vim: -------------------------------------------------------------------------------- 1 | function! extra_ale_fixers#AutomaticallyFixJSONDiffOutput(buffer, lines) abort 2 | let l:result = [] 3 | 4 | for l:line in a:lines 5 | let l:line = substitute(l:line, '\v": false', '": False', 'g') 6 | let l:line = substitute(l:line, '\v": true', '": True', 'g') 7 | let l:line = substitute(l:line, '\v": null', '": None', 'g') 8 | 9 | call add(l:result, l:line) 10 | endfor 11 | 12 | return l:result 13 | endfunction 14 | 15 | function! extra_ale_fixers#FixWeirdImportCommas(buffer, lines) abort 16 | let l:result = [] 17 | 18 | for l:line in a:lines 19 | if l:line ==# ' ,' 20 | let l:result[-1] .= ',' 21 | else 22 | call add(l:result, l:line) 23 | endif 24 | endfor 25 | 26 | return l:result 27 | endfunction 28 | -------------------------------------------------------------------------------- /autoload/file_search.vim: -------------------------------------------------------------------------------- 1 | " Author: w0rp 2 | " Description: Simple file search with ripgrep and a buffer. 3 | let s:search_timer = 0 4 | let s:job = v:null 5 | 6 | function! s:StopLastSearch() abort 7 | if s:job isnot v:null 8 | call job_stop(s:job) 9 | let s:job = v:null 10 | endif 11 | endfunction 12 | 13 | function! s:SetLines(buffer, lines) abort 14 | call setbufline(a:buffer, 1, a:lines) 15 | call deletebufline(a:buffer, len(a:lines) + 1, '$') 16 | redraw 17 | endfunction 18 | 19 | function! s:Search(dir, search_buffer, text) abort 20 | call s:StopLastSearch() 21 | 22 | let l:words = map( 23 | \ split(a:text, ' \+'), 24 | \ ''' | rg -- '' . escape(shellescape(v:val), ''#'')', 25 | \) 26 | let l:command = 'rg --files' . join(l:words, '') . ' | sort' 27 | 28 | let l:lines = [] 29 | let s:job = job_start(['/bin/sh', '-c', l:command], { 30 | \ 'cwd': a:dir, 31 | \ 'out_mode': 'nl', 32 | \ 'out_cb': {_, line -> add(l:lines, line)}, 33 | \ 'exit_cb': {-> s:SetLines(a:search_buffer, l:lines)}, 34 | \}) 35 | endfunction 36 | 37 | function! s:HighlightLine(search_buffer, line) abort 38 | for l:match in getmatches() 39 | if l:match.group is# 'FileSearchCurrent' 40 | call matchdelete(l:match.id) 41 | endif 42 | endfor 43 | 44 | call matchaddpos('FileSearchCurrent', [a:line]) 45 | endfunction 46 | 47 | function! s:DebounceSearch(dir, search_buffer, text) abort 48 | call timer_stop(s:search_timer) 49 | let s:search_timer = timer_start(100, {-> s:Search(a:dir, a:search_buffer, a:text)}) 50 | endfunction 51 | 52 | function! file_search#ReadChars(dir, search_buffer) abort 53 | let l:text = '' 54 | let l:highlighted = 1 55 | 56 | while 1 57 | redraw 58 | echoh MoreMsg 59 | echon '> ' . l:text 60 | echoh None 61 | 62 | let l:code = getchar() 63 | let l:char = nr2char(l:code) 64 | 65 | if l:code is# "\" 66 | let l:text = l:text[:-2] 67 | " Move up with up arrow or CTRL+k 68 | elseif l:code is# "\" || l:char is# "\" 69 | let l:highlighted -= 1 70 | let l:highlighted = min([l:highlighted, line('$')]) 71 | call s:HighlightLine(a:search_buffer, l:highlighted) 72 | " Move down with down arrow or CTRL+j 73 | elseif l:code is# "\" || l:char is# "\" 74 | let l:highlighted += 1 75 | let l:highlighted = min([l:highlighted, line('$')]) 76 | call s:HighlightLine(a:search_buffer, l:highlighted) 77 | " Exit the search buffer with various keybinds. 78 | elseif l:char =~# "\\v\|\|\|\|\|\" 79 | bdelete! 80 | redraw 81 | 82 | return 83 | elseif l:char is# "\" 84 | let l:result = getbufline(a:search_buffer, l:highlighted) 85 | bdelete! 86 | redraw 87 | 88 | if !empty(l:result) 89 | let l:path = a:dir . '/' . l:result[0] 90 | execute 'tabnew ' . fnameescape(l:path) 91 | endif 92 | 93 | return 94 | else 95 | let l:text .= l:char 96 | endif 97 | 98 | if !empty(l:text) 99 | call s:DebounceSearch(a:dir, a:search_buffer, l:text) 100 | endif 101 | endwhile 102 | endfunction 103 | 104 | function! s:CreateFileSearchBuffer() abort 105 | if !hlexists('FileSearchCurrent') 106 | highlight FileSearchCurrent cterm=NONE ctermbg=DarkGray ctermfg=red guibg=DarkGray 107 | endif 108 | 109 | above new 110 | let l:buffer = bufnr() 111 | set filetype=file-search 112 | 113 | call s:HighlightLine(l:buffer, 1) 114 | 115 | return l:buffer 116 | endfunction 117 | 118 | function! file_search#FindProjectRoot() abort 119 | let l:dir = expand('%:p:h') 120 | 121 | while !empty(l:dir) 122 | if !empty(globpath(l:dir, '.git', 1)) 123 | return l:dir 124 | endif 125 | 126 | " Stop searching if the last dir was the root. 127 | if l:dir is# '/' 128 | return '' 129 | endif 130 | 131 | let l:dir = fnamemodify(l:dir, ':h') 132 | endwhile 133 | 134 | return l:dir 135 | endfunction 136 | 137 | function! file_search#OpenNewSearch() abort 138 | let l:dir = file_search#FindProjectRoot() 139 | 140 | if empty(l:dir) 141 | let l:dir = getcwd() 142 | endif 143 | 144 | let l:buffer = s:CreateFileSearchBuffer() 145 | call timer_start(0, {-> file_search#ReadChars(l:dir, l:buffer)}) 146 | endfunction 147 | -------------------------------------------------------------------------------- /autoload/js_tools.vim: -------------------------------------------------------------------------------- 1 | scriptencoding utf-8 2 | " Author: w0rp 3 | " Description: A module for providing extra JavaScript tools. 4 | 5 | function! js_tools#GetCursorInfo() abort 6 | let l:info = { 7 | \ 'describes': [], 8 | \ 'it': '', 9 | \} 10 | 11 | let l:describe_line_number = search('^ *describe(', 'bnW') 12 | 13 | if l:describe_line_number 14 | let l:last_indent = 1000000 15 | 16 | " for l:line in reverse(getline(1, getpos('.')[1])) 17 | for l:line in [] 18 | let l:match = matchlist(l:line, '\v^( *)describe\([''"`](.+)["''`]') 19 | 20 | if !empty(l:match) 21 | let l:indent = len(l:match[1]) 22 | 23 | if l:last_indent > l:indent 24 | call add(l:info.describes, l:match[2]) 25 | 26 | let l:last_indent = l:indent 27 | endif 28 | 29 | if empty(l:match[1]) 30 | break 31 | endif 32 | endif 33 | endfor 34 | 35 | let l:describe_line = getline(l:describe_line_number) 36 | 37 | let l:info.describes = [substitute( 38 | \ l:describe_line, 39 | \ '\v^ +describe\([''"`](.+)[''"`].*', 40 | \ '\1', 41 | \ '' 42 | \)[:20]] 43 | 44 | call reverse(l:info.describes) 45 | 46 | let l:it_line_number = search('^ \+it(', 'bnW') 47 | 48 | if l:it_line_number 49 | let l:it_line = getline(l:it_line_number) 50 | 51 | let l:info.it = substitute( 52 | \ l:it_line, 53 | \ '\v^ +it\([''"`](.+)[''"`].*', 54 | \ '\1', 55 | \ '' 56 | \)[:20] 57 | endif 58 | endif 59 | 60 | return l:info 61 | endfunction 62 | 63 | function! js_tools#GetStatus() abort 64 | if &filetype !=# 'typescript' && &filetype !=# 'javascript' 65 | return '' 66 | endif 67 | 68 | let l:info = js_tools#GetCursorInfo() 69 | 70 | if !empty(l:info.describes) 71 | let l:text = join(l:info.describes, ' › ') 72 | 73 | if !empty(l:info.it) 74 | let l:text .= ' › ' . l:info.it 75 | endif 76 | 77 | return l:text 78 | endif 79 | 80 | return '' 81 | endfunction 82 | -------------------------------------------------------------------------------- /autoload/json.vim: -------------------------------------------------------------------------------- 1 | function! s:KeyCmp(left, right) abort 2 | if a:left[0] < a:right[0] 3 | return -1 4 | endif 5 | 6 | if a:left[0] > a:right[0] 7 | return 1 8 | endif 9 | 10 | return 0 11 | endfunction 12 | 13 | function! s:PrettyLinesImpl(json_object, level) abort 14 | let l:items = [] 15 | 16 | if type(a:json_object) == type({}) 17 | call add(l:items, [a:level, '{']) 18 | 19 | for [l:key, l:value] in sort(items(a:json_object), function('s:KeyCmp')) 20 | " Add commas between items. 21 | if len(l:items) > 1 22 | let l:items[-1][1] = l:items[-1][1] . ',' 23 | endif 24 | 25 | if type(l:value) == type({}) 26 | let l:sub_items = s:PrettyLinesImpl(l:value, a:level + 1) 27 | call add(l:items, [a:level + 1, string(l:key) . ': {']) 28 | call extend(l:items, l:sub_items[1:]) 29 | elseif type(l:value) == type([]) 30 | let l:sub_items = s:PrettyLinesImpl(l:value, a:level + 1) 31 | call add(l:items, [a:level + 1, string(l:key) . ': [']) 32 | call extend(l:items, l:sub_items[1:]) 33 | else 34 | call add(l:items, [ 35 | \ a:level + 1, 36 | \ string(l:key) . ': ' . string(l:value), 37 | \]) 38 | endif 39 | endfor 40 | 41 | call add(l:items, [a:level, '}']) 42 | elseif type(a:json_object) == type([]) 43 | call add(l:items, [a:level, '[']) 44 | 45 | for l:value in a:json_object 46 | " Add commas between items. 47 | if len(l:items) > 1 48 | let l:items[-1][1] = l:items[-1][1] . ',' 49 | endif 50 | 51 | let l:sub_items = s:PrettyLinesImpl(l:value, a:level + 1) 52 | 53 | call extend(l:items, l:sub_items) 54 | endfor 55 | 56 | call add(l:items, [a:level, ']']) 57 | else 58 | call add(l:items, [a:level, string(a:json_object)]) 59 | endif 60 | 61 | return l:items 62 | endfunction 63 | 64 | function! json#PrettyLines(json_object, spaces) abort 65 | let l:lines_with_level = s:PrettyLinesImpl(a:json_object, 0) 66 | 67 | return map(l:lines_with_level, 'repeat('' '', v:val[0] * a:spaces) . v:val[1]') 68 | endfunction 69 | 70 | function! json#MakeStringPretty(spaces) abort 71 | let l:line_number = getcurpos()[1] 72 | let l:line = getline(l:line_number) 73 | 74 | let l:match = matchlist(l:line, '\v^(.*)''(\{.*\})''(.*$)') 75 | 76 | if empty(l:match) 77 | return 78 | endif 79 | 80 | let l:head = l:match[1] 81 | let l:json_string = l:match[2] 82 | let l:tail = l:match[3] 83 | 84 | let l:cont = matchstr(l:head, '^ *\\ *') 85 | 86 | if empty(l:cont) 87 | let l:cont = '\' 88 | endif 89 | 90 | let l:json_object = json_decode(l:json_string) 91 | 92 | let l:json_lines = json#PrettyLines(l:json_object, a:spaces) 93 | 94 | let l:formatted_lines = [l:head . 'json_encode(' . l:json_lines[0]] 95 | call extend(l:formatted_lines, map( 96 | \ l:json_lines[1:-2], 97 | \ l:cont is# '\' ? 'l:cont . v:val[1:]' : 'l:cont . v:val' 98 | \)) 99 | call add(l:formatted_lines, l:cont . l:json_lines[-1] . ')' . l:tail) 100 | 101 | call setline(1, 102 | \ getline(1, l:line_number - 1) 103 | \ + l:formatted_lines 104 | \ + getline(l:line_number + 1, '$') 105 | \) 106 | endfunction 107 | -------------------------------------------------------------------------------- /autoload/snippet_functions.vim: -------------------------------------------------------------------------------- 1 | function! snippet_functions#VimFunctionPrefix() abort 2 | let l:col = getcurpos()[2] 3 | 4 | if l:col > 2 5 | return '' 6 | endif 7 | 8 | let l:filename = expand('%:p') 9 | let l:autoload_path_segment = matchstr(l:filename, 'autoload[^.]*') 10 | let l:prefix = join(split(l:autoload_path_segment, '/')[1:], '#') 11 | 12 | return !empty(l:prefix) ? l:prefix . '#' : '' 13 | endfunction 14 | 15 | function! snippet_functions#VimFunctionPostfix() abort 16 | let l:col = getcurpos()[2] 17 | 18 | if l:col > 2 19 | return 'closure abort' 20 | endif 21 | 22 | return 'abort' 23 | endfunction 24 | 25 | function! snippet_functions#MagicTypeScriptInterfaceName() abort 26 | let l:line = getline(search('interface', 'bn')) 27 | 28 | if empty(l:line) 29 | return '' 30 | endif 31 | 32 | let l:match = matchlist(l:line, 'interface \([a-zA-Z0-9]\+\)') 33 | 34 | if empty(l:match) 35 | return '' 36 | endif 37 | 38 | return ' ' . l:match[1] 39 | endfunction 40 | -------------------------------------------------------------------------------- /autoload/startup/autocmd.vim: -------------------------------------------------------------------------------- 1 | augroup RestoreCursorPositionGroup 2 | autocmd! 3 | " Restore cursor positions for edited files. 4 | au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 5 | augroup END 6 | 7 | augroup FiletypeGroup 8 | autocmd! 9 | " Treat lzz files like cpp files. 10 | au BufNewFile,BufRead *.lzz set filetype=cpp 11 | " .md is a markdown file. 12 | au BufNewFile,BufRead *.md set filetype=markdown 13 | " .pug is a Pug file. 14 | au BufNewFile,BufRead *.pug set filetype=pug 15 | " .vader is a Vader file 16 | au BufNewFile,BufRead *.vader set filetype=vader 17 | " .ts is a Typescript file 18 | au FileType typescript JsPreTmpl 19 | au BufNewFile,BufRead *.ts set filetype=typescript 20 | " .pyi is a Python interface file. 21 | au BufNewFile,BufRead *.pyi set filetype=python 22 | " .dart is a Dart file 23 | au BufNewFile,BufRead *.dart set filetype=dart 24 | " .sublime-files are JSON files. 25 | au BufRead,BufNewFile *.sublime-project set filetype=json 26 | au BufRead,BufNewFile *.cson set filetype=coffee 27 | " Go files 28 | au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl 29 | augroup END 30 | 31 | function! startup#autocmd#StopProfiling() abort 32 | if v:profiling 33 | profile pause 34 | endif 35 | endfunction 36 | 37 | " Automatically stop profiling when Vim exits. 38 | augroup StopProfilingGroup 39 | autocmd! 40 | autocmd VimLeavePre :call startup#autocmd#StopProfiling() 41 | augroup END 42 | 43 | " Do auto whitespace trimming. 44 | function! startup#autocmd#TrimWhitespace() abort 45 | let l:pos = getcurpos() 46 | silent! execute '%s/\s*$//' 47 | call setpos('.', l:pos) 48 | endfunction 49 | 50 | augroup TrimWhiteSpaceGroup 51 | autocmd! 52 | autocmd FileWritePre * :call startup#autocmd#TrimWhitespace() 53 | autocmd FileAppendPre * :call startup#autocmd#TrimWhitespace() 54 | autocmd FilterWritePre * :call startup#autocmd#TrimWhitespace() 55 | autocmd BufWritePre * :call startup#autocmd#TrimWhitespace() 56 | augroup END 57 | 58 | function! startup#autocmd#MergeCompleteText(completed_item) abort 59 | if !has_key(a:completed_item, 'word') 60 | return 61 | endif 62 | 63 | let l:pos = getpos('.') 64 | let l:line = l:pos[1] 65 | let l:col = l:pos[2] - 1 66 | 67 | let l:line_text = getline(l:line) 68 | 69 | let l:word = a:completed_item.word 70 | let l:word_len = len(l:word) 71 | 72 | for l:index in range(l:word_len) 73 | let l:left = l:word[l:index : ] 74 | let l:right = l:line_text[l:col : l:col + len(l:left) - 1] 75 | 76 | if l:left is# l:right 77 | call setline( 78 | \ l:line, 79 | \ l:line_text[: l:col - 1] 80 | \ . l:line_text[l:col + (l:word_len - l:index) :] 81 | \) 82 | 83 | break 84 | endif 85 | endfor 86 | endfunction 87 | 88 | augroup AutoMergeCompleteText 89 | autocmd! 90 | autocmd CompleteDone * call startup#autocmd#MergeCompleteText(v:completed_item) 91 | augroup END 92 | 93 | augroup FixAfterComplete 94 | autocmd! 95 | " Run ALEFix when completion items are added. 96 | autocmd User ALECompletePost ALEFix! 97 | " If ALE starts fixing a file, stop linters running for now. 98 | autocmd User ALEFixPre ALELintStop 99 | augroup END 100 | 101 | augroup Quickfix 102 | autocmd! 103 | " Automatically close quickfix after making a selection. 104 | autocmd FileType qf nnoremap :cclose 105 | augroup END 106 | 107 | function! startup#autocmd#Init() abort 108 | endfunction 109 | -------------------------------------------------------------------------------- /autoload/startup/command_abbreviations.vim: -------------------------------------------------------------------------------- 1 | " Description: Abbreviations for various commands. 2 | 3 | cnoreabbrev ar ALERename 4 | cnoreabbrev ah ALEHover 5 | cnoreabbrev af ALEFindReferences 6 | cnoreabbrev ag ALEGoToDefinition 7 | cnoreabbrev ai ALEInfo 8 | 9 | function! startup#command_abbreviations#Init() abort 10 | endfunction 11 | -------------------------------------------------------------------------------- /autoload/startup/common.vim: -------------------------------------------------------------------------------- 1 | function! FixNewlines() abort 2 | execute '%s/\r//g' 3 | endfunction 4 | 5 | " A function because I can never remember what to type for this. 6 | function! UnixMode() abort 7 | :e ++ff=unix 8 | endfunction 9 | 10 | " A function for setting the execute bit for scripts. 11 | function! NewBashScript() abort 12 | :0put =\"#!/usr/bin/env bash\" 13 | :1put =\"\" 14 | :2put =\"set -eu\" 15 | :w! % 16 | :silent !chmod ug+x % 17 | :e! % 18 | endfunction 19 | 20 | command! Bash call NewBashScript() 21 | 22 | " A function for setting the execute bit for scripts. 23 | function! NewPythonScript() abort 24 | :0put =\"#!/usr/bin/env python \" 25 | :w! % 26 | :silent !chmod ug+x % 27 | :e! % 28 | endfunction 29 | 30 | command! Python call NewPythonScript() 31 | 32 | " This is created for the benefit of snippet magic. 33 | function! WriteReload() abort 34 | exec 'w' 35 | exec 'e' 36 | 37 | return '' 38 | endfunction 39 | 40 | function! StartProfiling() abort 41 | profile start ~/profile.log 42 | profile func * 43 | profile file * 44 | endfunction 45 | 46 | command! -nargs=0 CloseTabsToTheRight :silent! .+1,$tabdo :tabc 47 | command! -nargs=0 PrettyJSON :silent call json#MakeStringPretty(2) 48 | 49 | function! WordDiffLines(line1, line2) abort 50 | unsilent echom 'Differences:' system(printf( 51 | \ 'wdiff <(echo %s) <(echo %s)', 52 | \ shellescape(getline(a:line1)), 53 | \ shellescape(getline(a:line2)), 54 | \))[:-2] 55 | endfunction 56 | 57 | command! -range=% WordDiff :silent call WordDiffLines(, ) 58 | 59 | " A command for dumping Vim variables for debugging. 60 | command! -nargs=+ Dump :echom . ': ' . string() 61 | 62 | " Evaluate an expression 1000 times and say how long it took in milliseconds. 63 | command! -nargs=+ -complete=expression PerformanceRun :let s:start = float2nr(reltimefloat(reltime()) * 1000) 64 | \ | for s:x in range(1000) | call eval() | endfor 65 | \ | :let s:end = float2nr(reltimefloat(reltime()) * 1000) 66 | \ | :echom 'Took ' . (s:end - s:start) . 'ms' 67 | \ | :unlet! s:start s:x s:end 68 | 69 | " Commands for quickly edting commonly edited files. 70 | function! EditVimFile(relative_path) abort 71 | let l:vim_dir = expand('~/.vim/') 72 | 73 | execute 'tabnew ' . fnameescape(l:vim_dir . a:relative_path) 74 | endfunction 75 | 76 | command! EditCommon :call EditVimFile('autoload/startup/common.vim') 77 | command! EditKeybinds :call EditVimFile('autoload/startup/keybinds.vim') 78 | command! EditSnippets :call EditVimFile('snippets/' . &filetype . '.snippets') 79 | command! EditSyntax :call EditVimFile('syntax/' . &filetype . '.vim') 80 | command! EditFtPlugin :call EditVimFile('ftplugin/' . &filetype . '.vim') 81 | 82 | function! startup#common#IgnoreError(buffer) abort 83 | let l:Func = getbufvar(a:buffer, 'Ignore') 84 | 85 | if type(l:Func) != type(function('type')) 86 | return 87 | endif 88 | 89 | call l:Func(a:buffer) 90 | endfunction 91 | 92 | 93 | command! Ignore :call startup#common#IgnoreError(bufnr('')) 94 | 95 | function! startup#common#UpdateIndexFile() abort 96 | if &filetype =~# 'typescript' 97 | call setline(1, map(glob('*', 1, 1), {_,x -> 'export * from ''./' . substitute(x, '\v\.ts', '', '') . ''''})) 98 | endif 99 | endfunction 100 | 101 | command! UpdateIndexFile :call startup#common#UpdateIndexFile() 102 | 103 | function! startup#common#Init() abort 104 | endfunction 105 | -------------------------------------------------------------------------------- /autoload/startup/keybinds.vim: -------------------------------------------------------------------------------- 1 | function! startup#keybinds#TryToOpenLink() abort 2 | let l:pos = getcurpos() 3 | let l:lnum = l:pos[1] 4 | let l:col = l:pos[2] 5 | let l:line = getline(l:lnum) 6 | 7 | " TODO: handle multiple lines on a single line better. 8 | let l:index = match(l:line[0 : l:col + len('https://')], '\vhttps?://') 9 | 10 | if l:index >= 0 && l:index < l:col 11 | let l:link = matchstr(l:line[l:index :], '\v[^ )]+') 12 | " Remove CR characters from links. 13 | let l:link = substitute(l:link, '\r', '', 'g') 14 | 15 | call job_start(['xdg-open', l:link]) 16 | return 1 17 | endif 18 | 19 | return 0 20 | endfunction 21 | 22 | " This script holds all keybinding settings. 23 | 24 | nnoremap :call startup#keybinds#TryToOpenLink() 25 | nnoremap :call startup#keybinds#TryToOpenLink() 26 | nnoremap 27 | 28 | " Disable replace mode, which turns on in bad terminals for some reason. 29 | nnoremap R 30 | 31 | " CTRL-A is Select all 32 | " This works better than the default Windows script. 33 | noremap ggVG 34 | inoremap ggvG 35 | vnoremap ggVG 36 | 37 | " Make double-tapping ESC in normal mode quit a file. 38 | nnoremap :q 39 | " Triple-tapping ESC forces quitting. 40 | nnoremap :q! 41 | 42 | " Make Shift+V switch from selection to visual line mode on Windows, etc. 43 | snoremap V gvV 44 | 45 | " CTRL-C is copy to the clipboard 46 | vnoremap y 47 | snoremap gv"+y 48 | 49 | " CTRL-X is cut to the clipboard 50 | vnoremap "+x 51 | 52 | " CTRL-V pastes from the clipboard 53 | noremap p 54 | inoremap + 55 | cnoremap + 56 | 57 | " CTRL-P replaces the current line with the buffer without cutting it. 58 | noremap "_ddP 59 | " p in visual mode shouldn't cut the text we replace. 60 | vnoremap

"_dP 61 | 62 | " CTRL-S Saves the file. 63 | noremap :w 64 | vnoremap :w 65 | inoremap :w 66 | 67 | " SHIFT-S Saves the file. 68 | noremap S :w 69 | 70 | " Quit files by typing fjfj quickly, which requires less stretching. 71 | noremap fjfj :q 72 | 73 | " Make using Ctrl+C do the same as Escape, to trigger autocmd commands 74 | inoremap 75 | 76 | " Bind gV so we can re-select pasted text. 77 | nnoremap gV "`[".getregtype(v:register)[0]."`]" 78 | 79 | " Bind Ctrl + Tab goes forward 80 | noremap :tabn 81 | tnoremap N:tabn 82 | " Bind Ctrl + Shift + Tab goes back 83 | noremap :tabp 84 | tnoremap N:tabp 85 | 86 | " Ctrl + h goes to the tab to the left. 87 | noremap :tabp 88 | " Ctrl + l goes to the tab to the right. 89 | noremap :tabn 90 | 91 | " Bind Ctrl + t to opening new tabs. 92 | noremap :tabnew 93 | 94 | " Ctrl + j goes down a window. 95 | noremap j 96 | " Ctrl + k goes up a window. 97 | noremap k 98 | 99 | " Make Ctrl+B do exactly the same thing as Ctrl+U. 100 | nnoremap 101 | 102 | " Map Ctrl-B to delete to the end of line in insert mode. 103 | inoremap lDa 104 | 105 | " Movement left and right in insert mode with Ctrl. 106 | inoremap la 107 | inoremap i 108 | 109 | " Disable Ex mode, because fuck Ex mode. 110 | noremap Q 111 | " Use semicolons for what colon does. 112 | noremap ; : 113 | 114 | " Bind keys for moving between warnings. 115 | nmap , (ale_previous_wrap) 116 | nmap m (ale_next_wrap) 117 | 118 | " Use Ctrl+Tab to autocomplete in all filetypes. 119 | imap (ale_complete) 120 | 121 | " --- Function key bindings in order --- 122 | 123 | function! startup#keybinds#RedrawSearch() abort 124 | if get(g:, 'f3_redraw') is# 'ale' 125 | ALERepeatSelection 126 | else 127 | copen 128 | endif 129 | endfunction 130 | 131 | function! startup#keybinds#SwitchToProjectRoot() abort 132 | let s:old_search_cwd = getcwd() 133 | let l:dir = file_search#FindProjectRoot() 134 | 135 | if !empty(l:dir) 136 | execute 'cd ' . fnameescape(l:dir) 137 | endif 138 | endfunction 139 | 140 | function! startup#keybinds#SwitchBackToOldCwd() abort 141 | execute 'cd ' . fnameescape(s:old_search_cwd) 142 | endfunction 143 | 144 | function! startup#keybinds#PerformGrep(cleaned_args) abort 145 | let g:f3_redraw = 'grep' 146 | call startup#keybinds#SwitchToProjectRoot() 147 | 148 | let g:f3_redraw_repeat_search = a:cleaned_args 149 | 150 | execute 'silent grep! ' . a:cleaned_args 151 | cwindow 152 | call startup#keybinds#SwitchBackToOldCwd() 153 | endfunction 154 | 155 | function! startup#keybinds#Grep(original_pattern) abort 156 | let l:pattern = a:original_pattern 157 | 158 | " Try to match strings like ["foo"] and ['bar'] 159 | let l:key_match = matchlist(l:pattern, '\v^\[(\s*[''"][^''"]+[''"]\s*)\]$') 160 | 161 | if !empty(l:key_match) 162 | " Replace the above example if provided, 163 | " with an exact search for the above, not a very expensive [] search. 164 | let l:pattern = '\[' . l:key_match[1] . '\]' 165 | endif 166 | 167 | let l:escaped_pattern = escape(shellescape(l:pattern), '#|%') 168 | 169 | call startup#keybinds#PerformGrep(l:escaped_pattern) 170 | endfunction 171 | 172 | function! startup#keybinds#RepeatGrep() abort 173 | if exists('g:f3_redraw_repeat_search') 174 | call startup#keybinds#PerformGrep(g:f3_redraw_repeat_search) 175 | else 176 | echoerr 'No search to repeat' 177 | endi 178 | endfunction 179 | 180 | command! -nargs=+ Grep call startup#keybinds#Grep() 181 | 182 | " Bind F1 to showing details of ALE errors. 183 | noremap :ALEDetail 184 | " Toggle the project NERD tree with F2 185 | noremap :ToggleNERDTree 186 | " Search for files in the project with Ctrl+H 187 | noremap :call startup#keybinds#RedrawSearch() 188 | " Map F4 to copying the current filename to the clipboard. 189 | noremap :call startup#keybinds#CopyNameToClipboard() 190 | nmap (ale_find_references) 191 | " Use Vim's built in grep with ripgrep to search in files. 192 | noremap :Grep 193 | 194 | if !has('gui_macvim') 195 | " Ctrl+shift+f repeats the last search. 196 | noremap :call startup#keybinds#RepeatGrep() 197 | endif 198 | 199 | " Use ripgrep to fuzzy find files. 200 | noremap :call file_search#OpenNewSearch() 201 | " Bind F7 To recording speech with vim-speech. 202 | " noremap :SpeechToggle 203 | " Bind F8 to fixing problems with ALE 204 | nmap (ale_fix) 205 | inoremap (ale_fix) 206 | 207 | " Use Ctrl+y to go to the definition of something. 208 | nmap (ale_go_to_definition) 209 | " Use Ctrl+u to go to the type definition of something. 210 | nmap (ale_go_to_type_definition) 211 | 212 | if has('syntax') 213 | " Use F12 to resync syntax from the start. 214 | noremap :syntax sync fromstart 215 | inoremap :syntax sync fromstart 216 | endif 217 | 218 | function! startup#keybinds#CopyNameToClipboard() abort 219 | let l:filename = expand('%:p') 220 | 221 | " Look through a configured array of prefixes to remove, and remove 222 | " them from the filename if any match. 223 | for l:regex in g:path_remove_regex_list 224 | let [l:match, l:start, l:end] = matchstrpos(l:filename, l:regex) 225 | 226 | if !empty(l:match) 227 | let l:filename = l:start > 0 228 | \ ? l:filename[: l:start - 1] . l:filename[l:end :] 229 | \ : l:filename[l:end :] 230 | 231 | break 232 | endif 233 | endfor 234 | 235 | let l:text = l:filename 236 | 237 | if &filetype =~# 'python' 238 | let l:info = python_tools#cursor_info#GetInfo() 239 | 240 | if !empty(get(l:info, 'class', '')) 241 | let l:text .= '::' . l:info.class 242 | endif 243 | 244 | if !empty(get(l:info, 'def', '')) 245 | let l:text .= '::' . l:info.def 246 | endif 247 | endif 248 | 249 | 250 | let @+ = l:text 251 | echo 'Filename and function name copied to clipboard' 252 | endfunction 253 | 254 | " Make pressing Enter accept a completion entry. 255 | function! SmartEnter() 256 | if pumvisible() 257 | return "\" 258 | endif 259 | 260 | return "\" 261 | endfunction 262 | 263 | " Use Tab and Shift+Tab for either completion or SnipMate. 264 | function! SmartTab() abort 265 | if pumvisible() 266 | let l:keys = "\" 267 | 268 | if get(b:, 'ale_last_completion_count') is 1 269 | let l:keys .= "\\" 270 | endif 271 | 272 | return l:keys 273 | endif 274 | 275 | return snipMate#TriggerSnippet() 276 | endfunction 277 | 278 | function! SmartShiftTab() abort 279 | if pumvisible() 280 | return "\" 281 | endif 282 | 283 | return snipMate#BackwardsSnippet() 284 | endfunction 285 | 286 | function! SmartInsertCompletion() abort 287 | if pumvisible() 288 | return "\" 289 | endif 290 | 291 | return "\a\" 292 | endfunction 293 | 294 | inoremap =SmartEnter() 295 | inoremap =SmartTab() 296 | inoremap =SmartShiftTab() 297 | inoremap =SmartInsertCompletion() 298 | 299 | " Use Ctrl+n to prompt Neural in normal mode 300 | noremap (neural_prompt) 301 | " Use Ctrl+n in Visual mode to explain code. 302 | vnoremap (neural_explain) 303 | 304 | " Close split windows just by pressing 'q', but record macros if there is only 305 | " one window open. 306 | " 307 | " I never record macros while working with split windows. 308 | function! startup#keybinds#CloseSplitWindowsWithQ() abort 309 | let l:tab_info = gettabinfo(tabpagenr())[0] 310 | 311 | if len(l:tab_info.windows) > 1 312 | " Close the terminal window instead of the current one. 313 | for l:win_id in l:tab_info.windows 314 | let l:bufnr = getwininfo(l:win_id)[0].bufnr 315 | let l:bufname = expand('#' . l:bufnr . ':p') 316 | 317 | if l:bufname =~# '^!/bin' 318 | execute 'bwipeout ' . l:bufnr 319 | return 320 | endif 321 | endfor 322 | 323 | :q 324 | else 325 | call feedkeys('q', 'n') 326 | endif 327 | endfunction 328 | 329 | nnoremap q :call startup#keybinds#CloseSplitWindowsWithQ() 330 | 331 | " Bind // so it sets up an expression for replacing the previous match. 332 | noremap // :%s// 333 | 334 | noremap gs :SplitjoinSplit:ALEFix 335 | noremap gj :SplitjoinJoin 336 | 337 | " Quit terminals with just 'q' 338 | tnoremap q N:q! 339 | 340 | function! startup#keybinds#RunTests() abort 341 | if !exists('b:test_command') 342 | echom 'b:test_command is not defined' 343 | 344 | return 345 | endif 346 | 347 | belowright call term_start(['/bin/sh', '-c', b:test_command]) 348 | endfunction 349 | 350 | noremap :call startup#keybinds#RunTests() 351 | 352 | function! startup#keybinds#Init() abort 353 | endfunction 354 | -------------------------------------------------------------------------------- /autoload/startup/spelling_corrections.vim: -------------------------------------------------------------------------------- 1 | " This file lists some settings for automatically fixing common spelling 2 | " mistakes. 3 | 4 | iab mighht might 5 | iab notifidationc notifications 6 | iab notificaitons notifications 7 | iab meail email 8 | iab mesage message 9 | iab templatse templates 10 | iab suppport support 11 | iab supprot support 12 | iab getitng getting 13 | iab needeed needed 14 | 15 | function! startup#spelling_corrections#FixCurrentMistakes() abort 16 | let l:output = '' 17 | redir => l:output 18 | silent iab 19 | redir END 20 | let l:output_list = split(l:output, "\n") 21 | 22 | let l:replacements = {} 23 | 24 | for l:line in l:output_list 25 | let l:match = matchlist(l:line, '\v^i *([a-zA-Z]+) *([a-zA-Z]+) *$') 26 | 27 | if !empty(l:match) 28 | let l:replacements[l:match[1]] = l:match[2] 29 | endif 30 | endfor 31 | 32 | let l:regex = '\V\(' . join(keys(l:replacements), '\|') . '\)' 33 | 34 | try 35 | execute '%s/' . l:regex . '/\=l:replacements[submatch(1)]/gc' 36 | catch /E486/ 37 | " Shut up about finding no matches. 38 | endtry 39 | endfunction 40 | 41 | command! -bar FixSpellingMistakes :call startup#spelling_corrections#FixCurrentMistakes() 42 | 43 | function! startup#spelling_corrections#Init() abort 44 | endfunction 45 | -------------------------------------------------------------------------------- /autoload/test_json.vader: -------------------------------------------------------------------------------- 1 | Given(A file with some ugly JSON string): 2 | " Don't mess up this line 3 | let g:some_json = '{"x": {"a": true, "b": false, "c": null}, "wat": [347, "foo"]}' 4 | " Don't mess up this line either 5 | 6 | Execute(Call the function to make the line pretty): 7 | call setpos('.', [bufnr(''), 2, 1, 0]) 8 | call json#MakeStringPretty(2) 9 | 10 | Expect(The JSON should be pretty now): 11 | " Don't mess up this line 12 | let g:some_json = json_encode({ 13 | \ 'wat': [ 14 | \ 347, 15 | \ 'foo' 16 | \ ], 17 | \ 'x': { 18 | \ 'a': v:true, 19 | \ 'b': v:false, 20 | \ 'c': v:null 21 | \ } 22 | \}) 23 | " Don't mess up this line either 24 | 25 | Execute(Try a different amount of spacing): 26 | call setpos('.', [bufnr(''), 2, 1, 0]) 27 | call json#MakeStringPretty(4) 28 | 29 | Expect(The different spacing should be used): 30 | " Don't mess up this line 31 | let g:some_json = json_encode({ 32 | \ 'wat': [ 33 | \ 347, 34 | \ 'foo' 35 | \ ], 36 | \ 'x': { 37 | \ 'a': v:true, 38 | \ 'b': v:false, 39 | \ 'c': v:null 40 | \ } 41 | \}) 42 | " Don't mess up this line either 43 | 44 | Given(A file with some ugly JSON string in a larger expression): 45 | Execute('bla bla bla'): 46 | AssertEqual 47 | \ [ 48 | \ {}, 49 | \ ], 50 | \ ale#handlers#foo#HandleAThing(bufnr(''), [ 51 | \ '{"x": {"a": true, "b": false, "c": null}, "wat": [347, "foo"]}', 52 | \ ]) 53 | 54 | Execute(Make the nested expression pretty): 55 | call search('wat.*347') 56 | call json#MakeStringPretty(2) 57 | 58 | Expect(The inner expression should be indented properly): 59 | Execute('bla bla bla'): 60 | AssertEqual 61 | \ [ 62 | \ {}, 63 | \ ], 64 | \ ale#handlers#foo#HandleAThing(bufnr(''), [ 65 | \ json_encode({ 66 | \ 'wat': [ 67 | \ 347, 68 | \ 'foo' 69 | \ ], 70 | \ 'x': { 71 | \ 'a': v:true, 72 | \ 'b': v:false, 73 | \ 'c': v:null 74 | \ } 75 | \ }), 76 | \ ]) 77 | 78 | Given(A file with a line to fix with keys out of order): 79 | let g:some_json = '{"c": 0, "b": 0, "a": 0}' 80 | 81 | Execute(Make the nested expression pretty): 82 | call setpos('.', [bufnr(''), 1, 1, 0]) 83 | call json#MakeStringPretty(2) 84 | 85 | Expect(The keys should be sorted appropriately): 86 | let g:some_json = json_encode({ 87 | \ 'a': 0, 88 | \ 'b': 0, 89 | \ 'c': 0 90 | \}) 91 | -------------------------------------------------------------------------------- /autoload/vader_tools.vim: -------------------------------------------------------------------------------- 1 | function! s:StrList(list) abort 2 | return map(copy(a:list), 'string(v:val)') 3 | endfunction 4 | 5 | function! s:DiffLists(expected_list, actual_list) abort 6 | let l:expected_file = tempname() 7 | call writefile(s:StrList(a:expected_list), l:expected_file) 8 | 9 | let l:actual_file = tempname() 10 | call writefile(s:StrList(a:actual_list), l:actual_file) 11 | 12 | try 13 | let l:command = printf( 14 | \ 'diff -u %s %s | tail -n +3', 15 | \ shellescape(l:expected_file), 16 | \ shellescape(l:actual_file), 17 | \) 18 | let l:output = systemlist(l:command) 19 | finally 20 | call delete(l:expected_file) 21 | call delete(l:actual_file) 22 | endtry 23 | 24 | return l:output 25 | endfunction 26 | 27 | function! vader_tools#ReplaceListsWithDiffs() abort 28 | set modifiable 29 | let l:offset = 0 30 | let l:line_list = getline(1, '$') 31 | 32 | for l:index in range(len(l:line_list)) 33 | let l:line = l:line_list[l:index] 34 | 35 | let l:match = matchlist( 36 | \ l:line, 37 | \ '\v^(.*Unequal Lists)[ \n]*(\[.+\]) should be equal to[ \n]+(\[.+\])', 38 | \) 39 | 40 | if !empty(l:match) 41 | let l:lines_to_add = s:DiffLists(eval(l:match[3]), eval(l:match[2])) 42 | 43 | call setline(l:index + 1 + l:offset, l:match[1]) 44 | call append(l:index + 1 + l:offset, l:lines_to_add) 45 | let l:offset += len(l:lines_to_add) 46 | endif 47 | endfor 48 | endfunction 49 | 50 | function! vader_tools#TryAndMakeEverythingBetter() abort 51 | if &filetype isnot# 'vader-result' 52 | return 53 | endif 54 | 55 | " call vader_tools#ReplaceListsWithDiffs() 56 | endfunction 57 | -------------------------------------------------------------------------------- /autoload/w0rp/string.vader: -------------------------------------------------------------------------------- 1 | Execute(w0rp#string#ToKebabCase should convert strings to kebab case correctly): 2 | AssertEqual 'foo-bar-baz', w0rp#string#ToKebabCase('fooBarBaz') 3 | AssertEqual 'foo-bar-baz', w0rp#string#ToKebabCase('FooBarBaz') 4 | -------------------------------------------------------------------------------- /autoload/w0rp/string.vim: -------------------------------------------------------------------------------- 1 | function! s:ApplyToLines(line, end_line, Callback) abort 2 | let l:lines = getline(1, '$') 3 | 4 | for l:index in range(a:line - 1, a:end_line - 1) 5 | let l:lines[l:index] = function(a:Callback)(l:lines[l:index]) 6 | endfor 7 | 8 | call setline(1, l:lines) 9 | endfunction 10 | 11 | function! w0rp#string#ToKebabCase(string) abort 12 | let l:string = a:string 13 | let l:string = substitute(l:string, '\C\([A-Z]\)', {m -> '-' . tolower(m[1])}, 'g') 14 | let l:string = substitute(l:string, '^-', '', '') 15 | 16 | return l:string 17 | endfunction 18 | 19 | command! -range ToKebabCase :call s:ApplyToLines(, , 'w0rp#string#ToKebabCase') 20 | -------------------------------------------------------------------------------- /colors/darkspectrum.vim: -------------------------------------------------------------------------------- 1 | " Vim color file 2 | " 3 | " Author: Brian Mock 4 | " 5 | " Note: Based on Oblivion color scheme for gedit (gtk-source-view) 6 | " 7 | " cool help screens 8 | " :he group-name 9 | " :he highlight-groups 10 | " :he cterm-colors 11 | 12 | hi clear 13 | 14 | set background=dark 15 | if version > 580 16 | " no guarantees for version 5.8 and below, but this makes it stop 17 | " complaining 18 | hi clear 19 | if exists("syntax_on") 20 | syntax reset 21 | endif 22 | endif 23 | let g:colors_name="darkspectrum" 24 | 25 | hi Normal guifg=#efefef guibg=#2A2A2A 26 | 27 | " highlight groups 28 | hi Cursor guibg=#ffffff guifg=#000000 29 | hi CursorLine guibg=#000000 30 | "hi CursorLine guibg=#3e4446 31 | hi CursorColumn guibg=#464646 32 | 33 | "hi DiffText guibg=#4e9a06 guifg=#FFFFFF gui=bold 34 | "hi DiffChange guibg=#4e9a06 guifg=#FFFFFF gui=bold 35 | "hi DiffAdd guibg=#204a87 guifg=#FFFFFF gui=bold 36 | "hi DiffDelete guibg=#5c3566 guifg=#FFFFFF gui=bold 37 | 38 | hi DiffAdd guifg=#ffcc7f guibg=#a67429 gui=none 39 | hi DiffChange guifg=#7fbdff guibg=#425c78 gui=none 40 | hi DiffText guifg=#8ae234 guibg=#4e9a06 gui=none 41 | "hi DiffDelete guifg=#252723 guibg=#000000 gui=none 42 | hi DiffDelete guifg=#000000 guibg=#000000 gui=none 43 | "hi ErrorMsg 44 | 45 | hi Number guifg=#fce94f 46 | 47 | hi Folded guibg=#000000 guifg=#FFFFFF gui=bold 48 | hi vimFold guibg=#000000 guifg=#FFFFFF gui=bold 49 | hi FoldColumn guibg=#000000 guifg=#FFFFFF gui=bold 50 | 51 | hi LineNr guifg=#535353 guibg=#202020 52 | hi NonText guifg=#535353 guibg=#202020 53 | hi Folded guifg=#535353 guibg=#202020 gui=bold 54 | hi FoldeColumn guifg=#535353 guibg=#202020 gui=bold 55 | "hi VertSplit guibg=#ffffff guifg=#ffffff gui=none 56 | 57 | hi VertSplit guibg=#3C3C3C guifg=#3C3C3C gui=none 58 | hi StatusLine guifg=#FFFFFF guibg=#3C3C3C gui=none 59 | hi StatusLineNC guifg=#808080 guibg=#3C3C3C gui=none 60 | 61 | hi ModeMsg guifg=#fce94f 62 | hi MoreMsg guifg=#fce94f 63 | hi Visual guifg=#FFFFFF guibg=#3465a4 gui=none 64 | hi VisualNOS guifg=#FFFFFF guibg=#204a87 gui=none 65 | hi IncSearch guibg=#FFFFFF guifg=#ef5939 66 | hi Search guibg=#ad7fa8 guifg=#FFFFFF 67 | " Edited by w0rp to make tabs more subtle 68 | hi SpecialKey guifg=#2e630f 69 | 70 | hi Title guifg=#ef5939 71 | hi WarningMsg guifg=#ef5939 72 | hi Number guifg=#fcaf3e 73 | 74 | hi MatchParen guibg=#ad7fa8 guifg=#FFFFFF 75 | hi Comment guifg=#8a8a8a 76 | hi Constant guifg=#ef5939 gui=none 77 | hi String guifg=#fce94f 78 | hi Identifier guifg=#729fcf 79 | hi Statement guifg=#ffffff gui=bold 80 | hi PreProc guifg=#ffffff gui=bold 81 | hi Type guifg=#8ae234 gui=bold 82 | hi Special guifg=#e9b96e 83 | hi Underlined guifg=#ad7fa8 gui=underline 84 | hi Directory guifg=#729fcf 85 | hi Ignore guifg=#555753 86 | hi Todo guifg=#FFFFFF guibg=#ef5939 gui=bold 87 | hi Function guifg=#ad7fa8 88 | 89 | "hi WildMenu guibg=#2e3436 guifg=#ffffff gui=bold 90 | "hi WildMenu guifg=#7fbdff guibg=#425c78 gui=none 91 | hi WildMenu guifg=#ffffff guibg=#3465a4 gui=none 92 | 93 | hi Pmenu guibg=#000000 guifg=#c0c0c0 94 | hi PmenuSel guibg=#3465a4 guifg=#ffffff 95 | hi PmenuSbar guibg=#444444 guifg=#444444 96 | hi PmenuThumb guibg=#888888 guifg=#888888 97 | 98 | hi cppSTLType guifg=#729fcf gui=bold 99 | 100 | hi SpellBad guisp=#fcaf3e 101 | hi SpellCap guisp=#73d216 102 | hi SpellRare guisp=#ad7fa8 103 | hi SpellLocal guisp=#729fcf 104 | 105 | hi link cppSTL Function 106 | hi link Error Todo 107 | hi link Character Number 108 | hi link rubySymbol Number 109 | hi link htmlTag htmlEndTag 110 | "hi link htmlTagName htmlTag 111 | hi link htmlLink Underlined 112 | hi link pythonFunction Identifier 113 | hi link Question Type 114 | hi link CursorIM Cursor 115 | hi link VisualNOS Visual 116 | hi link xmlTag Identifier 117 | hi link xmlTagName Identifier 118 | hi link shDeref Identifier 119 | hi link shVariable Function 120 | hi link rubySharpBang Special 121 | hi link perlSharpBang Special 122 | hi link schemeFunc Statement 123 | "hi link shSpecialVariables Constant 124 | "hi link bashSpecialVariables Constant 125 | 126 | " tabs (non gui) 127 | hi TabLine guifg=#8a8a9a guibg=#202020 gui=none 128 | hi TabLineFill guifg=#535353 guibg=#202020 gui=none 129 | hi TabLineSel guifg=#FFFFFF gui=bold 130 | "hi TabLineSel guifg=#FFFFFF guibg=#000000 gui=bold 131 | " vim: sw=4 ts=4 132 | 133 | -------------------------------------------------------------------------------- /doc/xml-plugin.txt: -------------------------------------------------------------------------------- 1 | *xml-plugin.txt* Help edit XML and SGML documents. #version# 2 | 3 | XML Edit 4 | 5 | A filetype plugin to help edit XML and SGML documents. 6 | 7 | Version: 1.9.1 8 | 9 | This script provides some convenience when editing XML (and some SGML 10 | including HTML) formated documents. It allows you to jump to the beginning 11 | or end of the tag block your cursor is in. '%' will jump between '<' and '>' 12 | within the tag your cursor is in. When in insert mode and you finish a tag 13 | (pressing '>') the tag will be completed. If you press '>' twice it will 14 | complete the tag and place the cursor in the middle of the tags on it's own 15 | line (helps with nested tags). 16 | 17 | Usage: Place this file into your ftplugin directory. To add html support 18 | Sym-link or copy this file to html.vim in your ftplugin directory. To activte 19 | the script place 'filetype plugin on' in your |.vimrc| file. See |ftplugins| 20 | for more information on this topic. 21 | 22 | If the file edited is of type "html" and "xml_use_html" is defined then the 23 | following tags will not auto complete: 24 | , , , ,
,


, , , , 25 | 26 | If the file edited is of type 'html' and 'xml_use_xhtml' is defined the above 27 | tags will autocomplete the xml closing staying xhtml compatable. 28 | ex.
becomes
(see |xml-plugin-settings|) 29 | 30 | NOTE: If you used the VIM 5.x version of this file (xmledit.vim) you'll need 31 | to comment out the section where you called it. It is no longer used in the 32 | VIM 6.x version. 33 | 34 | To disable the plugin (especially for systems that include this plugin as part 35 | of the distrobution) you can use the following line in your .vimrc: 36 | > 37 | let loaded_xmledit = 1 38 | < 39 | Known Bugs 40 | 41 | - This script will modify registers ". and "x; register "" will be restored. 42 | - < & > marks inside of a CDATA section are interpreted as actual XML tags 43 | even if unmatched. 44 | - Although the script can handle leading spaces such as < tag> it is 45 | illegal XML syntax and considered very bad form. 46 | - Placing a literal `>' in an attribute value will auto complete dispite that 47 | the start tag isn't finished. This is poor XML anyway you should use 48 | > instead. 49 | - The matching algorithm can handle illegal tag characters where as the tag 50 | completion algorithm can not. 51 | 52 | ------------------------------------------------------------------------------ 53 | *xml-plugin-mappings* 54 | Mappings 55 | 56 | is a setting in VIM that depicts a prefix for scripts and 57 | plugins to use. By default this is the backslash key `\'. See |mapleader| 58 | for details. 59 | 60 | 61 | Normal or Insert - Continue editing after the ending tag. This 62 | option requires xml_jump_string to be set to function. When a tag 63 | is completed it will append the xml_jump_string. Once this mapping 64 | is ran it will delete the next xml_jump_string pattern to the right 65 | of the curser and delete it leaving you in insert mode to continue 66 | editing. 67 | 68 | w 69 | Normal - Will clear the entire file of left over xml_jump_string garbage. 70 | * This will also happen automatically when you save the file. * 71 | 72 | x 73 | Visual - Place a custom XML tag to suround the selected text. You 74 | need to have selected text in visual mode before you can use this 75 | mapping. See |visual-mode| for details. 76 | 77 | . or > 78 | Insert - Place a literal '>' without parsing tag. 79 | 80 | 5 or % 81 | Normal or Visual - Jump to the begining or end tag. 82 | 83 | d 84 | Normal - Deletes the surrounding tags from the cursor. > 85 | outter inner text text 86 | ^ 87 | < Turns to: > 88 | outter inner text text 89 | ^ 90 | < 91 | 92 | ------------------------------------------------------------------------------ 93 | *xml-plugin-settings* 94 | Options 95 | 96 | (All options must be placed in your |.vimrc| prior to the |ftplugin| 97 | command.) 98 | 99 | xml_tag_completion_map 100 | Use this setting to change the default mapping to auto complete a 101 | tag. By default typing a literal `>' will cause the tag your editing 102 | to auto complete; pressing twice will auto nest the tag. By using 103 | this setting the `>' will be a literal `>' and you must use the new 104 | mapping to perform auto completion and auto nesting. For example if 105 | you wanted Control-L to perform auto completion inmstead of typing a 106 | `>' place the following into your .vimrc: > 107 | let xml_tag_completion_map = "" 108 | < 109 | xml_tag_syntax_prefixes 110 | Sets a pattern that is used to distinguish XML syntax elements that 111 | identify xml tags. By defult the value is 'html\|xml\|docbk'. This 112 | means that all syntax items that start with "html", "xml" or "docbk" are 113 | treated as XML tags. In case a completion is triggered after a syntax 114 | element that does not match this pattern the end tag will not be inserted. 115 | The pattern should match at the beginning of a syntax element name. 116 | If you edit XSLT files you probably want to add "xsl" to the list (note 117 | the signle quotes): > 118 | let xml_tag_syntax_prefixes = 'html\|xml\|xsl\|docbk' 119 | < 120 | xml_no_auto_nesting 121 | This turns off the auto nesting feature. After a completion is made 122 | and another `>' is typed xml-edit automatically will break the tag 123 | accross multiple lines and indent the curser to make creating nested 124 | tqags easier. This feature turns it off. Enter the following in your 125 | .vimrc: > 126 | let xml_no_auto_nesting = 1 127 | < 128 | xml_use_xhtml 129 | When editing HTML this will auto close the short tags to make valid 130 | XML like
and
. Enter the following in your vimrc to 131 | turn this option on: > 132 | let xml_use_xhtml = 1 133 | < 134 | xml_no_html 135 | This turns off the support for HTML specific tags. Place this in your 136 | .vimrc: > 137 | let xml_no_html = 1 138 | < 139 | xml_jump_string 140 | This turns off the support for continuing edits after an ending tag. 141 | xml_jump_string can be any string how ever a simple character will 142 | suffice. Pick a character or small string that is unique and will 143 | not interfer with your normal editing. See the Space 144 | mapping for more. 145 | .vimrc: > 146 | let xml_jump_string = "`" 147 | < 148 | ------------------------------------------------------------------------------ 149 | *xml-plugin-callbacks* 150 | Callback Functions 151 | 152 | A callback function is a function used to customize features on a per tag 153 | basis. For example say you wish to have a default set of attributs when you 154 | type an empty tag like this: 155 | You type: 156 | You get: 157 | 158 | This is for any script programmers who wish to add xml-plugin support to 159 | there own filetype plugins. 160 | 161 | Callback functions recive one attribute variable which is the tag name. The 162 | all must return either a string or the number zero. If it returns a string 163 | the plugin will place the string in the proper location. If it is a zero the 164 | plugin will ignore and continue as if no callback existed. 165 | 166 | The following are implemented callback functions: 167 | 168 | HtmlAttribCallback 169 | This is used to add default attributes to html tag. It is intended 170 | for HTML files only. 171 | 172 | XmlAttribCallback 173 | This is a generic callback for xml tags intended to add attributes. 174 | 175 | *xml-plugin-html* 176 | Callback Example 177 | 178 | The following is an example of using XmlAttribCallback in your .vimrc 179 | > 180 | function XmlAttribCallback (xml_tag) 181 | if a:xml_tag ==? "my-xml-tag" 182 | return "attributes=\"my xml attributes\"" 183 | else 184 | return 0 185 | endif 186 | endfunction 187 | < 188 | The following is a sample html.vim file type plugin you could use: 189 | > 190 | " Vim script file vim600:fdm=marker: 191 | " FileType: HTML 192 | " Maintainer: Devin Weaver 193 | " Location: http://www.vim.org/scripts/script.php?script_id=301 194 | 195 | " This is a wrapper script to add extra html support to xml documents. 196 | " Original script can be seen in xml-plugin documentation. 197 | 198 | " Only do this when not done yet for this buffer 199 | if exists("b:did_ftplugin") 200 | finish 201 | endif 202 | " Don't set 'b:did_ftplugin = 1' because that is xml.vim's responsability. 203 | 204 | let b:html_mode = 1 205 | 206 | if !exists("*HtmlAttribCallback") 207 | function HtmlAttribCallback( xml_tag ) 208 | if a:xml_tag ==? "table" 209 | return "cellpadding=\"0\" cellspacing=\"0\" border=\"0\"" 210 | elseif a:xml_tag ==? "link" 211 | return "href=\"/site.css\" rel=\"StyleSheet\" type=\"text/css\"" 212 | elseif a:xml_tag ==? "body" 213 | return "bgcolor=\"white\"" 214 | elseif a:xml_tag ==? "frame" 215 | return "name=\"NAME\" src=\"/\" scrolling=\"auto\" noresize" 216 | elseif a:xml_tag ==? "frameset" 217 | return "rows=\"0,*\" cols=\"*,0\" border=\"0\"" 218 | elseif a:xml_tag ==? "img" 219 | return "src=\"\" width=\"0\" height=\"0\" border=\"0\" alt=\"\"" 220 | elseif a:xml_tag ==? "a" 221 | if has("browse") 222 | " Look up a file to fill the href. Used in local relative file 223 | " links. typeing your own href before closing the tag with `>' 224 | " will override this. 225 | let cwd = getcwd() 226 | let cwd = substitute (cwd, "\\", "/", "g") 227 | let href = browse (0, "Link to href...", getcwd(), "") 228 | let href = substitute (href, cwd . "/", "", "") 229 | let href = substitute (href, " ", "%20", "g") 230 | else 231 | let href = "" 232 | endif 233 | return "href=\"" . href . "\"" 234 | else 235 | return 0 236 | endif 237 | endfunction 238 | endif 239 | 240 | " On to loading xml.vim 241 | runtime ftplugin/xml.vim 242 | < 243 | -------------------------------------------------------------------------------- /ftdetect/json.vim: -------------------------------------------------------------------------------- 1 | 2 | au BufRead,BufNewFile .sublime-project set filetype=json 3 | -------------------------------------------------------------------------------- /ftdetect/less.vim: -------------------------------------------------------------------------------- 1 | " Vim filetype plugin 2 | " Language: less 3 | " Maintainer: Alessandro Vioni 4 | " URL: https://github.com/genoma/vim-less 5 | " Last Change: 2014 November 24 6 | 7 | au BufRead,BufNewFile *.less set filetype=less 8 | -------------------------------------------------------------------------------- /ftplugin/ale-preview-selection.vim: -------------------------------------------------------------------------------- 1 | let g:f3_redraw = 'ale' 2 | -------------------------------------------------------------------------------- /ftplugin/c.vim: -------------------------------------------------------------------------------- 1 | setlocal colorcolumn=80 2 | setlocal nospell 3 | 4 | let b:ale_echo_msg_format = '[%linter%] %code: %%s' 5 | let b:ale_linters = {'c': ['cc', 'clangd']} 6 | let b:ale_linters_ignore = {'c': ['clangd']} 7 | 8 | if expand('%:p') =~# 'xmms2-mpris/' 9 | let g:ale_c_clang_options = '-std=c11 -Wall -Wno-visibility' 10 | endif 11 | 12 | let b:ale_completion_excluded_words = [ 13 | \ 'IFTODT', 14 | \] 15 | -------------------------------------------------------------------------------- /ftplugin/cmake.vim: -------------------------------------------------------------------------------- 1 | " Use 2 space tabs for CMake 2 | setlocal tabstop=2 3 | setlocal shiftwidth=2 4 | setlocal softtabstop=2 5 | -------------------------------------------------------------------------------- /ftplugin/cpp.vim: -------------------------------------------------------------------------------- 1 | let b:ale_echo_msg_format = '[%linter%] %code: %%s' 2 | let b:ale_linters = ['cc', 'clangd'] 3 | -------------------------------------------------------------------------------- /ftplugin/css.vim: -------------------------------------------------------------------------------- 1 | setlocal expandtab 2 | 3 | " Include - for completion. 4 | setlocal iskeyword+=- 5 | 6 | " Use 2 space tabs for CSS 7 | setlocal tabstop=2 8 | setlocal shiftwidth=2 9 | setlocal softtabstop=2 10 | -------------------------------------------------------------------------------- /ftplugin/d.vim: -------------------------------------------------------------------------------- 1 | setlocal expandtab 2 | setlocal cc=80 3 | " Enable comment continuation. 4 | setlocal formatoptions+=cro 5 | 6 | if has('gui_running') 7 | setlocal spell 8 | endif 9 | 10 | -------------------------------------------------------------------------------- /ftplugin/debchangelog.vim: -------------------------------------------------------------------------------- 1 | let w:trim_insert_newline=1 2 | 3 | -------------------------------------------------------------------------------- /ftplugin/file-search.vim: -------------------------------------------------------------------------------- 1 | " Kill the buffer on Ctrl+C, which isn't captured by getchar() 2 | noremap :bdelete! 3 | -------------------------------------------------------------------------------- /ftplugin/gitcommit.vim: -------------------------------------------------------------------------------- 1 | " Disable warnings for empty commit bodies. 2 | let b:ale_gitcommit_gitlint_options = '--ignore B6,T5' 3 | 4 | setlocal textwidth=72 5 | setlocal colorcolumn=73 6 | -------------------------------------------------------------------------------- /ftplugin/go.vim: -------------------------------------------------------------------------------- 1 | " Use tabs for Go code, display them as 4 spaces. 2 | setlocal noexpandtab 3 | setlocal tabstop=4 4 | setlocal shiftwidth=4 5 | setlocal softtabstop=4 6 | setlocal nospell 7 | " Make the colorcolumn wider for Go, where code is typically longer. 8 | setlocal colorcolumn=121 9 | 10 | vnoremap :EasyAlign *\ 11 | 12 | let b:ale_go_goimports_executable = $HOME . '/go/bin/goimports' 13 | let b:ale_linters = ['gopls'] 14 | let b:ale_fixers = ['goimports', 'gofmt'] 15 | let b:ale_fix_on_save = 1 16 | 17 | if expand('%:p') =~# 'site-directory' 18 | let b:ale_linters = ['gopls', 'golangci-lint'] 19 | endif 20 | 21 | function! UpdateGoTestPath() abort 22 | let l:mod_file = ale#path#FindNearestFile(bufnr(''), 'go.mod') 23 | 24 | if !empty(l:mod_file) 25 | let l:executable = 'go' 26 | 27 | " Automatically use versioned go executables for tests. 28 | for l:line in readfile(l:mod_file) 29 | if l:line =~# '^go' 30 | let l:versioned = substitute(l:line, ' ', '', 'g') 31 | 32 | if executable(l:versioned) 33 | let l:executable = l:versioned 34 | endif 35 | 36 | break 37 | endif 38 | endfor 39 | 40 | let l:dir = ale#path#Dirname(l:mod_file) 41 | let l:rel_path = substitute(expand('%:p'), '^' . l:dir . '/', '', '') 42 | let l:first = split(l:rel_path, '/')[0] 43 | 44 | 45 | let b:test_command = ale#command#CdString(l:dir) 46 | \ . l:executable . ' test ./...' 47 | else 48 | let b:test_command = '' 49 | endif 50 | endfunction 51 | 52 | augroup UpdateGoTestPathGroup 53 | autocmd! * 54 | autocmd BufEnter call UpdateGoTestPath() 55 | augroup END 56 | -------------------------------------------------------------------------------- /ftplugin/gohtmltmpl.vim: -------------------------------------------------------------------------------- 1 | " Use more space for HTML. 2 | setlocal colorcolumn=132 3 | 4 | " Use 2 space tabs for HTML 5 | setlocal expandtab 6 | setlocal tabstop=2 7 | setlocal shiftwidth=2 8 | setlocal softtabstop=2 9 | -------------------------------------------------------------------------------- /ftplugin/help.vim: -------------------------------------------------------------------------------- 1 | " Spell check help files 2 | setlocal spell 3 | " Include - for completion. 4 | setlocal iskeyword+=- 5 | 6 | " Navigate quickly in help files with space and backspace. 7 | noremap 8 | 9 | let b:ale_fixers = ['align_help_tags'] 10 | 11 | function! OpenHelpTag() abort 12 | if !startup#keybinds#TryToOpenLink() 13 | call feedkeys("\", 'n') 14 | endif 15 | endfunction 16 | 17 | " Open help tags or links with Space. 18 | nnoremap :call OpenHelpTag() 19 | 20 | function! CloseHelpFilesWithQ() abort 21 | if !&modifiable 22 | :q! 23 | else 24 | call feedkeys('q', 'n') 25 | endif 26 | endfunction 27 | 28 | " Quit help windows by just pressing q 29 | nnoremap q :call CloseHelpFilesWithQ() 30 | -------------------------------------------------------------------------------- /ftplugin/html.vim: -------------------------------------------------------------------------------- 1 | source ~/.vim/ftplugin/xml_plugin.vim 2 | 3 | setlocal expandtab 4 | " Use more space for HTML. 5 | setlocal colorcolumn=132 6 | 7 | " Use 2 space tabs for HTML 8 | setlocal tabstop=2 9 | setlocal shiftwidth=2 10 | setlocal softtabstop=2 11 | 12 | if expand('%:p') =~# 'denseanalysis-org' 13 | setlocal spell spelllang=en_us 14 | endif 15 | -------------------------------------------------------------------------------- /ftplugin/html_snip_helper.vim: -------------------------------------------------------------------------------- 1 | " Helper function for (x)html snippets 2 | if exists('s:did_snip_helper') || &cp || !exists('loaded_snips') 3 | finish 4 | endif 5 | let s:did_snip_helper = 1 6 | 7 | " Automatically closes tag if in xhtml 8 | fun! Close() 9 | return stridx(&ft, 'xhtml') == -1 ? '' : ' /' 10 | endf 11 | -------------------------------------------------------------------------------- /ftplugin/htmldjango.vim: -------------------------------------------------------------------------------- 1 | if has('gui_running') 2 | setlocal spell 3 | endif 4 | -------------------------------------------------------------------------------- /ftplugin/htmljinja.vim: -------------------------------------------------------------------------------- 1 | " Load in the XML goodies. 2 | source ~/.vim/ftplugin/xml_plugin.vim 3 | 4 | setlocal cc=80 5 | setlocal expandtab 6 | setlocal syntax=htmljinja 7 | 8 | -------------------------------------------------------------------------------- /ftplugin/java.vim: -------------------------------------------------------------------------------- 1 | " Use more space for Java code. 2 | setlocal cc=80 3 | 4 | if has('gui_running') 5 | setlocal spell 6 | endif 7 | 8 | " Multi-line commenting and uncommenting. 9 | vmap :s/^\(\s*\)/\1\/\// 10 | vmap :s/^\(\s*\)\/\//\1/ 11 | -------------------------------------------------------------------------------- /ftplugin/javascript.vim: -------------------------------------------------------------------------------- 1 | setlocal expandtab 2 | setlocal colorcolumn=81 3 | " Use 2 space tabs for JavaScript 4 | setlocal tabstop=2 5 | setlocal shiftwidth=2 6 | setlocal softtabstop=2 7 | setlocal nospell 8 | " Include - for completion. 9 | setlocal iskeyword+=- 10 | 11 | map :TestFile 12 | 13 | let b:ale_fixers = ['biome', 'eslint', 'extra_ale_fixers#FixWeirdImportCommas'] 14 | let b:ale_linters = ['biome', 'eslint', 'tsserver'] 15 | let b:ale_javascript_eslint_options = '--ignore-pattern ''!.eslintrc.js''' 16 | let b:ale_exclude_highlights = [ 17 | \ 'Remember not to commit fit()', 18 | \ 'Remember not to commit fdescribe()', 19 | \] 20 | setlocal completeopt=menu,menuone,preview,noselect,noinsert 21 | 22 | let s:dir = ale#path#Dirname(ale#path#FindNearestDirectory(bufnr(''), 'node_modules')) 23 | 24 | if !empty(s:dir) 25 | let g:test#javascript#jest#executable = s:dir . '/node_modules/.bin/jest' 26 | let g:test#project_root = s:dir 27 | endif 28 | 29 | if expand('%:p') =~# 'git/relviz' 30 | let b:ale_linters = ['eslint', 'tsserver'] 31 | let b:ale_fixers = ['eslint'] 32 | let b:ale_fix_on_save = 1 33 | endif 34 | -------------------------------------------------------------------------------- /ftplugin/jproperties.vim: -------------------------------------------------------------------------------- 1 | setlocal noexpandtab 2 | 3 | " Multi-line commenting and uncommenting. 4 | vmap :s/^\(\s*\)/\1\/\// 5 | vmap :s/^\(\s*\)\/\//\1/ 6 | 7 | -------------------------------------------------------------------------------- /ftplugin/json.vim: -------------------------------------------------------------------------------- 1 | " Use 2 space tabs for JSON 2 | setlocal tabstop=2 3 | setlocal shiftwidth=2 4 | setlocal softtabstop=2 5 | 6 | let b:ale_fix_on_save = 1 7 | let b:ale_fixers = ['fixjson'] 8 | let b:ale_linters = ['jsonlint'] 9 | -------------------------------------------------------------------------------- /ftplugin/jsp.vim: -------------------------------------------------------------------------------- 1 | setlocal noexpandtab 2 | " Use more space for Java code. 3 | setlocal cc=132 4 | 5 | if has('gui_running') 6 | setlocal spell 7 | endif 8 | 9 | -------------------------------------------------------------------------------- /ftplugin/less.vim: -------------------------------------------------------------------------------- 1 | setlocal tabstop=2 2 | setlocal shiftwidth=2 3 | setlocal softtabstop=2 4 | setlocal formatoptions-=t formatoptions+=croql 5 | 6 | setlocal comments=:// commentstring=//\ %s 7 | 8 | setlocal omnifunc=csscomplete#CompleteCSS 9 | setlocal suffixesadd=.less 10 | 11 | " Include - for completion. 12 | setlocal iskeyword+=- 13 | 14 | if expand('%:p') =~# 'spotlight/static' 15 | let s:path_to_static = split(expand('%:p'), '/spotlight/static')[0] 16 | \ . '/spotlight/static/' 17 | let s:path_to_base = split(expand('%:p'), '/spotlight/static')[0] 18 | \ . '/spotlight/static/main/styles/clients/base/' 19 | let s:path_to_framework = split(expand('%:p'), '/spotlight/static')[0] 20 | \ . '/spotlight/static/styles/framework/' 21 | 22 | let b:ale_less_lessc_options = join(map( 23 | \ [ 24 | \ ['path-to-base', s:path_to_base], 25 | \ ['path-to-framework', s:path_to_framework], 26 | \ ['static-url', s:path_to_static], 27 | \ ['line-height-computed', '20px'], 28 | \ ['screen-xs-max', '120px'], 29 | \ ['screen-sm-max', '120px'], 30 | \ ['screen-md-max', '120px'], 31 | \ ['border-radius-base', '2px'], 32 | \ ['font-size-base', '12pt'], 33 | \ ['brand-primary', 'black'], 34 | \ ['brand-secondary', 'black'], 35 | \ ['brand-danger', 'red'], 36 | \ ['gray-lightest', 'red'], 37 | \ ['gray-lighter', 'gray'], 38 | \ ['gray-light', 'gray'], 39 | \ ['disco-card-width', '2px'], 40 | \ ['font-size-h6', '2px'], 41 | \ ['padding-xs-vertical', '2px'], 42 | \ ['padding-base-horizontal', '2px'], 43 | \ ['fa-var-pencil-square-o', ''], 44 | \ ], 45 | \ '''--global-var='' . ale#Escape(v:val[0] . ''='' . v:val[1])' 46 | \), ' ') 47 | else 48 | let b:ale_less_lessc_options = '' 49 | endif 50 | -------------------------------------------------------------------------------- /ftplugin/lua.vim: -------------------------------------------------------------------------------- 1 | let b:ale_lua_language_server_executable = $HOME . '/git/lua-language-server/bin/lua-language-server' 2 | 3 | let b:ale_linters = ['luac', 'luacheck', 'lua-language-server'] 4 | 5 | if expand('%:p') =~# '^/usr/share/nvim' 6 | let b:ale_lua_luacheck_options = '--globals vim' 7 | endif 8 | 9 | if expand('%:p') =~# 'ale/test/lua' 10 | let b:ale_lua_luacheck_options = '--globals vim --std' 11 | 12 | let s:conf = ale#path#FindNearestFile(bufnr(''), '.luarc.json') 13 | let s:dir = ale#path#Dirname(s:conf) 14 | 15 | let b:test_command = ale#command#CdString(s:dir) 16 | \ . ale#Escape($HOME . '/.luarocks/bin/busted') 17 | \ . ' -m ''../../lua/?.lua;../../lua/?/init.lua''' 18 | \ . ' ' . ale#Escape(substitute(expand('%:p'), '^' . s:dir . '/', '', '')) 19 | endif 20 | -------------------------------------------------------------------------------- /ftplugin/markdown.vim: -------------------------------------------------------------------------------- 1 | if expand('%:p') =~# 'denseanalysis-org' 2 | setlocal spell spelllang=en_us 3 | endif 4 | -------------------------------------------------------------------------------- /ftplugin/objc.vim: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /ftplugin/php.vim: -------------------------------------------------------------------------------- 1 | setlocal noexpandtab 2 | " Use more space for PHP code. 3 | setlocal cc=132 4 | " Enable comment leader continuation 5 | setlocal formatoptions+=cro 6 | " Combined with the plugin ctabs.vim, this will fix aligment and line 7 | " continuation problems. 8 | setlocal cindent 9 | 10 | if has('gui_running') 11 | setlocal spell 12 | endif 13 | -------------------------------------------------------------------------------- /ftplugin/po.vim: -------------------------------------------------------------------------------- 1 | setlocal spell 2 | let b:ale_maximum_file_size = 1024 * 1024 * 1024 3 | -------------------------------------------------------------------------------- /ftplugin/ps1.vim: -------------------------------------------------------------------------------- 1 | setlocal tabstop=2 2 | setlocal shiftwidth=2 3 | setlocal softtabstop=2 4 | -------------------------------------------------------------------------------- /ftplugin/pug.vim: -------------------------------------------------------------------------------- 1 | " Use 2 space tabs for Jade/Pug. 2 | setlocal tabstop=2 3 | setlocal shiftwidth=2 4 | setlocal softtabstop=2 5 | " Include - for completion. 6 | setlocal iskeyword+=- 7 | 8 | let b:ale_linters = ['puglint'] 9 | -------------------------------------------------------------------------------- /ftplugin/python.vim: -------------------------------------------------------------------------------- 1 | setlocal expandtab 2 | setlocal colorcolumn=80 3 | setlocal textwidth=79 4 | " Enable comment continuation. 5 | setlocal formatoptions+=cro 6 | setlocal foldmethod=indent 7 | setlocal foldminlines=10 8 | setlocal textwidth=0 9 | 10 | " Multi-line commenting and uncommenting. 11 | vmap :s/^\(\s*\)/\1#/ 12 | vmap :s/^\(\s*\)#/\1/ 13 | 14 | " Use the AutoPythonImport tool. 15 | map :call AutoPythonImport(expand("")) 16 | 17 | " Change the line length for Python files based on configuration files. 18 | function! ChangePythonLineLength() abort 19 | let l:conf = ale#path#FindNearestFile(bufnr(''), 'setup.cfg') 20 | " Reset settings back to defaults when configuration files are not found 21 | let l:line_length = 79 22 | 23 | if !empty(l:conf) 24 | for l:match in ale#util#GetMatches( 25 | \ readfile(l:conf), 26 | \ '\v^ *max-line-length *\= *(\d+)', 27 | \) 28 | let l:line_length = str2nr(l:match[1]) 29 | endfor 30 | endif 31 | 32 | let &l:colorcolumn = l:line_length + 1 33 | endfunction 34 | 35 | call ChangePythonLineLength() 36 | 37 | let b:ale_linters = ['ruff', 'flake8', 'pyright'] 38 | let b:ale_linters_ignore = [] 39 | " \ 'ale#fixers#generic_python#BreakUpLongLines', 40 | let b:ale_fixers = [ 41 | \ 'remove_trailing_lines', 42 | \ 'isort', 43 | \ 'extra_ale_fixers#AutomaticallyFixJSONDiffOutput', 44 | \ 'ruff', 45 | \] 46 | let b:ale_python_pyright_config = { 47 | \ 'python': { 48 | \ 'analysis': { 49 | \ 'logLevel': 'error', 50 | \ }, 51 | \ }, 52 | \} 53 | let b:ale_completion_excluded_words = [ 54 | \ 'DOCUMENT_DIR', 55 | \ 'DOCUMENT_EXTENSIONS', 56 | \ 'and', 57 | \ 'do', 58 | \ 'doc', 59 | \ 'if', 60 | \ 'main', 61 | \ 'main_thread', 62 | \ 'or', 63 | \ 'super', 64 | \] 65 | let b:ale_python_auto_virtualenv = 1 66 | 67 | if expand('%:e') is# 'pyi' 68 | let b:ale_linters = ['pyright', 'ruff', 'flake8'] 69 | endif 70 | 71 | let s:virtualenv = ale#python#FindVirtualenv(bufnr('')) 72 | 73 | if !empty(s:virtualenv) 74 | if executable(s:virtualenv . '/bin/pytest') 75 | let s:dir = ale#path#Dirname(s:virtualenv) 76 | let b:test_command = ale#command#CdString(s:dir) 77 | \ . ale#Escape(s:virtualenv . '/bin/python') . ' -m pytest' 78 | \ . ' ' . ale#Escape(substitute(expand('%:p'), '^' . s:dir . '/', '', '')) 79 | endif 80 | endif 81 | 82 | if expand('%:p') =~# 'test-pylint' 83 | let b:ale_linters = ['pylint'] 84 | let b:ale_python_pylint_use_global = 1 85 | let b:ale_python_pylint_executable = '/home/w0rp/git/test-pylint/pylint.sh' 86 | let b:ale_filename_mappings = {'pylint': [['/home/w0rp/git/test-pylint', '/data']]} 87 | endif 88 | 89 | if expand('%:p') =~# 'django-common-migration' 90 | let b:ale_linters_ignore = [] 91 | endif 92 | 93 | if expand('%:p') =~# 'migrations' 94 | call filter(b:ale_fixers, 'v:val isnot# ''ale#fixers#generic_python#BreakUpLongLines''') 95 | endif 96 | 97 | if expand('%:p') =~# 'neural' 98 | let b:ale_fixers = ['isort'] 99 | endif 100 | 101 | if expand('%:p') =~# '/talisman/' 102 | let b:ale_linters = ['flake8', 'pyright', 'vulture'] 103 | let b:ale_python_vulture_options = '--min-confidence 100 --ignore-names args,kwargs --exclude pyrax,django_mfa' 104 | endif 105 | -------------------------------------------------------------------------------- /ftplugin/python_vimisort.vim: -------------------------------------------------------------------------------- 1 | if has('python') 2 | command! -nargs=1 AvailablePython python 3 | let s:available_short_python = ':py' 4 | elseif has('python3') 5 | command! -nargs=1 AvailablePython python3 6 | let s:available_short_python = ':py3' 7 | else 8 | throw 'No python support present, vim-isort will be disabled' 9 | endif 10 | 11 | command! Isort exec("AvailablePython isort_file()") 12 | 13 | if !exists('g:vim_isort_map') 14 | let g:vim_isort_map = '' 15 | endif 16 | 17 | if g:vim_isort_map != '' 18 | execute "vnoremap " g:vim_isort_map s:available_short_python "isort_visual()" 19 | endif 20 | 21 | AvailablePython < q :q 2 | -------------------------------------------------------------------------------- /ftplugin/rst.vim: -------------------------------------------------------------------------------- 1 | if has('gui_running') 2 | setlocal spell 3 | endif 4 | 5 | " Set up the keybinds for headings 6 | map - yypVr-o 7 | map = yypVr=o 8 | map _ yypVr_o 9 | map + yypVr+o 10 | map > yypVr>o 11 | map < yypVr - yypVr-o 14 | imap = yypVr=o 15 | imap _ yypVr_o 16 | imap + yypVr+o 17 | imap > yypVr>o 18 | imap < yypVr :s/^\(\s*\)/\1#/ 9 | vmap :s/^\(\s*\)#/\1/ 10 | 11 | " Open files with Ctrl + ] 12 | map :tabfind 13 | 14 | function! ShIgnoreFunction(buffer) abort 15 | endfunction 16 | 17 | let b:Ignore = function('ShIgnoreFunction') 18 | 19 | " Disable linters 20 | if expand('%:e') is# 'env' 21 | let b:ale_linters_ignore = [ 22 | \ 'bash-language-server', 23 | \ 'bashate', 24 | \ 'shell', 25 | \ 'shellcheck', 26 | \] 27 | endif 28 | -------------------------------------------------------------------------------- /ftplugin/snippet.vim: -------------------------------------------------------------------------------- 1 | setlocal noexpandtab 2 | setlocal cc=132 3 | 4 | if has('gui_running') 5 | setlocal spell 6 | endif 7 | -------------------------------------------------------------------------------- /ftplugin/sql.vim: -------------------------------------------------------------------------------- 1 | setlocal expandtab 2 | 3 | " This will stop VIM being retarded. 4 | let g:ftplugin_sql_omni_key = '' 5 | 6 | vnoremap :EasyAlign *\ 7 | -------------------------------------------------------------------------------- /ftplugin/terraform-vars.vim: -------------------------------------------------------------------------------- 1 | " Use 2 space tabs for Terraform 2 | setlocal tabstop=2 3 | setlocal shiftwidth=2 4 | setlocal softtabstop=2 5 | 6 | let b:ale_fixers = ['terraform'] 7 | -------------------------------------------------------------------------------- /ftplugin/terraform.vim: -------------------------------------------------------------------------------- 1 | " Use 2 space tabs for Terraform 2 | setlocal tabstop=2 3 | setlocal shiftwidth=2 4 | setlocal softtabstop=2 5 | 6 | let b:ale_fixers = ['terraform'] 7 | -------------------------------------------------------------------------------- /ftplugin/toml.vim: -------------------------------------------------------------------------------- 1 | if expand('%:p') =~# 'denseanalysis-org' 2 | setlocal spell spelllang=en_us 3 | endif 4 | -------------------------------------------------------------------------------- /ftplugin/typescript.vim: -------------------------------------------------------------------------------- 1 | setlocal expandtab 2 | setlocal colorcolumn=81 3 | " Use 2 space tabs for TypeScript 4 | setlocal tabstop=2 5 | setlocal shiftwidth=2 6 | setlocal softtabstop=2 7 | setlocal nospell 8 | " Include - for completion. 9 | setlocal iskeyword+=- 10 | setlocal comments=s1:/*,mb:*,ex:*/,://,fb:- 11 | 12 | " Use :ALEImport to import words at the cursor. 13 | map (ale_import) 14 | 15 | let b:ale_fixers = ['eslint', 'extra_ale_fixers#FixWeirdImportCommas'] 16 | let b:ale_fix_on_save = 1 17 | let b:ale_completion_excluded_words = [ 18 | \ 'it', 19 | \ 'describe', 20 | \ 'beforeEach', 21 | \ 'import', 22 | \ 'importScripts', 23 | \ 'ImportsNotUsedAsValues', 24 | \ 'implements', 25 | \] 26 | let b:ale_exclude_highlights = [ 27 | \ 'Remember not to commit fit()', 28 | \ 'Remember not to commit fdescribe()', 29 | \] 30 | let b:ale_javascript_eslint_options = '--ignore-pattern ''!.eslintrc.js''' 31 | let b:ale_javascript_eslint_project_options = 'app' 32 | 33 | let s:dir = ale#path#Dirname(ale#path#FindNearestDirectory(bufnr(''), 'node_modules')) 34 | 35 | if !empty(s:dir) 36 | let b:test_command = ale#command#CdString(s:dir) 37 | \ . ' ' . ale#Escape(s:dir . '/node_modules/.bin/jest') 38 | \ . ' ' . ale#Escape(substitute(expand('%:p'), '^' . s:dir . '/', '', '')) 39 | endif 40 | 41 | function! TypeScriptBindingReplacement() abort 42 | let l:implements_line = getline(search('implements', 'bn')) 43 | 44 | if empty(l:implements_line) 45 | return submatch(0) 46 | endif 47 | 48 | let l:match = matchlist(l:implements_line, 'implements \([a-zA-Z]\+\)') 49 | 50 | if empty(l:match) 51 | return submatch(0) 52 | endif 53 | 54 | let l:key = submatch(1) 55 | let l:interface = l:match[1] 56 | let l:indicator = !empty(submatch(2)) ? submatch(2) : '!' 57 | 58 | return printf('%s%s: %s[''%s'']', l:key, l:indicator, l:interface, l:key) 59 | endfunction 60 | 61 | function! FixTypeScriptBindings(line1, line2) abort 62 | execute printf( 63 | \ '%s,%ss/\([a-zA-z]\+\)\(?\?\):.*/\=TypeScriptBindingReplacement()/', 64 | \ a:line1, a:line2 65 | \) 66 | 67 | if getline(a:line1 - 1) !~# '// Bindings' 68 | call append(a:line1 - 1, ' // Bindings') 69 | endif 70 | endfunction 71 | 72 | command! -range FixBindings :call FixTypeScriptBindings(, ) 73 | 74 | if expand('%:p') =~# 'wazoku-spotlight' 75 | let b:ale_linters = ['eslint', 'tsserver'] 76 | endif 77 | 78 | if expand('%:p') =~# 'git/relviz' 79 | let b:ale_linters = ['eslint', 'tsserver'] 80 | let b:ale_fixers = ['eslint'] 81 | let b:ale_fix_on_save = 1 82 | endif 83 | -------------------------------------------------------------------------------- /ftplugin/typescriptreact.vim: -------------------------------------------------------------------------------- 1 | let b:ale_completion_excluded_words = [ 2 | \ 'it', 3 | \ 'describe', 4 | \ 'beforeEach', 5 | \ 'import', 6 | \ 'importScripts', 7 | \ 'implements', 8 | \] 9 | let b:ale_fixers = ['eslint', 'extra_ale_fixers#FixWeirdImportCommas'] 10 | let b:ale_fix_on_save = 1 11 | -------------------------------------------------------------------------------- /ftplugin/vader.vim: -------------------------------------------------------------------------------- 1 | function! RunVader() abort 2 | try 3 | Vader 4 | finally 5 | cclose 6 | endtry 7 | 8 | call vader_tools#TryAndMakeEverythingBetter() 9 | endfunction 10 | 11 | " Map F9 to running Vader tests. 12 | noremap :call RunVader() 13 | 14 | setlocal formatoptions=croql 15 | " Continue \ lines after one is found. 16 | setlocal comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",b:\\ 17 | -------------------------------------------------------------------------------- /ftplugin/vim.vim: -------------------------------------------------------------------------------- 1 | setlocal expandtab 2 | setlocal colorcolumn=81 3 | setlocal spell 4 | 5 | setlocal formatoptions=croql 6 | " Continue \ lines after one is found. 7 | setlocal comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",b:\\ 8 | 9 | let b:ale_completion_excluded_words = [ 10 | \ 'function', 11 | \ 'funcref', 12 | \] 13 | -------------------------------------------------------------------------------- /ftplugin/xml.vim: -------------------------------------------------------------------------------- 1 | source ~/.vim/ftplugin/xml_plugin.vim 2 | 3 | if expand("%:e") == 'xml' 4 | noremap :tabfind .xml 5 | endif 6 | 7 | setlocal noexpandtab 8 | " Use more space for XML. 9 | setlocal cc=132 10 | 11 | if has('gui_running') 12 | setlocal spell 13 | endif 14 | 15 | -------------------------------------------------------------------------------- /ftplugin/yaml.vim: -------------------------------------------------------------------------------- 1 | setlocal expandtab 2 | 3 | " Use 2 space tabs for YAML. 4 | setlocal tabstop=2 5 | setlocal shiftwidth=2 6 | setlocal softtabstop=2 7 | -------------------------------------------------------------------------------- /gvimrc: -------------------------------------------------------------------------------- 1 | " See: :e $VIMRUNTIME/menu.vim 2 | 3 | if has('gui_macvim') 4 | set guifont=Inconsolata-Regular:h24 5 | 6 | execute 'macmenu Edit.Copy"+y key=' 7 | inoremap 8 | cnoremap 9 | 10 | " For these keybinds: 11 | " System Preferences -> Keyboard -> Shortcuts -> App Shortcuts 12 | " Redefine common shortcuts to enable these keybinds. 13 | 14 | " Command + h goes to the tab to the left. 15 | noremap :tabp 16 | " Command + l goes to the tab to the left. 17 | noremap :tabn 18 | 19 | " Command + C is copy to the clipboard 20 | vnoremap y 21 | snoremap gv"+y 22 | 23 | " Map common Ctrl keybinds to Command 24 | imap 25 | imap 26 | imap 27 | imap 28 | map 29 | map 30 | map 31 | map 32 | map 33 | map 34 | map 35 | map 36 | map 37 | map 38 | map 39 | map 40 | map 41 | vmap 42 | endif 43 | -------------------------------------------------------------------------------- /indent/less.vim: -------------------------------------------------------------------------------- 1 | " Vim indent file 2 | " Language: less 3 | " Maintainer: Alessandro Vioni 4 | " URL: https://github.com/genoma/vim-less 5 | " Last Change: 2014 November 24 6 | 7 | if exists("b:did_indent") 8 | finish 9 | endif 10 | 11 | runtime! indent/css.vim 12 | 13 | " vim:set sw=2: 14 | -------------------------------------------------------------------------------- /keybinds.vim: -------------------------------------------------------------------------------- 1 | autoload/startup/keybinds.vim -------------------------------------------------------------------------------- /plugin/autoswap.vim: -------------------------------------------------------------------------------- 1 | " Vim global plugin for automating response to swapfiles 2 | " Maintainer: Gioele Barabucci 3 | " Author: Damian Conway 4 | " License: This is free software released into the public domain (CC0 license). 5 | 6 | "############################################################# 7 | "## ## 8 | "## Note that this plugin only works if your Vim ## 9 | "## configuration includes: ## 10 | "## ## 11 | "## set title titlestring= ## 12 | "## ## 13 | "## On MacOS X this plugin works only for Vim sessions ## 14 | "## running in Terminal. ## 15 | "## ## 16 | "## On Linux this plugin requires the external program ## 17 | "## wmctrl, packaged for most distributions. ## 18 | "## ## 19 | "## See below for the two functions that would have to be ## 20 | "## rewritten to port this plugin to other OS's. ## 21 | "## ## 22 | "############################################################# 23 | 24 | 25 | " If already loaded, we're done... 26 | if exists("loaded_autoswap") 27 | finish 28 | endif 29 | let loaded_autoswap = 1 30 | 31 | " Preserve external compatibility options, then enable full vim compatibility... 32 | let s:save_cpo = &cpo 33 | set cpo&vim 34 | 35 | " Invoke the behaviour whenever a swapfile is detected... 36 | " 37 | augroup AutoSwap 38 | autocmd! 39 | autocmd SwapExists * call AS_HandleSwapfile(expand(':p')) 40 | augroup END 41 | 42 | 43 | " The automatic behaviour... 44 | " 45 | function! AS_HandleSwapfile (filename) 46 | 47 | " Is file already open in another Vim session in some other window? 48 | let active_window = AS_DetectActiveWindow(a:filename) 49 | 50 | " If so, go there instead and terminate this attempt to open the file... 51 | if (strlen(active_window) > 0) 52 | call AS_DelayedMsg('Switched to existing session in another window') 53 | call AS_SwitchToActiveWindow(active_window) 54 | let v:swapchoice = 'q' 55 | 56 | " Otherwise, if swapfile is older than file itself, just get rid of it... 57 | elseif getftime(v:swapname) < getftime(a:filename) 58 | call AS_DelayedMsg('Old swapfile detected... and deleted') 59 | call delete(v:swapname) 60 | let v:swapchoice = 'e' 61 | 62 | " Otherwise, open file read-only... 63 | else 64 | call AS_DelayedMsg('Swapfile detected, opening read-only') 65 | let v:swapchoice = 'o' 66 | endif 67 | endfunction 68 | 69 | 70 | " Print a message after the autocommand completes 71 | " (so you can see it, but don't have to hit to continue)... 72 | " 73 | function! AS_DelayedMsg (msg) 74 | " A sneaky way of injecting a message when swapping into the new buffer... 75 | augroup AutoSwap_Msg 76 | autocmd! 77 | " Print the message on finally entering the buffer... 78 | autocmd BufWinEnter * echohl WarningMsg 79 | exec 'autocmd BufWinEnter * echon "\r'.printf("%-60s", a:msg).'"' 80 | autocmd BufWinEnter * echohl NONE 81 | 82 | " And then remove these autocmds, so it's a "one-shot" deal... 83 | autocmd BufWinEnter * augroup AutoSwap_Msg 84 | autocmd BufWinEnter * autocmd! 85 | autocmd BufWinEnter * augroup END 86 | augroup END 87 | endfunction 88 | 89 | 90 | "################################################################# 91 | "## ## 92 | "## To port this plugin to other operating systems ## 93 | "## ## 94 | "## 1. Rewrite the Detect and the Switch function ## 95 | "## 2. Add a new elseif case to the list of OS ## 96 | "## ## 97 | "################################################################# 98 | 99 | " Return an identifier for a terminal window already editing the named file 100 | " (Should either return a string identifying the active window, 101 | " or else return an empty string to indicate "no active window")... 102 | " 103 | function! AS_DetectActiveWindow (filename) 104 | " This isn't defined for Windows 105 | if has('win32') 106 | return '' 107 | endif 108 | 109 | if has('macunix') 110 | let active_window = AS_DetectActiveWindow_Mac(a:filename) 111 | elseif has('unix') 112 | let active_window = AS_DetectActiveWindow_Linux(a:filename) 113 | endif 114 | return active_window 115 | endfunction 116 | 117 | " LINUX: Detection function for Linux, uses mwctrl 118 | function! AS_DetectActiveWindow_Linux (filename) 119 | let shortname = fnamemodify(a:filename,":t") 120 | let find_win_cmd = 'wmctrl -l | grep -i " '.shortname.' .*vim" | tail -n1 | cut -d" " -f1' 121 | let active_window = system(find_win_cmd) 122 | return (active_window =~ '0x' ? active_window : "") 123 | endfunction 124 | 125 | " MAC: Detection function for Mac OSX, uses osascript 126 | function! AS_DetectActiveWindow_Mac (filename) 127 | let shortname = fnamemodify(a:filename,":t") 128 | let active_window = system('osascript -e ''tell application "Terminal" to every window whose (name begins with "'.shortname.' " and name ends with "VIM")''') 129 | let active_window = substitute(active_window, '^window id \d\+\zs\_.*', '', '') 130 | return (active_window =~ 'window' ? active_window : "") 131 | endfunction 132 | 133 | 134 | " Switch to terminal window specified... 135 | " 136 | function! AS_SwitchToActiveWindow (active_window) 137 | if has('macunix') 138 | call AS_SwitchToActiveWindow_Mac(a:active_window) 139 | elseif has('unix') 140 | call AS_SwitchToActiveWindow_Linux(a:active_window) 141 | endif 142 | endfunction 143 | 144 | " LINUX: Switch function for Linux, uses wmctrl 145 | function! AS_SwitchToActiveWindow_Linux (active_window) 146 | call system('wmctrl -i -a "'.a:active_window.'"') 147 | endfunction 148 | 149 | " MAC: Switch function for Mac, uses osascript 150 | function! AS_SwitchToActiveWindow_Mac (active_window) 151 | call system('osascript -e ''tell application "Terminal" to set frontmost of '.a:active_window.' to true''') 152 | endfunction 153 | 154 | 155 | " Restore previous external compatibility options 156 | let &cpo = s:save_cpo 157 | -------------------------------------------------------------------------------- /plugin/python-imports.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_python_imports') 2 | finish 3 | endif 4 | 5 | let g:loaded_python_imports = 1 6 | 7 | function! AutoPythonImport(word) 8 | " Load the file with the import paths again, so we can modify the 9 | " dictionary while the file is still open. 10 | source ~/.vim/python-import-paths.vim 11 | 12 | " Load custom user import paths if they are there. 13 | if filereadable(expand('~/.python-import-paths.vim')) 14 | source ~/.python-import-paths.vim 15 | endif 16 | 17 | " Add in the standard import lines. 18 | let l:import_dict = {} 19 | call extend(l:import_dict, g:python_import_dict) 20 | 21 | " Add in extra user mappings. 22 | if exists('g:user_python_import_dict') 23 | call extend(l:import_dict, g:user_python_import_dict) 24 | endif 25 | 26 | let l:line = get(l:import_dict, a:word, '') 27 | 28 | " from imports should have values like 'from some_module' 29 | " We will automatically add on ' import something' based on the key. 30 | " The imports can also be written 'from some_module import x as' 31 | " for aliased imports. 32 | if l:line =~# '^from' 33 | if l:line =~# 'as$' 34 | let l:line .= ' ' . a:word 35 | else 36 | let l:line .= ' import ' . a:word 37 | endif 38 | endif 39 | 40 | let l:last_import_line_number = max([1, search('^import\|^from', 'bn') - 1]) 41 | 42 | if !empty(l:line) 43 | " Save the current position. 44 | let l:line_number = line('.') 45 | let l:column_number = col('.') 46 | 47 | " Insert the import line at the end of the file. isort will sort it 48 | " out. 49 | call append(l:last_import_line_number, l:line) 50 | ALEFix 51 | " Remove any additional newlines isort mistakenly added to the end of 52 | " the file. 53 | silent! %s#\($\n\s*\)\+\%$## 54 | " Jump back to the line number and cursor before, which might be a 55 | " little off. 56 | call cursor(l:line_number, l:column_number) 57 | echo 'Import added!' 58 | else 59 | echo 'Import not found!' 60 | endif 61 | endfunction 62 | 63 | " Add functions for quickly opening import files to edit them. 64 | function! EditGlobalPythonImports() 65 | :tabnew ~/.vim/python-import-paths.vim 66 | endfunction 67 | 68 | function! EditLocalPythonImports() 69 | :tabnew ~/.python-import-paths.vim 70 | endfunction 71 | -------------------------------------------------------------------------------- /plugin/rainbow.vim: -------------------------------------------------------------------------------- 1 | "============================================================================== 2 | "Script Title: rainbow parentheses improved 3 | "Script Version: 3.3.3 4 | "Author: luochen1990 5 | "Last Edited: 2015 Jan 13 6 | "Simple Configuration: 7 | " first, put "rainbow.vim"(this file) to dir vimfiles/plugin or vim73/plugin 8 | " second, add the follow sentences to your .vimrc or _vimrc : 9 | " let g:rainbow_active = 1 10 | " third, restart your vim and enjoy coding. 11 | "Advanced Configuration: 12 | " an advanced configuration allows you to define what parentheses to use 13 | " for each type of file . you can also determine the colors of your 14 | " parentheses by this way (read file vim73/rgb.txt for all named colors). 15 | " READ THE SOURCE FILE FROM LINE 25 TO LINE 50 FOR EXAMPLE. 16 | "User Command: 17 | " :RainbowToggle --you can use it to toggle this plugin. 18 | "============================================================================== 19 | 20 | if exists('s:loaded') || !(exists('g:rainbow_active') || exists('g:rainbow_conf')) 21 | finish 22 | endif 23 | let s:loaded = 1 24 | 25 | let s:rainbow_conf = { 26 | \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'], 27 | \ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'], 28 | \ 'operators': '_,_', 29 | \ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'], 30 | \ 'separately': { 31 | \ '*': {}, 32 | \ 'tex': { 33 | \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/'], 34 | \ }, 35 | \ 'vim': { 36 | \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/ fold', 'start=/(/ end=/)/ containedin=vimFuncBody', 'start=/\[/ end=/\]/ containedin=vimFuncBody', 'start=/{/ end=/}/ fold containedin=vimFuncBody'], 37 | \ }, 38 | \ 'xml': { 39 | \ 'parentheses': ['start=/\v\<\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'))?)*\>/ end=## fold'], 40 | \ }, 41 | \ 'xhtml': { 42 | \ 'parentheses': ['start=/\v\<\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'))?)*\>/ end=## fold'], 43 | \ }, 44 | \ 'html': { 45 | \ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=## fold'], 46 | \ }, 47 | \ 'php': { 48 | \ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=## fold', 'start=/(/ end=/)/ containedin=@htmlPreproc contains=@phpClTop', 'start=/\[/ end=/\]/ containedin=@htmlPreproc contains=@phpClTop', 'start=/{/ end=/}/ containedin=@htmlPreproc contains=@phpClTop'], 49 | \ }, 50 | \ 'css': 0, 51 | \ } 52 | \} 53 | 54 | func s:resolve_parenthesis(p) 55 | let ls = split(a:p, '\v%(%(start|step|end)\=(.)%(\1@!.)*\1[^ ]*|\w+%(\=[^ ]*)?) ?\zs', 0) 56 | let [paren, containedin, contains, op] = ['', '', 'TOP', ''] 57 | for s in ls 58 | let [k, v] = [matchstr(s, '^[^=]\+\ze='), matchstr(s, '^[^=]\+=\zs.*')] 59 | if k == 'step' 60 | let op = v 61 | elseif k == 'contains' 62 | let contains = v 63 | elseif k == 'containedin' 64 | let containedin = v 65 | else 66 | let paren .= s 67 | endif 68 | endfor 69 | return [paren, containedin, contains, op] 70 | endfunc 71 | 72 | func rainbow#load() 73 | let banned_filetypes = ['html', 'xml', 'xhtml', 'django', 'htmldjango'] 74 | 75 | if index(banned_filetypes, &filetype) >= 0 76 | return 1 77 | endif 78 | 79 | let conf = b:rainbow_conf 80 | let maxlvl = has('gui_running')? len(conf.guifgs) : len(conf.ctermfgs) 81 | for i in range(len(conf.parentheses)) 82 | let p = conf.parentheses[i] 83 | if type(p) == type([]) 84 | let op = len(p)==3? p[1] : has_key(conf, 'operators')? conf.operators : '' 85 | let conf.parentheses[i] = op != ''? printf('start=#%s# step=%s end=#%s#', p[0], op, p[-1]) : printf('start=#%s# end=#%s#', p[0], p[-1]) 86 | endif 87 | endfor 88 | let def_rg = 'syn region %s matchgroup=%s containedin=%s contains=%s,@NoSpell %s' 89 | let def_op = 'syn match %s %s containedin=%s contained' 90 | 91 | call rainbow#clear() 92 | let b:rainbow_loaded = maxlvl 93 | for parenthesis_args in conf.parentheses 94 | let [paren, containedin, contains, op] = s:resolve_parenthesis(parenthesis_args) 95 | if op == '' |let op = conf.operators |endif 96 | for lvl in range(maxlvl) 97 | if op != '' |exe printf(def_op, 'rainbow_o'.lvl, op, 'rainbow_r'.lvl) |endif 98 | if lvl == 0 99 | if containedin == '' 100 | exe printf(def_rg, 'rainbow_r0', 'rainbow_p0', 'rainbow_r'.(maxlvl - 1), contains, paren) 101 | endif 102 | else 103 | exe printf(def_rg, 'rainbow_r'.lvl, 'rainbow_p'.lvl.(' contained'), 'rainbow_r'.((lvl + maxlvl - 1) % maxlvl), contains, paren) 104 | endif 105 | endfor 106 | if containedin != '' 107 | exe printf(def_rg, 'rainbow_r0', 'rainbow_p0 contained', containedin.',rainbow_r'.(maxlvl - 1), contains, paren) 108 | endif 109 | endfor 110 | call rainbow#show() 111 | endfunc 112 | 113 | func rainbow#clear() 114 | call rainbow#hide() 115 | if exists('b:rainbow_loaded') 116 | for each in range(b:rainbow_loaded) 117 | exe 'syn clear rainbow_r'.each 118 | exe 'syn clear rainbow_o'.each 119 | endfor 120 | unlet b:rainbow_loaded 121 | endif 122 | endfunc 123 | 124 | func rainbow#show() 125 | if exists('b:rainbow_loaded') 126 | let b:rainbow_visible = 1 127 | for id in range(b:rainbow_loaded) 128 | let ctermfg = b:rainbow_conf.ctermfgs[id % len(b:rainbow_conf.ctermfgs)] 129 | let guifg = b:rainbow_conf.guifgs[id % len(b:rainbow_conf.guifgs)] 130 | exe 'hi default rainbow_p'.id.' ctermfg='.ctermfg.' guifg='.guifg 131 | exe 'hi default rainbow_o'.id.' ctermfg='.ctermfg.' guifg='.guifg 132 | endfor 133 | endif 134 | endfunc 135 | 136 | func rainbow#hide() 137 | if exists('b:rainbow_visible') 138 | for each in range(b:rainbow_loaded) 139 | exe 'hi clear rainbow_p'.each 140 | exe 'hi clear rainbow_o'.each 141 | endfor 142 | unlet b:rainbow_visible 143 | endif 144 | endfunc 145 | 146 | func rainbow#toggle() 147 | if exists('b:rainbow_loaded') 148 | call rainbow#clear() 149 | else 150 | if exists('b:rainbow_conf') 151 | call rainbow#load() 152 | else 153 | call rainbow#hook() 154 | endif 155 | endif 156 | endfunc 157 | 158 | func rainbow#hook() 159 | let g_conf = extend(copy(s:rainbow_conf), exists('g:rainbow_conf')? g:rainbow_conf : {}) |unlet g_conf.separately 160 | if exists('g:rainbow_conf.separately') && has_key(g:rainbow_conf.separately, '*') 161 | let separately = copy(g:rainbow_conf.separately) 162 | else 163 | let separately = extend(copy(s:rainbow_conf.separately), exists('g:rainbow_conf.separately')? g:rainbow_conf.separately : {}) 164 | endif 165 | let b_conf = has_key(separately, &ft)? separately[&ft] : separately['*'] 166 | if type(b_conf) == type({}) 167 | let b:rainbow_conf = extend(g_conf, b_conf) 168 | call rainbow#load() 169 | endif 170 | endfunc 171 | 172 | command! RainbowToggle call rainbow#toggle() 173 | 174 | if (exists('g:rainbow_active') && g:rainbow_active) 175 | auto syntax * call rainbow#hook() 176 | auto colorscheme * call rainbow#show() 177 | endif 178 | -------------------------------------------------------------------------------- /plugin/zoom.vim: -------------------------------------------------------------------------------- 1 | if &cp || exists("g:loaded_zoom") 2 | finish 3 | endif 4 | let g:loaded_zoom = 1 5 | 6 | let s:save_cpo = &cpo 7 | set cpo&vim 8 | 9 | " keep default value 10 | let s:current_font = &guifont 11 | 12 | " command 13 | command! -narg=0 ZoomIn :call s:ZoomIn() 14 | command! -narg=0 ZoomOut :call s:ZoomOut() 15 | command! -narg=0 ZoomReset :call s:ZoomReset() 16 | 17 | " map 18 | nmap = :ZoomIn 19 | nmap - :ZoomOut 20 | 21 | " guifont size + 1 22 | function! s:ZoomIn() 23 | let l:fontName = substitute(&guifont, '^\(.\+ \)\d\+$', '\1', '') 24 | let l:fontSize = matchstr(&guifont, '\d\+$') 25 | let l:fontSize += 2 26 | let &guifont = fontName . fontSize 27 | endfunction 28 | 29 | " guifont size - 1 30 | function! s:ZoomOut() 31 | let l:fontName = substitute(&guifont, '^\(.\+ \)\d\+$', '\1', '') 32 | let l:fontSize = matchstr(&guifont, '\d\+$') 33 | let l:fontSize -= 2 34 | let &guifont = fontName . fontSize 35 | endfunction 36 | 37 | " reset guifont size 38 | function! s:ZoomReset() 39 | let &guifont = s:current_font 40 | endfunction 41 | 42 | let &cpo = s:save_cpo 43 | finish 44 | -------------------------------------------------------------------------------- /python-import-paths.vim: -------------------------------------------------------------------------------- 1 | let g:python_import_dict = { 2 | \ 'APIView': 'from rest_framework.views', 3 | \ 'AnonymousUser': 'from django.contrib.auth.models', 4 | \ 'Any': 'from typing', 5 | \ 'AppConfig': 'from django.apps', 6 | \ 'ArrayAgg': 'from django.contrib.postgres.aggregates', 7 | \ 'Avg': 'from django.db.models', 8 | \ 'BaseManager': 'from django.db.models.manager', 9 | \ 'BasePermission': 'from rest_framework.permissions', 10 | \ 'BooleanField': 'from django.db.models', 11 | \ 'BytesIO': 'from io', 12 | \ 'Callable': 'from typing', 13 | \ 'Case': 'from django.db.models', 14 | \ 'CharField': 'from django.db.models', 15 | \ 'ClassVar': 'from typing', 16 | \ 'Coalesce': 'from django.db.models.functions', 17 | \ 'Collection': 'from typing', 18 | \ 'CombinedExpression': 'from django.db.models.expressions', 19 | \ 'Concat': 'from django.db.models.functions', 20 | \ 'ContentType': 'from django.contrib.contenttypes.models', 21 | \ 'Count': 'from django.db.models', 22 | \ 'D': 'from decimal import Decimal as', 23 | \ 'Decimal': 'from decimal', 24 | \ 'Dict': 'from typing', 25 | \ 'Exists': 'from django.db.models', 26 | \ 'F': 'from django.db.models', 27 | \ 'FieldDoesNotExist': 'from django.core.exceptions', 28 | \ 'FloatField': 'from django.db.models', 29 | \ 'Func': 'from django.db.models', 30 | \ 'Generator': 'from typing', 31 | \ 'Generic': 'from typing', 32 | \ 'GenericAPIView': 'from rest_framework.generics', 33 | \ 'GenericForeignKey': 'from django.contrib.contenttypes.fields', 34 | \ 'HStoreField': 'from django.contrib.postgres.fields', 35 | \ 'Http404': 'from django.http', 36 | \ 'HttpRequest': 'from django.http', 37 | \ 'HttpResponse': 'from django.http', 38 | \ 'HttpResponseRedirect': 'from django.http', 39 | \ 'IntegerField': 'from django.db.models', 40 | \ 'IsAuthenticated': 'from rest_framework.permissions', 41 | \ 'Iterable': 'from typing', 42 | \ 'Iterator': 'from typing', 43 | \ 'JSONField': 'from django.contrib.postgres.fields', 44 | \ 'JSONObject': 'from django.db.models.functions', 45 | \ 'JsonResponse': 'from django.http', 46 | \ 'List': 'from typing', 47 | \ 'Literal': 'from typing', 48 | \ 'Manager': 'from django.db.models', 49 | \ 'Mapping': 'from typing', 50 | \ 'Max': 'from django.db.models', 51 | \ 'Min': 'from django.db.models', 52 | \ 'MockerFixture': 'from pytest_mock', 53 | \ 'Model': 'from django.db.models', 54 | \ 'NamedTuple': 'from typing', 55 | \ 'NoReturn': 'from typing', 56 | \ 'ObjectDoesNotExist': 'from django.core.exceptions', 57 | \ 'Optional': 'from typing', 58 | \ 'OuterRef': 'from django.db.models', 59 | \ 'PermissionDenied': 'from rest_framework.exceptions', 60 | \ 'Prefetch': 'from django.db.models', 61 | \ 'ProgrammingError': 'from django.db.utils', 62 | \ 'Protocol': 'from typing', 63 | \ 'Q': 'from django.db.models', 64 | \ 'QuerySet': 'from django.db.models', 65 | \ 'RawSQL': 'from django.db.models.expressions', 66 | \ 'RedirectResponse': 'from starlette.responses', 67 | \ 'RegexValidator': 'from django.core.validators', 68 | \ 'Response': 'from rest_framework.response', 69 | \ 'SearchVectorField': 'from django.contrib.postgres.search', 70 | \ 'Sequence': 'from typing', 71 | \ 'Set': 'from typing', 72 | \ 'Subquery': 'from django.db.models', 73 | \ 'TYPE_CHECKING': 'from typing', 74 | \ 'TestCase': 'from unittest', 75 | \ 'TestClient': 'from fastapi.testclient', 76 | \ 'Trim': 'from django.db.models.functions', 77 | \ 'Tuple': 'from typing', 78 | \ 'Type': 'from typing', 79 | \ 'TypeAlias': 'from typing_extensions', 80 | \ 'TypeVar': 'from typing', 81 | \ 'TypedDict': 'from typing', 82 | \ 'Union': 'from typing', 83 | \ 'ValidationError': 'from django.core.exceptions', 84 | \ 'Value': 'from django.db.models', 85 | \ 'When': 'from django.db.models', 86 | \ 'Worksheet': 'from openpyxl.worksheet.worksheet', 87 | \ 'apps': 'from django.apps', 88 | \ 'argparse': 'import argparse', 89 | \ 'asyncio': 'import asyncio', 90 | \ 'base64': 'import base64', 91 | \ 'cache': 'from django.core.cache', 92 | \ 'cached_property': 'from django.utils.functional', 93 | \ 'call_command': 'from django.core.management', 94 | \ 'cast': 'from typing', 95 | \ 'connection': 'from django.db', 96 | \ 'csv': 'import csv', 97 | \ 'datetime': 'import datetime', 98 | \ 'decimal': 'import decimal', 99 | \ 'deepcopy': 'from copy', 100 | \ 'force_text': 'from django.utils.encoding', 101 | \ 'freeze_time': 'from freezegun', 102 | \ 'freezegun': 'import freezegun', 103 | \ 'frozendict': 'from frozendict', 104 | \ 'functools': 'import functools', 105 | \ 'generics': 'from rest_framework', 106 | \ 'get_object_or_404': 'from django.shortcuts', 107 | \ 'io': 'import io', 108 | \ 'itertools': 'import itertools', 109 | \ 'json': 'import json', 110 | \ 'logging': 'import logging', 111 | \ 'login_required': 'from django.contrib.auth.decorators', 112 | \ 'mark_safe': 'from django.utils.safestring', 113 | \ 'mock': 'from unittest', 114 | \ 'namedtuple': 'from collections', 115 | \ 'openpyxl': 'import openpyxl', 116 | \ 'operator': 'import operator', 117 | \ 'os': 'import os', 118 | \ 'overload': 'from typing', 119 | \ 'parse_datetime': 'from django.utils.dateparse', 120 | \ 'parse_qs': 'from urllib.parse', 121 | \ 'parse_qsl': 'from urllib.parse', 122 | \ 'partial': 'from functools', 123 | \ 'permissions': 'from rest_framework', 124 | \ 'post_save': 'from django.db.models.signals', 125 | \ 'pre_save': 'from django.db.models.signals', 126 | \ 'prefetch_related_objects': 'from django.db.models', 127 | \ 'pytest': 'import pytest', 128 | \ 'pytz': 'import pytz', 129 | \ 'quote': 'from urllib.parse', 130 | \ 'random': 'import random', 131 | \ 're': 'import re', 132 | \ 'receiver': 'from django.dispatch', 133 | \ 'reduce': 'from functools', 134 | \ 'render': 'from django.shortcuts', 135 | \ 'settings': 'from django.conf', 136 | \ 'shutil': 'import shutil', 137 | \ 'six': 'import six', 138 | \ 'status': 'from rest_framework', 139 | \ 'sys': 'import sys', 140 | \ 'tempfile': 'import tempfile', 141 | \ 'textwrap': 'import textwrap', 142 | \ 'time': 'import time', 143 | \ 'timezone': 'from django.utils', 144 | \ 'transaction': 'from django.db', 145 | \ 'typing': 'import typing', 146 | \ 'unittest': 'import unittest', 147 | \ 'url_reverse': 'from django.urls import reverse as', 148 | \ 'urlencode': 'from urllib.parse', 149 | \ 'urlparse': 'from urllib.parse', 150 | \ 'urlunparse': 'from urllib.parse', 151 | \ 'uuid': 'import uuid', 152 | \ 'zipfile': 'import zipfile', 153 | \} 154 | -------------------------------------------------------------------------------- /snippets/_.snippets: -------------------------------------------------------------------------------- 1 | # Global snippets 2 | 3 | # CDATA 4 | snippet cdata 5 | 6 | # JS script tag. 7 | snippet js 8 | 11 | # New PHP file. 12 | snippet php 13 | 16 | snippet bash 17 | #!/bin/bash 18 | snippet py 19 | #!/usr/bin/env python 20 | 21 | def main(): 22 | pass${1} 23 | 24 | if __name__ == "__main__": 25 | main() 26 | snippet uuid 27 | `split(execute((has('python') ? 'python' : 'python3') . ' import uuid; print(uuid.uuid4().hex)'))[0]`${0} 28 | -------------------------------------------------------------------------------- /snippets/autoit.snippets: -------------------------------------------------------------------------------- 1 | snippet if 2 | If ${1:condition} Then 3 | ${2:; True code} 4 | EndIf 5 | snippet el 6 | Else 7 | ${1} 8 | snippet elif 9 | ElseIf ${1:condition} Then 10 | ${2:; True code} 11 | # If/Else block 12 | snippet ifel 13 | If ${1:condition} Then 14 | ${2:; True code} 15 | Else 16 | ${3:; Else code} 17 | EndIf 18 | # If/ElseIf/Else block 19 | snippet ifelif 20 | If ${1:condition 1} Then 21 | ${2:; True code} 22 | ElseIf ${3:condition 2} Then 23 | ${4:; True code} 24 | Else 25 | ${5:; Else code} 26 | EndIf 27 | # Switch block 28 | snippet switch 29 | Switch (${1:condition}) 30 | Case {$2:case1}: 31 | {$3:; Case 1 code} 32 | Case Else: 33 | {$4:; Else code} 34 | EndSwitch 35 | # Select block 36 | snippet select 37 | Select (${1:condition}) 38 | Case {$2:case1}: 39 | {$3:; Case 1 code} 40 | Case Else: 41 | {$4:; Else code} 42 | EndSelect 43 | # While loop 44 | snippet while 45 | While (${1:condition}) 46 | ${2:; code...} 47 | WEnd 48 | # For loop 49 | snippet for 50 | For ${1:n} = ${3:1} to ${2:count} 51 | ${4:; code...} 52 | Next 53 | # New Function 54 | snippet func 55 | Func ${1:fname}(${2:`indent('.') ? 'self' : ''`}): 56 | ${4:Return} 57 | EndFunc 58 | # Message box 59 | snippet msg 60 | MsgBox(${3:MsgType}, ${1:"Title"}, ${2:"Message Text"}) 61 | # Debug Message 62 | snippet debug 63 | MsgBox(0, "Debug", ${1:"Debug Message"}) 64 | # Show Variable Debug Message 65 | snippet showvar 66 | MsgBox(0, "${1:VarName}", $1) 67 | -------------------------------------------------------------------------------- /snippets/c.snippets: -------------------------------------------------------------------------------- 1 | ## General ## 2 | snippet guard 3 | #ifndef __${1:test}_H_ 4 | #define __$1_H_ 5 | 6 | ${2} 7 | 8 | #endif 9 | snippet doc 10 | /** 11 | ${1} 12 | */ 13 | snippet main 14 | int main(int argc, char** argv) { 15 | ${1} 16 | 17 | return 0; 18 | } 19 | snippet { 20 | { 21 | ${1} 22 | } 23 | ## Control flow ## 24 | snippet if 25 | if (${1:cond}) { 26 | ${2} 27 | } 28 | snippet elif 29 | else if (${1:cond}) { 30 | ${2} 31 | } 32 | snippet else 33 | else { 34 | ${1} 35 | } 36 | snippet switch 37 | switch (${1:var}) { 38 | ${2} 39 | } 40 | snippet case 41 | case ${1:val}: 42 | ${2} 43 | break; 44 | snippet for 45 | for (size_t ${1:index} = 0; $1 < ${2:len}; ++$1) { 46 | ${3} 47 | } 48 | snippet while 49 | while (${1:condition}) { 50 | ${2} 51 | } 52 | snippet do 53 | do { 54 | ${2} 55 | } while (${1:condition}) 56 | -------------------------------------------------------------------------------- /snippets/cpp.snippets: -------------------------------------------------------------------------------- 1 | # C++0x range-based for loop 2 | snippet foreach 3 | for (auto ${2:name}: ${3:array}) 4 | { 5 | ${4} 6 | } 7 | snippet class 8 | class ${1:`expand("%:r")`} 9 | { 10 | private: 11 | ${2} 12 | public: 13 | }; 14 | snippet namespace 15 | namespace ${1:name} 16 | { 17 | ${2} 18 | } 19 | snippet name 20 | namespace ${1:name} 21 | { 22 | ${2} 23 | } 24 | -------------------------------------------------------------------------------- /snippets/css.snippets: -------------------------------------------------------------------------------- 1 | snippet { 2 | { 3 | ${1} 4 | } 5 | snippet box 6 | box-sizing: border-box; 7 | -moz-box-sizing: border-box; 8 | -------------------------------------------------------------------------------- /snippets/d.snippets: -------------------------------------------------------------------------------- 1 | snippet /** 2 | /** 3 | ${1} 4 | */ 5 | snippet main 6 | void main(string[] argv) { 7 | ${1} 8 | } 9 | snippet { 10 | { 11 | ${1} 12 | } 13 | ## Control flow ## 14 | snippet if 15 | if (${1:cond}) { 16 | ${2} 17 | } 18 | snippet elif 19 | else if (${1:cond}) { 20 | ${2} 21 | } 22 | snippet else 23 | else { 24 | ${1} 25 | } 26 | snippet switch 27 | switch (${1:var}) { 28 | ${2} 29 | } 30 | snippet case 31 | case ${1:val}: 32 | ${2} 33 | break; 34 | snippet for 35 | for (${1:int} ${2:index} = 0; $2 < ${3:len}; ++$2) { 36 | ${4} 37 | } 38 | snippet while 39 | while (${1:condition}) { 40 | ${2} 41 | } 42 | snippet do 43 | do { 44 | ${2} 45 | } while (${1:condition}) 46 | snippet try 47 | try { 48 | ${2} 49 | } catch (${1:Exception} ex) { 50 | 51 | } 52 | snippet each 53 | foreach(${1:val}; ${2:expr}) { 54 | ${3} 55 | } 56 | snippet foreach 57 | foreach(${1:val}; ${2:expr}) { 58 | ${3} 59 | } 60 | snippet property 61 | @nogc @safe pure nothrow 62 | @property ${1:T} ${2:foo}() const { 63 | return _$2; 64 | } 65 | 66 | @nogc @safe pure nothrow 67 | @property void $2($1 value) { 68 | _$2 = value; 69 | } 70 | -------------------------------------------------------------------------------- /snippets/go.snippets: -------------------------------------------------------------------------------- 1 | snippet if 2 | if ${1:cond} { 3 | ${2} 4 | } 5 | snippet if! 6 | if ${1:cond} != nil { 7 | ${2} 8 | } 9 | snippet if= 10 | if ${1:cond} == nil { 11 | ${2} 12 | } 13 | snippet for 14 | for ${1:i} := 0; $1 < ${2:len}; $1++ { 15 | ${3} 16 | } 17 | snippet forr 18 | for ${1:i} := range ${2:slice} { 19 | ${3} 20 | } 21 | snippet main 22 | package main 23 | 24 | func main() { 25 | ${0} 26 | } 27 | -------------------------------------------------------------------------------- /snippets/html.snippets: -------------------------------------------------------------------------------- 1 | # Nothing here! 2 | snippet htm 3 | 4 | 5 | 6 | 7 | 8 | Page Title 9 | 10 | ${1} 11 | 12 | 13 | snippet js 14 | 16 | snippet ready 17 | $(document).ready(function() 18 | { 19 | ${1} 20 | }); 21 | snippet css 22 | 23 | snippet style 24 | 27 | snippet cdata 28 | 29 | snippet . 30 |   31 | -------------------------------------------------------------------------------- /snippets/htmljinja.snippets: -------------------------------------------------------------------------------- 1 | snippet for 2 | {% for ${1:val} in ${2:sequence} 3 | %} 4 | $3 5 | {% endfor %} 6 | snippet if 7 | {% if ${1:cond} %} 8 | $2 9 | {% endif %} 10 | -------------------------------------------------------------------------------- /snippets/java.snippets: -------------------------------------------------------------------------------- 1 | # Braces 2 | snippet { 3 | { 4 | ${1} 5 | } 6 | ## Control flow ## 7 | snippet if 8 | if (${1:cond}) { 9 | ${2} 10 | } 11 | snippet elif 12 | else if (${1:cond}) { 13 | ${2} 14 | } 15 | snippet else 16 | else { 17 | ${1} 18 | } 19 | snippet switch 20 | switch (${1:var}) { 21 | ${2} 22 | } 23 | snippet case 24 | case ${1:val}: 25 | ${2} 26 | break; 27 | snippet for 28 | for (${1:int} ${2:index} = 0; $2 < ${3:len}; ++$2) { 29 | ${4} 30 | } 31 | snippet foreach 32 | for (${1:Type} ${2:name} : ${3:container}) { 33 | ${4} 34 | } 35 | snippet it 36 | for (Iterator<${1:Type}> ${2:name}It = ${3:container}.iterator(); $2It.hasNext();) { 37 | $1 $2 = $2It.next(); 38 | 39 | ${4} 40 | } 41 | snippet while 42 | while (${1:condition}) { 43 | ${2} 44 | } 45 | snippet do 46 | do { 47 | ${2} 48 | } while (${1:condition}) 49 | snippet doc 50 | /** 51 | * ${1:description} 52 | */${2} 53 | # Abstract class 54 | snippet abstract 55 | public abstract class ${1:`expand("%:r")`} 56 | { 57 | ${2} 58 | } 59 | snippet class 60 | public class ${1:`expand("%:r")`} { 61 | ${2} 62 | } 63 | snippet enum 64 | public enum ${1:`expand("%:r")`} { 65 | ${2} 66 | } 67 | # single-item containers. 68 | snippet ArrayList 69 | List<${1:Object}> ${2:name}${3: = new ArrayList<$1>()};${4} 70 | snippet LinkedList 71 | List<${1:Object}> ${2:name}${3: = new LinkedList<$1>()};${4} 72 | snippet HashSet 73 | Set<${1:Object}> ${2:name}${3: = new HashSet<$1>()};${4} 74 | snippet LinkedHashSet 75 | Set<${1:Object}> ${2:name}${3: = new LinkedHashSet<$1>()};${4} 76 | # map containers. 77 | snippet HashMap 78 | Map<${1:Object}, ${2:Object}> ${3:name}${4: = new HashMap<$1, $2>()};${5} 79 | snippet Hashtable 80 | Map<${1:Object}, ${2:Object}> ${3:name}${4: = new Hashtable<$1, $2>()};${5} 81 | snippet EnumMap 82 | Map<${1:EnumType}, ${2:Object}> ${3:name}${4: = new EnumMap<$1, $2>($1.class)};${6} 83 | snippet cons 84 | public `expand("%:r")`(${1:}) { 85 | ${2} 86 | } 87 | snippet main 88 | public static void main (String[] argv) throws Exception { 89 | ${1} 90 | } 91 | snippet prop 92 | private ${1:boolean} ${2:name}; 93 | 94 | public $1 get${3:Name}() { 95 | return this.$2; 96 | } 97 | 98 | public void set$3($1 _$2) { 99 | this.$2 = _$2; 100 | } 101 | ${4} 102 | snippet pub 103 | public ${1:void} ${2:name}(${3:}) { 104 | ${4} 105 | } 106 | snippet pri 107 | private ${1:void} ${2:name}(${3:}) { 108 | ${4} 109 | } 110 | snippet prot 111 | protected ${1:void} ${2:name}(${3:}) { 112 | ${4} 113 | } 114 | snippet th 115 | throws ${1:RuntimeException} 116 | snippet thr 117 | throws ${1:RuntimeException} 118 | snippet Run 119 | RuntimeException 120 | snippet try 121 | try { 122 | ${2} 123 | } 124 | catch (${1:Exception} ex) { 125 | 126 | } 127 | snippet rethrow 128 | try { 129 | ${3} 130 | } 131 | catch (${1:Exception} ex) { 132 | throw new ${2:RuntimeException}(ex); 133 | } 134 | -------------------------------------------------------------------------------- /snippets/javascript.snippets: -------------------------------------------------------------------------------- 1 | ## Control flow ### 2 | snippet forin 3 | for (var ${1:variable} in ${2:sequence}) { 4 | if ($2.hasOwnProperty($1)) { 5 | ${3} 6 | } 7 | } 8 | snippet forof 9 | for (const ${1:elem} of ${2:sequence}) { 10 | ${3} 11 | } 12 | snippet if 13 | if (${1:condition}) { 14 | ${2} 15 | } 16 | snippet elif 17 | else if (${1:condition}) { 18 | ${2} 19 | } 20 | snippet else 21 | else { 22 | ${1} 23 | } 24 | snippet switch 25 | switch (${1:var}) { 26 | ${2} 27 | } 28 | snippet case 29 | case ${1:val}: 30 | ${2} 31 | break; 32 | snippet while 33 | while (${1:condition}) { 34 | ${2} 35 | } 36 | snippet for 37 | for (let ${1:index} = 0; $1 < ${2:len}; ++$2) { 38 | ${3} 39 | } 40 | snippet try 41 | try { 42 | ${1} 43 | } catch(err) { 44 | 45 | } 46 | ## jQuery ## 47 | snippet ready 48 | $(function() { 49 | ${1} 50 | }); 51 | snippet module 52 | function ${1:Module}() { 53 | "use strict"; 54 | 55 | var module = $1; 56 | } 57 | 58 | $1(); 59 | ## Other ## 60 | snippet log 61 | console.log(${1}); 62 | snippet /** 63 | /** 64 | * ${1} 65 | */ 66 | snippet => 67 | (${1}) => $2 68 | snippet { 69 | { 70 | ${0} 71 | } 72 | snippet ( 73 | {${0} 74 | ) 75 | snippet describe 76 | describe('${1:Thing}', () => { 77 | ${0} 78 | }) 79 | snippet it 80 | it('should ${1:message}', () => { 81 | ${0} 82 | }) 83 | snippet beforeEach 84 | beforeEach(() => { 85 | ${0} 86 | }) 87 | snippet provide 88 | beforeEach(angular.mock.module($provide => { 89 | ${0} 90 | })) 91 | snippet has 92 | if (${1:object}.hasOwnProperty(${2:key})) { 93 | continue; 94 | }${3} 95 | snippet func 96 | function${1}() { 97 | ${2} 98 | }; 99 | snippet use 100 | 'use strict' 101 | -------------------------------------------------------------------------------- /snippets/jsp.snippets: -------------------------------------------------------------------------------- 1 | # Braces 2 | snippet { 3 | { 4 | ${1} 5 | } 6 | ## Control flow ## 7 | snippet if 8 | if (${1:cond}) { 9 | ${2} 10 | } 11 | snippet elif 12 | else if (${1:cond}) { 13 | ${2} 14 | } 15 | snippet else 16 | else { 17 | ${1} 18 | } 19 | snippet switch 20 | switch (${1:var}) { 21 | ${2} 22 | } 23 | snippet case 24 | case ${1:val}: 25 | ${2} 26 | break; 27 | snippet for 28 | for (${1:int} ${2:index} = 0; $2 < ${3:len}; ++$2) { 29 | ${4} 30 | } 31 | snippet foreach 32 | for (${1:Type} ${2:name} : ${3:container}) { 33 | ${4} 34 | } 35 | snippet while 36 | while (${1:condition}) { 37 | ${2} 38 | } 39 | snippet do 40 | do { 41 | ${2} 42 | } while (${1:condition}) 43 | snippet doc 44 | /** 45 | * ${1:description} 46 | */${2} 47 | snippet class 48 | class `expand("%:r")` { 49 | ${1} 50 | } 51 | snippet con 52 | public `expand("%:r")`(${1:}) { 53 | ${2} 54 | } 55 | snippet main 56 | public static void main (String[] argv) throws Exception { 57 | ${1} 58 | } 59 | snippet prop 60 | private ${1:boolean} ${2:name}; 61 | 62 | public $1 get${3:Name}() { 63 | return this.$2; 64 | } 65 | 66 | public void set$3($1 _$2) { 67 | this.$2 = _$2; 68 | } 69 | ${4} 70 | snippet pub 71 | public ${1:void} ${2:name}(${3:}) { 72 | ${4} 73 | } 74 | snippet pri 75 | private ${1:void} ${2:name}(${3:}) { 76 | ${4} 77 | } 78 | snippet pro 79 | protected ${1:void} ${2:name}(${3:}) { 80 | ${4} 81 | } 82 | snippet th 83 | throws Exception 84 | snippet Run 85 | RuntimeException 86 | snippet try 87 | try { 88 | ${2} 89 | } 90 | catch (${1:Exception} ex) { 91 | 92 | } 93 | -------------------------------------------------------------------------------- /snippets/mako.snippets: -------------------------------------------------------------------------------- 1 | # Nothing here! 2 | 3 | -------------------------------------------------------------------------------- /snippets/markdown.snippets: -------------------------------------------------------------------------------- 1 | snippet raw 2 | {{< rawhtml >}} 3 | snippet /raw 4 | {{< /rawhtml >}} 5 | -------------------------------------------------------------------------------- /snippets/mysql.snippets: -------------------------------------------------------------------------------- 1 | snippet drop 2 | DROP TABLE IF EXISTS ${1}; 3 | snippet create 4 | CREATE TABLE ${1} ( 5 | ${2:id} ${4} 6 | 7 | timestamp TIMESTAMP NOT NULL, 8 | 9 | PRIMARY KEY ($2) 10 | ) ENGINE=InnoDb CHARSET=utf8 COMMENT='${3}'; 11 | snippet no 12 | NOT NULL 13 | snippet id 14 | INT UNSIGNED NOT NULL 15 | snippet sid 16 | SMALLINT UNSIGNED NOT NULL 17 | snippet mid 18 | MEDIUMINT UNSIGNED NOT NULL 19 | snippet uint 20 | INT UNSIGNED 21 | snippet int 22 | INT 23 | snippet usint 24 | SMALLINT UNSIGNED 25 | snippet sint 26 | SMALLINT 27 | snippet vc 28 | VARCHAR(${1:32})${2} 29 | snippet utf16 30 | CHARACTER SET utf16 31 | snippet fk 32 | FOREIGN KEY (${1:cols}) REFERENCES ${2:table} ($1)${3} 33 | snippet uni 34 | UNIQUE KEY (${1:cols}) 35 | snippet au 36 | AUTO_INCREMENT 37 | -------------------------------------------------------------------------------- /snippets/objc.snippets: -------------------------------------------------------------------------------- 1 | # Nothing here! 2 | 3 | -------------------------------------------------------------------------------- /snippets/perl.snippets: -------------------------------------------------------------------------------- 1 | # Nothing here! 2 | 3 | -------------------------------------------------------------------------------- /snippets/php.snippets: -------------------------------------------------------------------------------- 1 | # Magic debugging line 2 | snippet debug 3 | error_log(sprintf("[%s:%s] %s", basename(__FILE__), __LINE__, var_export(${1}, true))); 4 | # Magic debugging line 5 | snippet debugs 6 | error_log(sprintf("[%s:%s] %s", basename(__FILE__), __LINE__, ${1})); 7 | # BEHOLD! 8 | snippet xmlout 9 | fwrite(fopen('/var/log/php/xmlout.xml', 'w'), $${1:objDom}->saveXml(${2:$objElement})) && system('python -c \'path ="/var/log/php/xmlout.xml"; from lxml import etree; doc = etree.parse(path); open(path, "w").write(etree.tostring(doc, pretty_print=True))\'');${3} 10 | snippet { 11 | { 12 | ${1} 13 | } 14 | ## Control flow ## 15 | snippet if 16 | if (${1:condition}) { 17 | ${2} 18 | } 19 | snippet elif 20 | elseif (${1:condition}) { 21 | ${2} 22 | } 23 | snippet else 24 | else { 25 | ${1} 26 | } 27 | snippet switch 28 | switch (${1:x}) { 29 | ${2} 30 | } 31 | snippet case 32 | case ${1:val}: 33 | ${2} 34 | break; 35 | snippet foreach 36 | foreach ($${2:variable} as $${1:key}) { 37 | ${3} 38 | } 39 | snippet for 40 | for ($${1:intIndex}; $$1 < ${2:limit}; ++$$1) { 41 | ${3} 42 | } 43 | snippet while 44 | while (${1:cond}) { 45 | } 46 | # Try, catch 47 | snippet try 48 | try { 49 | ${1} 50 | } 51 | catch (Exception $objEx) { 52 | 53 | } 54 | ## Functions and Classes ## 55 | # Function with doc block 56 | snippet func 57 | /** 58 | * ${1:description} 59 | * 60 | */ 61 | function ${2:name}(${3}) 62 | { 63 | ${4} 64 | } 65 | # Doc block 66 | snippet doc 67 | /** 68 | * ${1:description} 69 | * 70 | */${2} 71 | # Abstract class 72 | snippet abstract 73 | abstract class ${1:`expand("%:r")`} 74 | { 75 | ${2} 76 | } 77 | snippet class 78 | class ${1:`expand("%:r")`} { 79 | ${2} 80 | } 81 | # An exception class 82 | snippet ex 83 | class ${1:Name}Exception extends Exception {} 84 | # Class method 85 | snippet meth 86 | ${1:public} function ${2:name}(${3}) 87 | { 88 | ${4} 89 | } 90 | 91 | # Protected class method. 92 | snippet prot 93 | protected function ${1:name}(${2}) 94 | { 95 | ${3} 96 | } 97 | 98 | # Public class method. 99 | snippet pub 100 | public function ${1:name}(${2}) 101 | { 102 | ${3} 103 | } 104 | 105 | # Private class method. 106 | snippet pri 107 | private function ${1:name}(${2}) 108 | { 109 | ${3} 110 | } 111 | 112 | # New constructor 113 | snippet newcons 114 | function __construct(${1}) 115 | { 116 | ${2} 117 | } 118 | # Child constructor 119 | snippet cons 120 | function __construct(${1}) 121 | { 122 | parent::__construct(${2}); 123 | 124 | ${3} 125 | } 126 | # Properties 127 | snippet prop 128 | private $${1:name}; 129 | 130 | public function get${2:Name}() { 131 | return $this->$1; 132 | } 133 | 134 | public function set$2($$1) { 135 | $this->$1 = $$1; 136 | } 137 | ${3} 138 | -------------------------------------------------------------------------------- /snippets/python.snippets: -------------------------------------------------------------------------------- 1 | # UTF-8 declaration 2 | snippet utf 3 | # -*- coding: utf-8 -*-${1} 4 | ## Common function calls/patterns ## 5 | # Type checking 6 | snippet isi 7 | isinstance(${1:var}, ${2:basestring})${3} 8 | # Type checking 9 | snippet fut 10 | from __future__ import absolute_import, division, print_function, unicode_literals # isort:skip # noqa 11 | # Join 12 | snippet join 13 | "${1}".join(${2}) 14 | # Main block 15 | snippet main 16 | def main() -> None: 17 | pass${1} 18 | 19 | 20 | if __name__ == "__main__": # pragma: no cover 21 | main() # pragma: no cover 22 | ## Functions and classes ## 23 | # doc string 24 | snippet doc 25 | """ 26 | ${1} 27 | """${2} 28 | snippet ''' 29 | """ 30 | ${1} 31 | """${2} 32 | snippet """ 33 | """ 34 | ${1} 35 | """${2} 36 | # Function 37 | snippet def 38 | def ${1:name}(${2}): 39 | ${3} 40 | # Method 41 | snippet meth 42 | def ${1:name}(self${2}): 43 | ${3} 44 | # Class 45 | snippet class 46 | class ${1:name} (${2:object}): 47 | ${3} 48 | # abc metaclass declartion 49 | snippet meta 50 | __metaclass__ = ABCMeta 51 | snippet cons 52 | def __init__(self${1}): 53 | ${2} 54 | # New exception type 55 | snippet err 56 | class ${1:ExceptionName} (Exception): 57 | pass 58 | ${2} 59 | snippet decorator 60 | def ${1:name}(func): 61 | from functools import wraps 62 | 63 | @wraps 64 | def inner(*args, **kwargs): 65 | result = func(*args, **kwargs) 66 | ${2} 67 | 68 | return result 69 | 70 | return inner 71 | snippet RunPython 72 | def ${1:forwards}(apps, schema_editor): 73 | pass 74 | 75 | 76 | def ${2:backwards}(apps, schema_editor): 77 | pass 78 | 79 | ${0}migrations.RunPython( 80 | $1, 81 | $2, 82 | elidable=True, 83 | ), 84 | snippet cursor 85 | with connection.cursor() as cursor: 86 | ${0} 87 | snippet get_model 88 | get_model('`expand('%:p:h:h:t')`', '`matchlist(getline('.'), '\(\w\+\) =')[1]`')${0} 89 | snippet super 90 | `python_tools#cursor_info#GenerateSuperCall()`(${0}) 91 | snippet utest 92 | from unittest import TestCase 93 | 94 | class ${1:SomeTestCase}(TestCase): 95 | 96 | def setUp(self): 97 | super().setUp() 98 | 99 | def tearDown(self): 100 | super().tearDown() 101 | snippet .save(u 102 | .save(update_fields=[${0}]) 103 | snippet typec 104 | if TYPE_CHECKING: 105 | ${0} 106 | -------------------------------------------------------------------------------- /snippets/rst.snippets: -------------------------------------------------------------------------------- 1 | snippet fig 2 | .. figure:: ${1:location} 3 | :scale: ${2:50%} 4 | 5 | $3 6 | snippet toc 7 | .. contents:: ${1:Table of Contnets} 8 | -------------------------------------------------------------------------------- /snippets/ruby.snippets: -------------------------------------------------------------------------------- 1 | # Ruby is shit. 2 | 3 | -------------------------------------------------------------------------------- /snippets/sh.snippets: -------------------------------------------------------------------------------- 1 | # Control flow 2 | snippet if 3 | if [ ${1} ]; then 4 | ${2} 5 | fi 6 | # Numeric if 7 | snippet ifn 8 | if (( ${1} )); then 9 | ${2} 10 | fi 11 | # If the last command failed 12 | snippet iflast 13 | if (( $? )); then 14 | ${1} 15 | fi 16 | snippet for 17 | for ${1:x} in ${2:"$@"}; do 18 | ${3} 19 | done 20 | snippet while 21 | while read line; do 22 | ${1} 23 | done 24 | # Handy tricks 25 | snippet thispath 26 | thispath=$(dirname "$(readlink -f "$0")") 27 | 28 | snippet switch 29 | case ${1:var} in 30 | ${2} 31 | esac 32 | snippet case 33 | ${1:val}) 34 | ${2} 35 | ;; 36 | snippet default 37 | *) 38 | ${1} 39 | ;; 40 | snippet error 41 | echo ${1} 1>&2 42 | -------------------------------------------------------------------------------- /snippets/snippet.snippets: -------------------------------------------------------------------------------- 1 | # Yo dawg, I heard you like snippets, 2 | # so we wrote snippets for your snippets so you can 3 | # snip while you snip. 4 | snippet snip 5 | snippet ${1:trigger} 6 | ${2} 7 | snippet msnip 8 | snippet ${1:trigger} ${2:description} 9 | ${3} 10 | -------------------------------------------------------------------------------- /snippets/sql.snippets: -------------------------------------------------------------------------------- 1 | snippet drop 2 | DROP TABLE IF EXISTS ${1}; 3 | snippet ebcreate 4 | CREATE TABLE ${1} ( 5 | ${3} 6 | 7 | stmTimestamp TIMESTAMP NOT NULL, 8 | 9 | PRIMARY KEY 10 | ) ENGINE=Innodb COMMENT='${2}'; 11 | 12 | -------------------------------------------------------------------------------- /snippets/tcl.snippets: -------------------------------------------------------------------------------- 1 | # #!/usr/bin/tclsh 2 | snippet #! 3 | #!/usr/bin/tclsh 4 | -------------------------------------------------------------------------------- /snippets/tex.snippets: -------------------------------------------------------------------------------- 1 | # Nothing here! 2 | -------------------------------------------------------------------------------- /snippets/typescript.snippets: -------------------------------------------------------------------------------- 1 | snippet describe 2 | describe('${1:Thing}', () => { 3 | ${0} 4 | }) 5 | snippet it 6 | it('should ${1:message}', () => { 7 | ${0} 8 | }) 9 | snippet beforeEach 10 | beforeEach(() => { 11 | ${0} 12 | }) 13 | snippet beforEach 14 | beforeEach(() => { 15 | ${0} 16 | }) 17 | snippet mockmod 18 | beforeEach(angular.mock.module(${0})) 19 | snippet provide 20 | beforeEach(angular.mock.module(($provide: ng.auto.IProvideService) => { 21 | $provide.constant('USER', USER) 22 | })) 23 | snippet inject 24 | beforeEach(inject(( 25 | _$httpBackend_: ng.IHttpBackendService, 26 | _$rootScope_: ng.IRootScopeService, 27 | ) => { 28 | $httpBackend = _$httpBackend_ 29 | $rootScope = _$rootScope_ 30 | })) 31 | snippet $httpBackend: 32 | $httpBackend: ng.IHttpBackendService 33 | snippet _$httpBackend_: 34 | _$httpBackend_: ng.IHttpBackendService 35 | snippet $timeout: 36 | $timeout: ng.ITimeoutService 37 | snippet _$timeout_: 38 | _$timeout_: ng.ITimeoutService 39 | snippet $location: 40 | $location: ng.ILocationService 41 | snippet _$location_: 42 | _$location_: ng.ILocationService 43 | snippet $window: 44 | $window: ng.IWindowService 45 | snippet _$window_: 46 | _$window_: ng.IWindowService 47 | snippet $q: 48 | $q: ng.IQService 49 | snippet _$q_: 50 | _$q_: ng.IQService 51 | snippet $rootScope: 52 | $rootScope: ng.IRootScopeService 53 | snippet _$rootScope_: 54 | _$rootScope_: ng.IRootScopeService 55 | snippet $compile: 56 | $compile: ng.ICompileService 57 | snippet _$compile_: 58 | _$compile_: ng.ICompileService 59 | snippet $componentController: 60 | $componentController: ng.IComponentControllerService 61 | snippet _$componentController_: 62 | _$componentController_: ng.IComponentControllerService 63 | snippet $route: 64 | $route: ng.route.IRouteService 65 | snippet _$route_: 66 | _$route_: ng.route.IRouteService 67 | snippet $controller: 68 | $controller: ng.IControllerService 69 | snippet _$controller_: 70 | _$controller_: ng.IControllerService 71 | snippet $scope: 72 | $scope: ng.IScope 73 | snippet _$scope_: 74 | _$scope_: ng.IScope 75 | snippet $provide: 76 | $provide: ng.auto.IProvideService 77 | snippet $uibModalInstance: 78 | $uibModalInstance: ng.ui.bootstrap.IModalInstanceService 79 | snippet _$uibModalInstance_: 80 | _$uibModalInstance_: ng.ui.bootstrap.IModalInstanceService 81 | snippet $uibModal: 82 | $uibModal: ng.ui.bootstrap.IModalService 83 | snippet _$uibModal_: 84 | _$uibModal_: ng.ui.bootstrap.IModalService 85 | snippet $filter: 86 | $filter: ng.IFilterService 87 | snippet _$filter_: 88 | _$filter_: ng.IFilterService 89 | snippet $interval: 90 | $interval: ng.IIntervalService 91 | snippet _$interval_: 92 | _$interval_: ng.IIntervalService 93 | snippet {key 94 | {[key: string]: ${0} 95 | snippet keyany 96 | {[key: string]: any}${0} 97 | snippet import 98 | import {${2}} from '${1}'${0} 99 | snippet copy 100 | Object.assign({}, ${1})${0} 101 | snippet forof 102 | for (const ${1:name} of ${2:container}) { 103 | ${3} 104 | } 105 | snippet imp 106 | implements`snippet_functions#MagicTypeScriptInterfaceName()` 107 | snippet implements 108 | implements`snippet_functions#MagicTypeScriptInterfaceName()` 109 | -------------------------------------------------------------------------------- /snippets/vim.snippets: -------------------------------------------------------------------------------- 1 | # Nothing here! 2 | 3 | snippet ale_linter 4 | " Author: w0rp - 5 | " Description: Describe this! 6 | 7 | if exists('g:loaded_ale_linters_${1:`expand('%:p:h:t')`}_${2:`expand('%:p:t:r')`}') 8 | finish 9 | endif 10 | 11 | let g:loaded_ale_linters_$1_$2 = 1 12 | 13 | function! ale_linters#$1#$2#Handle(buffer, lines) 14 | " Matches patterns like the following: 15 | " 16 | " EXAMPLE HERE 17 | let pattern = '^.\+:\(\d\+\):\(\d\+\): \(.\+\)' 18 | let output = [] 19 | 20 | for line in a:lines 21 | let l:match = matchlist(line, pattern) 22 | 23 | if len(l:match) == 0 24 | continue 25 | endif 26 | 27 | call add(output, { 28 | \ 'bufnr': a:buffer, 29 | \ 'lnum': l:match[1] + 0, 30 | \ 'vcol': 0, 31 | \ 'col': l:match[2] + 0, 32 | \ 'text': l:match[3], 33 | \ 'type': 'E', 34 | \ 'nr': -1, 35 | \}) 36 | endfor 37 | 38 | return output 39 | endfunction 40 | 41 | call ALEAddLinter('$1', { 42 | \ 'name': '$2', 43 | \ 'executable': '$2', 44 | \ 'command': '$2', 45 | \ 'callback': 'ale_linters#$1#$2#Handle', 46 | \}) 47 | 48 | snippet func 49 | function! `snippet_functions#VimFunctionPrefix()`${1:Name}() `snippet_functions#VimFunctionPostfix()` 50 | ${0} 51 | endfunction 52 | 53 | snippet sfunc 54 | function! s:${1:Name}() abort 55 | ${0} 56 | endfunction 57 | snippet redir 58 | let l:output = '' 59 | redir => l:output 60 | silent ${0} 61 | redir END 62 | let l:output_list = split(l:output, "\n") 63 | snippet if 64 | if ${0} 65 | endif 66 | snippet endfunction 67 | endfunction 68 | snippet v:t_string 69 | v:t_string 70 | snippet v:t_number 71 | v:t_number 72 | snippet v:t_func 73 | v:t_func 74 | snippet v:t_list 75 | v:t_list 76 | snippet v:t_dict 77 | v:t_dict 78 | -------------------------------------------------------------------------------- /snippets/xml.snippets: -------------------------------------------------------------------------------- 1 | # Comments 2 | snippet ! 3 | 4 | -------------------------------------------------------------------------------- /snippets/xsd.snippets: -------------------------------------------------------------------------------- 1 | # Comments 2 | snippet ! 3 | 4 | ## Attributes ## 5 | snippet att 6 | ${4} 7 | ## Other shit ## 8 | snippet complex 9 | 10 | ${1} 11 | 12 | # Element types 13 | snippet int 14 | 15 | snippet str 16 | 17 | -------------------------------------------------------------------------------- /snippets/xslt.snippets: -------------------------------------------------------------------------------- 1 | ## XSL madness ## 2 | 3 | # New stylesheet 4 | snippet new 5 | 6 | 7 | 8 | 9 | ${1} 10 | 11 | 12 | # Attribute 13 | snippet att 14 | ${2} 15 | # Debugging magic 16 | snippet debug 17 | 20 | # A visible comment 21 | snippet com 22 | ${1}${2} 23 | # An invisible comment 24 | snippet ! 25 | 26 | # An invisible comment, multiline. 27 | snippet !! 28 | 31 | ## XSL variables and values ## 32 | # Variable with select 33 | snippet var 34 | 35 | # Variable with value 36 | snippet varb 37 | 38 | ${2} 39 | 40 | # Variable with value, one line 41 | snippet varc 42 | ${2}${3} 43 | # value-of 44 | snippet val 45 | ${2} 46 | # Text block 47 | snippet text 48 | ${1} 49 | # XSLT1 is shit, XSLT2 doesn't exist. 50 | snippet textb 51 | ${1} 52 | ## XSL control flow ## 53 | # xsl:if 54 | snippet if 55 | 56 | ${2} 57 | 58 | # xsl:choose 59 | snippet choose 60 | 61 | 62 | ${2} 63 | 64 | 65 | 66 | 67 | 68 | # xsl:when 69 | snippet when 70 | 71 | ${2} 72 | 73 | # foreach 74 | snippet foreach 75 | 76 | ${2} 77 | 78 | # sort 79 | snippet sort 80 | ${2} 81 | ## XSL template insanity ## 82 | # Create a template 83 | snippet temp 84 | 85 | ${2} 86 | 87 | # Template parameter 88 | snippet param 89 | 90 | # Call template 91 | snippet call 92 | 93 | # Call template with value 94 | snippet callb 95 | 96 | ${2} 97 | 98 | # xsl:with-param using select 99 | snippet with 100 | ${3} 101 | # xsl:with-param with value 102 | snippet withb 103 | 104 | ${2} 105 | 106 | # xsl:with-param with value, one line. 107 | snippet withc 108 | ${2}${3} 109 | snippet inc 110 | 111 | -------------------------------------------------------------------------------- /snippets/zsh.snippets: -------------------------------------------------------------------------------- 1 | # Nothing here! 2 | 3 | -------------------------------------------------------------------------------- /spell/en.utf-8.add: -------------------------------------------------------------------------------- 1 | ALEFix 2 | ALEFixSuggest 3 | ALEGoToDefinition 4 | ALEGoToDefinitionInTab 5 | ALELint 6 | AppVeyor 7 | autocmd 8 | BufEnter 9 | BufWrite 10 | CKEDITOR 11 | commenters 12 | config 13 | eslint 14 | ESLint 15 | Facebook 16 | filetype 17 | filetypes 18 | footswitch 19 | Funcref 20 | gitcommit 21 | gitlint 22 | javascript 23 | lexed 24 | linter 25 | linters 26 | loclist 27 | LSP 28 | MPRIS 29 | NeoVim 30 | quickfix 31 | stdin 32 | swimlanes 33 | VimL 34 | VirtualBox 35 | virtualenv 36 | wazokuadmin 37 | whitespace 38 | XMMS2 39 | namespacing 40 | inlineable 41 | SharePoint 42 | Q2 43 | Q3 44 | JIRA 45 | Office365 46 | Warcraft 47 | toolchain 48 | keybinds 49 | tsserver 50 | i_ideas_i 51 | semver 52 | datetime 53 | Timebox 54 | TypeScript 55 | mypy 56 | Pyright 57 | Django 58 | AngularJS 59 | microservices 60 | meetups 61 | Eshwari 62 | subgraph 63 | pointing 64 | contravariance 65 | contravariant 66 | variadic 67 | orderable 68 | Ethereum 69 | Tezos 70 | Blockchain 71 | Blockchains 72 | PoC 73 | Neovim 74 | neovim 75 | api 76 | virtualtext 77 | datasources 78 | Neural's 79 | OpenAI 80 | docstrings 81 | OpenAI's 82 | GPT 83 | datasource 84 | SoleTrader 85 | SoleTraders 86 | Georgi 87 | UAE 88 | PS3 89 | openai 90 | ui 91 | tox 92 | Wray 93 | w0rp 94 | roadmap 95 | FOSS 96 | falsy 97 | iterable 98 | inlining 99 | inlined 100 | summarization 101 | DenseChat 102 | shellcheck 103 | SC2207 104 | SC2128 105 | SC2034 106 | -------------------------------------------------------------------------------- /syntax/go-template-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Fatih Arslan 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of vim-go nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | This software includes some portions from Go. Go is used under the terms of the 30 | BSD like license. 31 | 32 | Copyright (c) 2012 The Go Authors. All rights reserved. 33 | 34 | Redistribution and use in source and binary forms, with or without 35 | modification, are permitted provided that the following conditions are 36 | met: 37 | 38 | * Redistributions of source code must retain the above copyright 39 | notice, this list of conditions and the following disclaimer. 40 | * Redistributions in binary form must reproduce the above 41 | copyright notice, this list of conditions and the following disclaimer 42 | in the documentation and/or other materials provided with the 43 | distribution. 44 | * Neither the name of Google Inc. nor the names of its 45 | contributors may be used to endorse or promote products derived from 46 | this software without specific prior written permission. 47 | 48 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 49 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 50 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 51 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 52 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 53 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 54 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 55 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 56 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 57 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 58 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 59 | 60 | The Go gopher was designed by Renee French. http://reneefrench.blogspot.com/ The design is licensed under the Creative Commons 3.0 Attributions license. Read this article for more details: https://blog.golang.org/gopher 61 | -------------------------------------------------------------------------------- /syntax/gohtmltmpl.vim: -------------------------------------------------------------------------------- 1 | if exists("b:current_syntax") 2 | finish 3 | endif 4 | 5 | if !exists("g:main_syntax") 6 | let g:main_syntax = 'html' 7 | endif 8 | 9 | runtime! syntax/gotexttmpl.vim 10 | runtime! syntax/html.vim 11 | unlet b:current_syntax 12 | 13 | syn cluster htmlPreproc add=gotplAction,goTplComment 14 | 15 | let b:current_syntax = "gohtmltmpl" 16 | 17 | " vim: sw=2 ts=2 et 18 | -------------------------------------------------------------------------------- /syntax/gotexttmpl.vim: -------------------------------------------------------------------------------- 1 | " Copyright 2011 The Go Authors. All rights reserved. 2 | " Use of this source code is governed by a BSD-style 3 | " license that can be found in the LICENSE file. 4 | " 5 | " gotexttmpl.vim: Vim syntax file for Go templates. 6 | 7 | " Quit when a (custom) syntax file was already loaded 8 | if exists("b:current_syntax") 9 | finish 10 | endif 11 | 12 | syn case match 13 | 14 | " Go escapes 15 | syn match goEscapeOctal display contained "\\[0-7]\{3}" 16 | syn match goEscapeC display contained +\\[abfnrtv\\'"]+ 17 | syn match goEscapeX display contained "\\x\x\{2}" 18 | syn match goEscapeU display contained "\\u\x\{4}" 19 | syn match goEscapeBigU display contained "\\U\x\{8}" 20 | syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+ 21 | 22 | hi def link goEscapeOctal goSpecialString 23 | hi def link goEscapeC goSpecialString 24 | hi def link goEscapeX goSpecialString 25 | hi def link goEscapeU goSpecialString 26 | hi def link goEscapeBigU goSpecialString 27 | hi def link goSpecialString Special 28 | hi def link goEscapeError Error 29 | 30 | " Strings and their contents 31 | syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError 32 | syn region goString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup 33 | syn region goRawString contained start=+`+ end=+`+ 34 | 35 | hi def link goString String 36 | hi def link goRawString String 37 | 38 | " Characters; their contents 39 | syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU 40 | syn region goCharacter contained start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup 41 | 42 | hi def link goCharacter Character 43 | 44 | " Integers 45 | syn match goDecimalInt contained "\<\d\+\([Ee]\d\+\)\?\>" 46 | syn match goHexadecimalInt contained "\<0x\x\+\>" 47 | syn match goOctalInt contained "\<0\o\+\>" 48 | syn match goOctalError contained "\<0\o*[89]\d*\>" 49 | syn cluster goInt contains=goDecimalInt,goHexadecimalInt,goOctalInt 50 | " Floating point 51 | syn match goFloat contained "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>" 52 | syn match goFloat contained "\<\.\d\+\([Ee][-+]\d\+\)\?\>" 53 | syn match goFloat contained "\<\d\+[Ee][-+]\d\+\>" 54 | " Imaginary literals 55 | syn match goImaginary contained "\<\d\+i\>" 56 | syn match goImaginary contained "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>" 57 | syn match goImaginary contained "\<\.\d\+\([Ee][-+]\d\+\)\?i\>" 58 | syn match goImaginary contained "\<\d\+[Ee][-+]\d\+i\>" 59 | 60 | hi def link goInt Number 61 | hi def link goFloat Number 62 | hi def link goImaginary Number 63 | 64 | " Token groups 65 | syn cluster gotplLiteral contains=goString,goRawString,goCharacter,@goInt,goFloat,goImaginary 66 | syn keyword gotplControl contained if else end range with template 67 | syn keyword gotplFunctions contained and html index js len not or print printf println urlquery eq ne lt le gt ge 68 | syn match gotplVariable contained /\$[a-zA-Z0-9_]*\>/ 69 | syn match goTplIdentifier contained /\.[^[:blank:]}]\+\>/ 70 | 71 | hi def link gotplControl Keyword 72 | hi def link gotplFunctions Function 73 | hi def link goTplVariable Special 74 | 75 | syn region gotplAction start="{{" end="}}" contains=@gotplLiteral,gotplControl,gotplFunctions,gotplVariable,goTplIdentifier display 76 | syn region goTplComment start="{{\(- \)\?/\*" end="\*/\( -\)\?}}" display 77 | 78 | hi def link gotplAction PreProc 79 | hi def link goTplComment Comment 80 | 81 | let b:current_syntax = "gotexttmpl" 82 | 83 | " vim: sw=2 ts=2 et 84 | -------------------------------------------------------------------------------- /syntax/javascript.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: JavaScript 3 | " Maintainer: Ruslan Ismagilov 4 | " Version: 2.0.3 5 | " Credits: Kao Wei-Ko(othree), Zhao Yi, Claudio Fleiner, Scott Shattuck 6 | " (This file is based on their hard work) 7 | 8 | if !exists("main_syntax") 9 | if version < 600 10 | syntax clear 11 | elseif exists("b:current_syntax") 12 | finish 13 | endif 14 | let main_syntax = 'javascript' 15 | endif 16 | 17 | " Drop fold if it set but vim doesn't support it. 18 | if version < 600 && exists("javaScript_fold") 19 | unlet javaScript_fold 20 | endif 21 | 22 | syntax sync fromstart 23 | 24 | "" syntax coloring shebang line 25 | syntax match shebang "^#!.*" 26 | hi link shebang Comment 27 | 28 | " Statement Keywords 29 | syntax keyword javaScriptSource import export 30 | syntax keyword javaScriptIdentifier arguments this let const var void yield 31 | syntax keyword javaScriptOperator delete new instanceof typeof 32 | syntax keyword javaScriptBoolean true false 33 | syntax keyword javaScriptNull null undefined 34 | syntax keyword javaScriptMessage alert confirm prompt 35 | syntax keyword javaScriptDeprecated escape unescape applets alinkColor bgColor fgColor linkColor vlinkColor xmlEncoding 36 | syntax keyword javaScriptConditional if else switch 37 | syntax keyword javaScriptRepeat do while for in 38 | syntax keyword javaScriptBranch break continue 39 | syntax keyword javaScriptLabel case default 40 | syntax keyword javaScriptPrototype prototype 41 | syntax keyword javaScriptStatement return with 42 | syntax keyword javaScriptGlobalObjects Array Boolean Date Function Math Number Object RegExp String 43 | syntax keyword javaScriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError 44 | syntax keyword javaScriptReserved abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws goto private transient debugger implements protected volatile double import public 45 | 46 | " Comments 47 | syntax keyword javaScriptCommentTodo TODO FIXME XXX TBD contained 48 | syntax match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo 49 | syntax match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)" 50 | syntax region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo 51 | 52 | " Strings, Numbers and Regex Highlight 53 | syntax match javaScriptSpecial "\\\d\d\d\|\\." 54 | syntax region javaScriptString start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc 55 | syntax region javaScriptString start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc 56 | syntax region javascriptTemplate start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/ contains=javascriptTemplateSubstitution nextgroup=@javascriptComments,@javascriptSymbols skipwhite skipempty 57 | syntax region javascriptTemplateSubstitution matchgroup=javascriptTemplateSB contained start=/\${/ end=/}/ contains=@javascriptExpression 58 | 59 | syntax match javaScriptSpecialCharacter "'\\.'" 60 | syntax match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>" 61 | syntax region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gim]\{0,2\}\s*$+ end=+/[gim]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline 62 | syntax match javaScriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/ 63 | syntax match javascriptDollar "\$" 64 | 65 | " No need? 66 | " syntax keyword javaScriptGlobal self top parent 67 | 68 | " Code blocks 69 | syntax cluster javaScriptAll contains=javaScriptComment,javaScriptLineComment,javaScriptDocComment,javaScriptString,javaScriptRegexpString,javascriptTemplate,javaScriptNumber,javaScriptFloat,javascriptDollar,javaScriptLabel,javaScriptSource,javaScriptWebAPI,javaScriptOperator,javaScriptBoolean,javaScriptNull,javaScriptFuncKeyword,javaScriptConditional,javaScriptRepeat,javaScriptBranch,javaScriptStatement,javaScriptGlobalObjects,javaScriptMessage,javaScriptIdentifier,javaScriptExceptions,javaScriptReserved,javaScriptDeprecated,javaScriptDomErrNo,javaScriptDomNodeConsts,javaScriptHtmlEvents,javaScriptDotNotation,javaScriptBrowserObjects,javaScriptDOMObjects,javaScriptAjaxObjects,javaScriptPropietaryObjects,javaScriptDOMMethods,javaScriptHtmlElemProperties,javaScriptDOMProperties,javaScriptEventListenerKeywords,javaScriptEventListenerMethods,javaScriptAjaxProperties,javaScriptAjaxMethods,javaScriptFuncArg 70 | 71 | if main_syntax == "javascript" 72 | syntax sync clear 73 | syntax sync ccomment javaScriptComment minlines=200 74 | " syntax sync match javaScriptHighlight grouphere javaScriptBlock /{/ 75 | endif 76 | 77 | " Function and arguments highlighting 78 | syntax keyword javaScriptFuncKeyword function contained 79 | syntax region javaScriptFuncExp start=/\w\+\s\==\s\=function\>/ end="\([^)]*\)" contains=javaScriptFuncEq,javaScriptFuncKeyword,javaScriptFuncArg keepend 80 | syntax match javaScriptFuncArg "\(([^()]*)\)" contains=javaScriptParens,javaScriptFuncComma contained 81 | syntax match javaScriptFuncComma /,/ contained 82 | syntax match javaScriptFuncEq /=/ contained 83 | syntax region javaScriptFuncDef start="\" end="\([^)]*\)" contains=javaScriptFuncKeyword,javaScriptFuncArg keepend 84 | 85 | " Braces, Parens, symbols, colons 86 | syntax match javaScriptBraces "[{}\[\]]" 87 | syntax match javaScriptParens "[()]" 88 | syntax match javaScriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-=" 89 | syntax match javaScriptEndColons "[;,]" 90 | syntax match javaScriptLogicSymbols "\(&&\)\|\(||\)" 91 | 92 | " include syntax modules 93 | runtime syntax/vim-es6/modules/*.vim 94 | 95 | " JavaScriptFold Function 96 | function! JavaScriptFold() 97 | setl foldmethod=syntax 98 | setl foldlevelstart=1 99 | syntax region foldBraces start=/{/ end=/}/ transparent fold keepend extend 100 | endfunction 101 | 102 | " Highlight links 103 | " Define the default highlighting. 104 | " For version 5.7 and earlier: only when not done already 105 | " For version 5.8 and later: only when an item doesn't have highlighting yet 106 | if version >= 508 || !exists("did_javascript_syn_inits") 107 | if version < 508 108 | let did_javascript_syn_inits = 1 109 | command -nargs=+ HiLink hi link 110 | else 111 | command -nargs=+ HiLink hi def link 112 | endif 113 | HiLink javaScriptEndColons Operator 114 | HiLink javaScriptOpSymbols Operator 115 | HiLink javaScriptLogicSymbols Boolean 116 | HiLink javaScriptBraces Function 117 | HiLink javaScriptParens Operator 118 | 119 | HiLink javaScriptComment Comment 120 | HiLink javaScriptLineComment Comment 121 | HiLink javaScriptDocComment Comment 122 | HiLink javaScriptCommentTodo Todo 123 | 124 | HiLink javaScriptDocTags Special 125 | HiLink javaScriptDocSeeTag Function 126 | HiLink javaScriptDocParam Function 127 | 128 | HiLink javaScriptString String 129 | HiLink javascriptTemplate String 130 | HiLink javascriptTemplateSubstitution Label 131 | HiLink javaScriptRegexpString String 132 | HiLink javascriptTemplateSB javascriptTemplateSubstitution 133 | 134 | HiLink javaScriptNumber Number 135 | HiLink javaScriptFloat Number 136 | 137 | HiLink javaScriptCharacter Character 138 | HiLink javaScriptPrototype Type 139 | HiLink javaScriptConditional Conditional 140 | HiLink javaScriptBranch Conditional 141 | HiLink javaScriptIdentifier Identifier 142 | HiLink javaScriptRepeat Repeat 143 | HiLink javaScriptStatement Statement 144 | HiLink javaScriptMessage Keyword 145 | HiLink javaScriptReserved Keyword 146 | HiLink javaScriptOperator Operator 147 | HiLink javaScriptNull Type 148 | HiLink javaScriptBoolean Boolean 149 | HiLink javaScriptLabel Label 150 | HiLink javaScriptSpecial Special 151 | HiLink javaScriptSource Special 152 | HiLink javaScriptGlobalObjects Special 153 | HiLink javaScriptExceptions Special 154 | HiLink javascriptDollar Special 155 | 156 | HiLink javaScriptDeprecated Exception 157 | HiLink javaScriptError Error 158 | HiLink javaScriptParensError Error 159 | HiLink javaScriptParensErrA Error 160 | HiLink javaScriptParensErrB Error 161 | HiLink javaScriptParensErrC Error 162 | HiLink javaScriptDomErrNo Error 163 | 164 | HiLink javaScriptDomNodeConsts Constant 165 | HiLink javaScriptDomElemAttrs Label 166 | HiLink javaScriptDomElemFuncs Type 167 | 168 | HiLink javaScriptWebAPI Type 169 | 170 | HiLink javaScriptHtmlElemAttrs Label 171 | HiLink javaScriptHtmlElemFuncs Type 172 | 173 | HiLink javaScriptCssStyles Type 174 | 175 | HiLink javaScriptBrowserObjects Constant 176 | 177 | HiLink javaScriptDOMObjects Constant 178 | HiLink javaScriptDOMMethods Type 179 | HiLink javaScriptDOMProperties Label 180 | 181 | HiLink javaScriptAjaxObjects Constant 182 | HiLink javaScriptAjaxMethods Type 183 | HiLink javaScriptAjaxProperties Label 184 | 185 | HiLink javaScriptFuncKeyword Function 186 | HiLink javaScriptFuncDef PreProc 187 | HiLink javaScriptFuncExp Title 188 | HiLink javaScriptFuncArg Special 189 | HiLink javaScriptFuncComma Operator 190 | HiLink javaScriptFuncEq Operator 191 | 192 | HiLink javaScriptHtmlEvents Constant 193 | HiLink javaScriptHtmlElemProperties Label 194 | 195 | HiLink javaScriptEventListenerKeywords Type 196 | 197 | HiLink javaScriptPropietaryObjects Constant 198 | 199 | delcommand HiLink 200 | endif 201 | 202 | " Define the htmlJavaScript for HTML syntax html.vim 203 | " syntax clear htmlJavaScript 204 | " syntax clear javaScriptExpression 205 | syntax cluster htmlJavaScript contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError 206 | syntax cluster javaScriptExpression contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError,@htmlPreproc 207 | 208 | let b:current_syntax = "javascript" 209 | if main_syntax == 'javascript' 210 | unlet main_syntax 211 | endif 212 | -------------------------------------------------------------------------------- /syntax/modules/es6-promise.vim: -------------------------------------------------------------------------------- 1 | syntax keyword javascriptGlobal Promise nextgroup=javascriptGlobalPromiseDot,javascriptFuncCallArg 2 | syntax match javascriptGlobalPromiseDot /\./ contained nextgroup=javascriptPromiseStaticMethod 3 | syntax keyword javascriptPromiseStaticMethod contained resolve reject all race nextgroup=javascriptFuncCallArg 4 | if exists("did_javascript_hilink") | HiLink javascriptPromiseStaticMethod Keyword 5 | endif 6 | syntax keyword javascriptPromiseMethod contained then catch nextgroup=javascriptFuncCallArg 7 | syntax cluster props add=javascriptPromiseMethod 8 | if exists("did_javascript_hilink") | HiLink javascriptPromiseMethod Keyword 9 | endif 10 | -------------------------------------------------------------------------------- /syntax/modules/es6-proxy.vim: -------------------------------------------------------------------------------- 1 | syntax keyword javascriptGlobal Proxy 2 | syntax keyword javascriptProxyAPI contained getOwnPropertyDescriptor getOwnPropertyNames 3 | syntax keyword javascriptProxyAPI contained defineProperty deleteProperty freeze seal 4 | syntax keyword javascriptProxyAPI contained preventExtensions has hasOwn get set enumerate 5 | syntax keyword javascriptProxyAPI contained iterate ownKeys apply construct 6 | if exists("did_javascript_hilink") | HiLink javascriptProxyAPI Keyword 7 | endif 8 | -------------------------------------------------------------------------------- /syntax/modules/es6-regexp.vim: -------------------------------------------------------------------------------- 1 | syntax keyword javascriptGlobal RegExp nextgroup=javascriptGlobalRegExpDot,javascriptFuncCallArg 2 | syntax match javascriptGlobalRegExpDot /\./ contained nextgroup=javascriptRegExpStaticProp 3 | syntax keyword javascriptRegExpStaticProp contained lastIndex 4 | if exists("did_javascript_hilink") | HiLink javascriptRegExpStaticProp Keyword 5 | endif 6 | syntax keyword javascriptRegExpProp contained global ignoreCase multiline source sticky 7 | syntax cluster props add=javascriptRegExpProp 8 | if exists("did_javascript_hilink") | HiLink javascriptRegExpProp Keyword 9 | endif 10 | syntax keyword javascriptRegExpMethod contained exec test nextgroup=javascriptFuncCallArg 11 | syntax cluster props add=javascriptRegExpMethod 12 | if exists("did_javascript_hilink") | HiLink javascriptRegExpMethod Keyword 13 | endif 14 | -------------------------------------------------------------------------------- /syntax/modules/es6-set.vim: -------------------------------------------------------------------------------- 1 | syntax keyword javascriptGlobal Set WeakSet 2 | syntax keyword javascriptES6SetProp contained size 3 | syntax cluster props add=javascriptES6SetProp 4 | if exists("did_javascript_hilink") | HiLink javascriptES6SetProp Keyword 5 | endif 6 | syntax keyword javascriptES6SetMethod contained add clear delete entries forEach has nextgroup=javascriptFuncCallArg 7 | syntax keyword javascriptES6SetMethod contained values nextgroup=javascriptFuncCallArg 8 | syntax cluster props add=javascriptES6SetMethod 9 | if exists("did_javascript_hilink") | HiLink javascriptES6SetMethod Keyword 10 | endif 11 | -------------------------------------------------------------------------------- /syntax/modules/es6-string.vim: -------------------------------------------------------------------------------- 1 | syntax keyword javascriptGlobal String nextgroup=javascriptGlobalStringDot,javascriptFuncCallArg 2 | syntax match javascriptGlobalStringDot /\./ contained nextgroup=javascriptStringStaticMethod 3 | syntax keyword javascriptStringStaticMethod contained fromCharCode fromCodePoint nextgroup=javascriptFuncCallArg 4 | if exists("did_javascript_hilink") | HiLink javascriptStringStaticMethod Keyword 5 | endif 6 | syntax keyword javascriptStringMethod contained anchor charAt charCodeAt codePointAt nextgroup=javascriptFuncCallArg 7 | syntax keyword javascriptStringMethod contained concat endsWith includes indexOf lastIndexOf nextgroup=javascriptFuncCallArg 8 | syntax keyword javascriptStringMethod contained link localeCompare match normalize nextgroup=javascriptFuncCallArg 9 | syntax keyword javascriptStringMethod contained repeat replace search slice split nextgroup=javascriptFuncCallArg 10 | syntax keyword javascriptStringMethod contained startsWith substr substring toLocaleLowerCase nextgroup=javascriptFuncCallArg 11 | syntax keyword javascriptStringMethod contained toLocaleUpperCase toLowerCase toString nextgroup=javascriptFuncCallArg 12 | syntax keyword javascriptStringMethod contained toUpperCase trim valueOf nextgroup=javascriptFuncCallArg 13 | syntax cluster props add=javascriptStringMethod 14 | if exists("did_javascript_hilink") | HiLink javascriptStringMethod Keyword 15 | endif 16 | -------------------------------------------------------------------------------- /syntax/modules/es6-symbol.vim: -------------------------------------------------------------------------------- 1 | syntax keyword javascriptGlobal Symbol nextgroup=javascriptGlobalSymbolDot,javascriptFuncCallArg 2 | syntax match javascriptGlobalSymbolDot /\./ contained nextgroup=javascriptSymbolStaticProp,javascriptSymbolStaticMethod 3 | syntax keyword javascriptSymbolStaticProp contained create hasInstance isConcatSpreadable 4 | syntax keyword javascriptSymbolStaticProp contained isRegExp iterator toPrimitive 5 | syntax keyword javascriptSymbolStaticProp contained toStringTag unscopables 6 | if exists("did_javascript_hilink") | HiLink javascriptSymbolStaticProp Keyword 7 | endif 8 | syntax keyword javascriptSymbolStaticMethod contained for keyFor nextgroup=javascriptFuncCallArg 9 | if exists("did_javascript_hilink") | HiLink javascriptSymbolStaticMethod Keyword 10 | endif 11 | -------------------------------------------------------------------------------- /syntax/modules/js-browser.vim: -------------------------------------------------------------------------------- 1 | " DOM, Browser and Ajax Support 2 | syntax keyword javaScriptBrowserObjects window navigator screen history location 3 | syntax keyword javaScriptDOMObjects document event HTMLElement Anchor Area Base Body Button Form Frame Frameset Image Link Meta Option Select Style Table TableCell TableRow Textarea 4 | syntax keyword javaScriptDOMMethods createTextNode createElement insertBefore replaceChild removeChild appendChild hasChildNodes cloneNode normalize isSupported hasAttributes getAttribute setAttribute removeAttribute getAttributeNode setAttributeNode removeAttributeNode getElementsByTagName hasAttribute getElementById adoptNode close compareDocumentPosition createAttribute createCDATASection createComment createDocumentFragment createElementNS createEvent createExpression createNSResolver createProcessingInstruction createRange createTreeWalker elementFromPoint evaluate getBoxObjectFor getElementsByClassName getSelection getUserData hasFocus importNode 5 | syntax keyword javaScriptDOMProperties nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument namespaceURI prefix localName tagName 6 | syntax keyword javaScriptAjaxObjects XMLHttpRequest 7 | syntax keyword javaScriptAjaxProperties readyState responseText responseXML statusText 8 | syntax keyword javaScriptAjaxMethods onreadystatechange abort getAllResponseHeaders getResponseHeader open send setRequestHeader 9 | syntax keyword javaScriptPropietaryObjects ActiveXObject 10 | syntax keyword javaScriptPropietaryMethods attachEvent detachEvent cancelBubble returnValue 11 | syntax keyword javaScriptHtmlElemProperties className clientHeight clientLeft clientTop clientWidth dir href id innerHTML lang length offsetHeight offsetLeft offsetParent offsetTop offsetWidth scrollHeight scrollLeft scrollTop scrollWidth style tabIndex target title 12 | syntax keyword javaScriptEventListenerKeywords blur click focus mouseover mouseout load item 13 | syntax keyword javaScriptEventListenerMethods scrollIntoView addEventListener dispatchEvent removeEventListener preventDefault stopPropagation 14 | 15 | " DOM/HTML5/CSS specified things 16 | syntax keyword javaScriptWebAPI AbstractWorker AnalyserNode AnimationEvent App Apps ArrayBuffer ArrayBufferView Attr AudioBuffer AudioBufferSourceNode AudioContext AudioDestinationNode AudioListener AudioNode AudioParam AudioProcessingEvent BatteryManager BiquadFilterNode Blob BlobBuilder BlobEvent CallEvent CameraCapabilities CameraControl CameraManager CanvasGradient CanvasImageSource CanvasPattern CanvasPixelArray CanvasRenderingContext2D CaretPosition CDATASection ChannelMergerNode ChannelSplitterNode CharacterData ChildNode ChromeWorker ClipboardEvent CloseEvent Comment CompositionEvent Connection Console ContactManager ConvolverNode Coordinates CSS CSSConditionRule CSSGroupingRule CSSKeyframeRule CSSKeyframesRule CSSMediaRule CSSNamespaceRule CSSPageRule CSSRule CSSRuleList CSSStyleDeclaration CSSStyleRule CSSStyleSheet CSSSupportsRule CustomEvent 17 | syntax keyword javaScriptWebAPI DataTransfer DataView DedicatedWorkerGlobalScope DelayNode DeviceAcceleration DeviceLightEvent DeviceMotionEvent DeviceOrientationEvent DeviceProximityEvent DeviceRotationRate DeviceStorage DeviceStorageChangeEvent DirectoryEntry DirectoryEntrySync DirectoryReader DirectoryReaderSync Document DocumentFragment DocumentTouch DocumentType DOMConfiguration DOMCursor DOMError DOMErrorHandler DOMException DOMHighResTimeStamp DOMImplementation DOMImplementationList DOMImplementationSource DOMLocator DOMObject DOMParser DOMRequest DOMString DOMStringList DOMStringMap DOMTimeStamp DOMTokenList DOMUserData DynamicsCompressorNode 18 | syntax keyword javaScriptWebAPI Element ElementTraversal Entity EntityReference Entry EntrySync ErrorEvent Event EventListener EventSource EventTarget Extensions File FileEntry FileEntrySync FileError FileException FileList FileReader FileSystem FileSystemSync Float32Array Float64Array FMRadio FocusEvent FormData GainNode Geolocation History 19 | syntax keyword javaScriptWebAPI HTMLAnchorElement HTMLAreaElement HTMLAudioElement HTMLBaseElement HTMLBaseFontElement HTMLBodyElement HTMLBRElement HTMLButtonElement HTMLCanvasElement HTMLCollection HTMLDataElement HTMLDataListElement HTMLDivElement HTMLDListElement HTMLDocument HTMLElement HTMLEmbedElement HTMLFieldSetElement HTMLFormControlsCollection HTMLFormElement HTMLHeadElement HTMLHeadingElement HTMLHRElement HTMLHtmlElement HTMLIFrameElement HTMLImageElement HTMLInputElement HTMLIsIndexElement HTMLKeygenElement HTMLLabelElement HTMLLegendElement HTMLLIElement HTMLLinkElement HTMLMapElement HTMLMediaElement HTMLMetaElement HTMLMeterElement HTMLModElement HTMLObjectElement HTMLOListElement HTMLOptGroupElement HTMLOptionElement HTMLOptionsCollection HTMLOutputElement HTMLParagraphElement HTMLParamElement HTMLPreElement HTMLProgressElement HTMLQuoteElement HTMLScriptElement HTMLSelectElement HTMLSourceElement HTMLSpanElement HTMLStyleElement HTMLTableCaptionElement HTMLTableCellElement HTMLTableColElement HTMLTableElement HTMLTableRowElement HTMLTableSectionElement HTMLTextAreaElement HTMLTimeElement HTMLTitleElement HTMLTrackElement HTMLUListElement HTMLUnknownElement HTMLVideoElement 20 | syntax keyword javaScriptWebAPI IDBCursor IDBCursorWithValue IDBDatabase IDBDatabaseException IDBEnvironment IDBFactory IDBIndex IDBKeyRange IDBObjectStore IDBOpenDBRequest IDBRequest IDBTransaction IDBVersionChangeEvent ImageData Int16Array Int32Array Int8Array KeyboardEvent LinkStyle LocalFileSystem LocalFileSystemSync Location MediaQueryList MediaQueryListListener MediaSource MediaStream MediaStreamTrack MessageEvent MouseEvent MouseScrollEvent MouseWheelEvent MozActivity MozActivityOptions MozActivityRequestHandler MozAlarmsManager MozContact MozContactChangeEvent MozIccManager MozMmsEvent MozMmsMessage MozMobileCellInfo MozMobileCFInfo MozMobileConnection MozMobileConnectionInfo MozMobileICCInfo MozMobileMessageManager MozMobileMessageThread MozMobileNetworkInfo MozNetworkStats MozNetworkStatsData MozNetworkStatsManager MozSettingsEvent MozSmsEvent MozSmsFilter MozSmsManager MozSmsMessage MozSmsSegmentInfo MozTimeManager MozWifiConnectionInfoEvent MutationObserver 21 | syntax keyword javaScriptWebAPI NamedNodeMap NameList Navigator NavigatorGeolocation NavigatorID NavigatorLanguage NavigatorOnLine NavigatorPlugins NetworkInformation Node NodeFilter NodeIterator NodeList Notation Notification NotifyAudioAvailableEvent OfflineAudioCompletionEvent OfflineAudioContext PannerNode ParentNode Performance PerformanceNavigation PerformanceTiming Plugin PluginArray Position PositionError PositionOptions PowerManager ProcessingInstruction ProgressEvent Promise PromiseResolver PushManager 22 | syntax keyword javaScriptWebAPI Range ScriptProcessorNode Selection SettingsLock SettingsManager SharedWorker StyleSheet StyleSheetList SVGAElement SVGAngle SVGAnimateColorElement SVGAnimatedAngle SVGAnimatedBoolean SVGAnimatedEnumeration SVGAnimatedInteger SVGAnimatedLengthList SVGAnimatedNumber SVGAnimatedNumberList SVGAnimatedPoints SVGAnimatedPreserveAspectRatio SVGAnimatedRect SVGAnimatedString SVGAnimatedTransformList SVGAnimateElement SVGAnimateMotionElement SVGAnimateTransformElement SVGAnimationElement SVGCircleElement SVGClipPathElement SVGCursorElement SVGDefsElement SVGDescElement SVGElement SVGEllipseElement SVGFilterElement SVGFontElement SVGFontFaceElement SVGFontFaceFormatElement SVGFontFaceNameElement SVGFontFaceSrcElement SVGFontFaceUriElement 23 | syntax keyword javaScriptWebAPI SVGForeignObjectElement SVGGElement SVGGlyphElement SVGGradientElement SVGHKernElement SVGImageElement SVGLength SVGLengthList SVGLinearGradientElement SVGLineElement SVGMaskElement SVGMatrix SVGMissingGlyphElement SVGMPathElement SVGNumber SVGNumberList SVGPathElement SVGPatternElement SVGPolygonElement SVGPolylineElement SVGPreserveAspectRatio SVGRadialGradientElement SVGRect SVGRectElement SVGScriptElement SVGSetElement SVGStopElement SVGStringList SVGStylable SVGStyleElement SVGSVGElement SVGSwitchElement SVGSymbolElement SVGTests SVGTextElement SVGTextPositioningElement SVGTitleElement SVGTransform SVGTransformable SVGTransformList SVGTRefElement SVGTSpanElement SVGUseElement SVGViewElement SVGVKernElement TCPSocket Telephony TelephonyCall Text TextDecoder TextEncoder TextMetrics TimeRanges Touch TouchEvent TouchList Transferable TransitionEvent TreeWalker TypeInfo UIEvent Uint16Array Uint32Array Uint8Array Uint8ClampedArray URL URLUtils URLUtilsReadOnly 24 | 25 | " DOM2 CONSTANT 26 | syntax keyword javaScriptDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR 27 | syntax keyword javaScriptDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE 28 | 29 | " HTML events and internal variables" 30 | syntax case ignore 31 | syntax keyword javaScriptHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize onload onsubmit 32 | syntax case match 33 | 34 | if exists("javascript_enable_domhtmlcss") 35 | 36 | " DOM2 things 37 | syntax match javaScriptDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/ 38 | syntax match javaScriptDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementsByTagName\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=javaScriptParen skipwhite 39 | 40 | " HTML things 41 | syntax match javaScriptHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/ 42 | syntax match javaScriptHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=javaScriptParen skipwhite 43 | 44 | " CSS Styles in JavaScript 45 | syntax keyword javaScriptCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition 46 | syntax keyword javaScriptCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition 47 | syntax keyword javaScriptCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode 48 | syntax keyword javaScriptCssStyles contained bottom height left position right top width zIndex 49 | syntax keyword javaScriptCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout 50 | syntax keyword javaScriptCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop 51 | syntax keyword javaScriptCssStyles contained listStyle listStyleImage listStylePosition listStyleType 52 | syntax keyword javaScriptCssStyles contained background backgroundAttachment backgroundColor backgroundImage gackgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat 53 | syntax keyword javaScriptCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType 54 | syntax keyword javaScriptCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText 55 | syntax keyword javaScriptCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor 56 | 57 | " Highlight ways 58 | syntax match javaScriptDotNotation "\." nextgroup=javaScriptPrototype,javaScriptDomElemAttrs,javaScriptDomElemFuncs,javaScriptHtmlElemAttrs,javaScriptHtmlElemFuncs 59 | syntax match javaScriptDotNotation "\.style\." nextgroup=javaScriptCssStyles 60 | 61 | endif 62 | -------------------------------------------------------------------------------- /syntax/modules/js-doc.vim: -------------------------------------------------------------------------------- 1 | " JSDoc support 2 | if !exists("javascript_ignore_javaScriptdoc") 3 | syntax case ignore 4 | 5 | syntax region javaScriptDocComment matchgroup=javaScriptComment start="/\*\*\s*$" end="\*/" contains=javaScriptDocTags,javaScriptCommentTodo,@javaScriptHtml,jsInJsdocExample,@Spell fold 6 | syntax match javaScriptDocTags contained "@\(param\|argument\|returns\=\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|name\|memberof\|exports\|callback\|typedef\|property\|optional\|default\|base\|file\|mixes\|mixin\|alias\|const\|enum\|fires\|event\|readonly\|tutorial\)\>" nextgroup=javaScriptDocParam,javaScriptDocSeeTag skipwhite 7 | syntax match javaScriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>" 8 | syntax match javaScriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+" 9 | syntax region javaScriptDocSeeTag contained matchgroup=javaScriptDocSeeTag start="{" end="}" contains=javaScriptDocTags 10 | 11 | syntax case match 12 | endif 13 | -------------------------------------------------------------------------------- /syntax/pekwm.vim: -------------------------------------------------------------------------------- 1 | " Quit when a (custom) syntax file was already loaded 2 | if exists("b:current_syntax") 3 | finish 4 | endif 5 | 6 | " FIXME: This file is far from complete. 7 | 8 | " Strings 9 | syn region pekString start=+'+ end=+'+ contains=pekEscape 10 | syn region pekString start=+"+ end=+"+ contains=pekEscape 11 | 12 | " String Escapes 13 | syn match pekEscape +\\[abfnrtv'"\\]+ contained 14 | 15 | " Single line comments. 16 | syn match pekComment +#.*$+ contains=pekTodo,@Spell 17 | syn match pekComment +//.*$+ contains=pekTodo,@Spell 18 | 19 | " Multi-line comments 20 | syn region pekComment start=+/\*+ end=+\*/+ contains=pekTodo,@Spell 21 | 22 | syn keyword pekTodo FIXME NOTE NOTES TODO XXX contained 23 | 24 | " Rules for all 25 | syn keyword pekRule INCLUDE 26 | 27 | " Key groups 28 | syn keyword pekGroup Global MoveResize InputDialog Menu 29 | 30 | " autoproperties groups 31 | syn keyword pekGroup Require Property 32 | " autoproperties rules 33 | syn keyword pekRule Sticky Shaded MaximizedVertical MaximizedHorizontal Iconified Border Titlebar FrameGeometry 34 | syn keyword pekRule ClientGeometry Layer Workspace Skip Fullscreen PlaceNew FocusNew Focusable CfgDeny 35 | syn keyword pekRule ApplyOn Title Role Group Templates 36 | 37 | " menu rules 38 | syn keyword pekRule Submenu Entry Actions Icon Separator 39 | 40 | hi def link pekString String 41 | hi def link pekComment Comment 42 | hi def link pekTodo Todo 43 | hi def link pekGroup Function 44 | hi def link pekRule Keyword 45 | 46 | let b:current_syntax = "pekwm" 47 | 48 | " vim: ts=8 49 | -------------------------------------------------------------------------------- /syntax/po.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: po (gettext) 3 | " Maintainer: Dwayne Bailey 4 | " Last Change: 2015 Jun 07 5 | " Contributors: Dwayne Bailey (Most advanced syntax highlighting) 6 | " Leonardo Fontenelle (Spell checking) 7 | " Nam SungHyun (Original maintainer) 8 | 9 | " quit when a syntax file was already loaded 10 | if exists('b:current_syntax') 11 | finish 12 | endif 13 | 14 | let s:keepcpo=&cpoptions 15 | set cpoptions&vim 16 | 17 | syn sync minlines=10 18 | 19 | " Identifiers 20 | syn match poStatementMsgCTxt "^msgctxt" 21 | syn match poStatementMsgidplural "^msgid_plural" contained 22 | syn match poPluralCaseN "[0-9]" contained 23 | syn match poStatementMsgstr "^msgstr\(\[[0-9]\]\)" contains=poPluralCaseN 24 | 25 | " Simple HTML and XML highlighting 26 | syn match poHtml "<\_[^<>]\+>" contains=poHtmlTranslatables,poLineBreak 27 | syn match poHtmlNot +"<[^<]\+>"+ms=s+1,me=e-1 28 | syn region poHtmlTranslatables start=+\(abbr\|alt\|content\|summary\|standby\|title\)=\\"+ms=e-1 end=+\\"+ contained contains=@Spell 29 | syn match poLineBreak +"\n"+ contained 30 | 31 | " Translation blocks 32 | syn region poMsgCTxt matchgroup=poStatementMsgCTxt start=+^msgctxt "+rs=e-1 matchgroup=poStringCTxt end=+^msgid "+me=s-1 contains=poStringCTxt 33 | syn region poMsgID matchgroup=poStatementMsgid start=+^msgid "+rs=e-1 matchgroup=poStringID end=+^msgstr\(\|\[[\]0\[]\]\) "+me=s-1 contains=poStringID,poStatementMsgidplural,poStatementMsgid 34 | syn region poMsgSTR matchgroup=poStatementMsgstr start=+^msgstr\(\|\[[\]0\[]\]\) "+rs=e-1 matchgroup=poStringSTR end=+\n\n+me=s-1 contains=poStringSTR,poStatementMsgstr 35 | syn region poStringCTxt start=+"+ skip=+\\\\\|\\"+ end=+"+ 36 | \ contains=@Spell 37 | syn region poStringID start=+"+ skip=+\\\\\|\\"+ end=+"+ contained 38 | \ contains=@Spell,poSpecial,poFormat,poCommentKDE,poPluralKDE,poKDEdesktopFile,poHtml,poAcceleratorId,poHtmlNot,poVariable 39 | syn region poStringSTR start=+"+ skip=+\\\\\|\\"+ end=+"+ contained 40 | \ contains=@Spell,poSpecial,poFormat,poHeaderItem,poCommentKDEError,poHeaderUndefined,poPluralKDEError,poMsguniqError,poKDEdesktopFile,poHtml,poAcceleratorStr,poHtmlNot,poVariable 41 | 42 | " Header and Copyright 43 | syn match poHeaderItem "\(Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|Language\|MIME-Version\|Content-Type\|Content-Transfer-Encoding\|Plural-Forms\|X-Generator\): " contained 44 | syn match poHeaderUndefined "\(PACKAGE VERSION\|YEAR-MO-DA HO:MI+ZONE\|FULL NAME \|LANGUAGE \|CHARSET\|ENCODING\|INTEGER\|EXPRESSION\)" contained 45 | syn match poCopyrightUnset "SOME DESCRIPTIVE TITLE\|FIRST AUTHOR , YEAR\|Copyright (C) YEAR Free Software Foundation, Inc\|YEAR THE PACKAGE\'S COPYRIGHT HOLDER\|PACKAGE" contained 46 | 47 | " Translation comment block including: translator comment, automatic coments, flags and locations 48 | syn keyword poCommentTodo NOTE TODO FIXME XXX TBD contained 49 | syn match poComment "^#.*$" contains=@Spell,poCommentTodo 50 | syn keyword poFlagFuzzy fuzzy contained 51 | syn match poCommentTranslator "^# .*$" contains=poCopyrightUnset,poCommentTodo,@Spell 52 | syn match poCommentAutomatic "^#\..*$" 53 | syn match poCommentSources "^#:.*$" 54 | syn match poCommentFlags "^#,.*$" contains=poFlagFuzzy 55 | syn match poDiffOld '\(^#| "[^{]*+}\|{+[^}]*+}\|{+[^}]*\|"$\)' contained 56 | syn match poDiffNew '\(^#| "[^{]*-}\|{-[^}]*-}\|{-[^}]*\|"$\)' contained 57 | syn match poCommentDiff "^#|.*$" contains=poDiffOld,poDiffNew 58 | 59 | " Translations (also includes header fields as they appear in a translation msgstr) 60 | syn region poCommentKDE start=+"_: +ms=s+1 end="\\n" end="\"\n^msgstr"me=s-1 contained 61 | syn region poCommentKDEError start=+"\(\|\s\+\)_:+ms=s+1 end="\\n" end=+"\n\n+me=s-1 contained 62 | syn match poPluralKDE +"_n: +ms=s+1 contained 63 | syn region poPluralKDEError start=+"\(\|\s\+\)_n:+ms=s+1 end="\"\n\n"me=s-1 contained 64 | syn match poSpecial contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" 65 | syn match poFormat "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained 66 | syn match poFormat "%%" contained 67 | 68 | " msguniq and msgcat conflicts 69 | syn region poMsguniqError matchgroup=poMsguniqErrorMarkers start="#-#-#-#-#" end='#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)\\n' contained 70 | 71 | " Obsolete messages 72 | syn match poObsolete "^#\~.*$" 73 | 74 | " KDE Name= handling 75 | syn match poKDEdesktopFile "\"\(Name\|Comment\|GenericName\|Description\|Keywords\|About\)="ms=s+1,me=e-1 76 | 77 | " Accelerator keys - this messes up if the preceding or following char is a multibyte unicode char 78 | syn match poAcceleratorId contained "[^&_~][&_~]\(\a\|\d\)[^:]"ms=s+1,me=e-1 79 | syn match poAcceleratorStr contained "[^&_~][&_~]\(\a\|\d\)[^:]"ms=s+1,me=e-1 contains=@Spell 80 | 81 | " Variables simple 82 | syn match poVariable contained "%\d" 83 | 84 | " Define the default highlighting. 85 | " Only when an item doesn't have highlighting yet 86 | 87 | hi def link poCommentSources PreProc 88 | hi def link poComment Comment 89 | hi def link poCommentTodo Todo 90 | hi def link poCommentAutomatic Comment 91 | hi def link poCommentTranslator Comment 92 | hi def link poCommentFlags Special 93 | hi def link poCommentDiff Comment 94 | hi def link poCopyrightUnset Todo 95 | hi def link poFlagFuzzy Todo 96 | hi def link poDiffOld Todo 97 | hi def link poDiffNew Special 98 | hi def link poObsolete Comment 99 | 100 | hi def link poStatementMsgid Statement 101 | hi def link poStatementMsgstr Statement 102 | hi def link poStatementMsgidplural Statement 103 | hi def link poStatementMsgCTxt Statement 104 | hi def link poPluralCaseN Constant 105 | 106 | hi def link poStringCTxt Comment 107 | hi def link poStringID String 108 | hi def link poStringSTR String 109 | hi def link poCommentKDE Comment 110 | hi def link poCommentKDEError Error 111 | hi def link poPluralKDE Comment 112 | hi def link poPluralKDEError Error 113 | hi def link poHeaderItem Identifier 114 | hi def link poHeaderUndefined Todo 115 | hi def link poKDEdesktopFile Identifier 116 | 117 | hi def link poHtml Identifier 118 | hi def link poHtmlNot String 119 | hi def link poHtmlTranslatables String 120 | hi def link poLineBreak String 121 | 122 | hi def link poFormat poSpecial 123 | hi def link poSpecial Special 124 | hi def link poAcceleratorId Special 125 | hi def link poAcceleratorStr Special 126 | hi def link poVariable Special 127 | 128 | hi def link poMsguniqError Special 129 | hi def link poMsguniqErrorMarkers Comment 130 | 131 | let b:current_syntax = 'po' 132 | 133 | let &cpoptions = s:keepcpo 134 | unlet s:keepcpo 135 | 136 | " vim:set ts=8 sts=2 sw=2 noet: 137 | -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | " vint: -ProhibitSetNoCompatible 2 | 3 | " Set a variable to prevent some parts of vimrc from being run again 4 | " when reloading it. 5 | let g:vimrc_loaded = get(g:, 'vimrc_loaded', 0) 6 | 7 | set encoding=utf-8 8 | scriptencoding utf-8 9 | 10 | " Make the VIM happen. 11 | set nocompatible 12 | 13 | if has('win32') 14 | let $VIMHOME = expand('~\vimfiles') 15 | else 16 | let $VIMHOME = expand('~/.vim') 17 | endif 18 | 19 | " We must replace the runtimepath to make everything work. 20 | if !g:vimrc_loaded 21 | set runtimepath=$VIMHOME,$VIM/vimfiles/,$VIMRUNTIME,$VIM/vimfiles/after 22 | endif 23 | 24 | " Set our after directory after everything. 25 | if !g:vimrc_loaded 26 | let &runtimepath.=',' . $VIMHOME . '/after' 27 | endif 28 | 29 | filetype plugin on 30 | 31 | " Prefer unix format for files. 32 | set fileformats=unix,dos 33 | 34 | if has('unix') 35 | if !has('gui_running') 36 | " Reset the terminal to work around stupid bullshit 37 | set term=linux 38 | set t_Co=256 39 | endif 40 | else 41 | " Windows fun times! 42 | 43 | " set the 'cpoptions' to its Vim default 44 | if 1 " only do this when compiled with expression evaluation 45 | let s:save_cpo = &cpoptions 46 | endif 47 | set cpoptions&vim 48 | 49 | " set 'selection', 'selectmode', 'mousemodel' and 'keymodel' for MS-Windows 50 | behave mswin 51 | 52 | " backspace and cursor keys wrap to previous/next line 53 | set backspace=indent,eol,start whichwrap+=<,>,[,] 54 | endif 55 | 56 | set nospell 57 | 58 | if has('gui_running') 59 | " gvim specific settings. 60 | 61 | let s:colorscheme = '' 62 | redir => s:colorscheme 63 | silent colorscheme 64 | redir end 65 | 66 | if s:colorscheme !~# 'darkspectrum' 67 | " Set colour scheme 68 | colorscheme darkspectrum 69 | endif 70 | 71 | if has('osx') || has('win32') 72 | " Windows - http://levien.com/type/myfonts/inconsolata.html 73 | set guifont=Inconsolata:h16:cANSI:qDRAFT 74 | else 75 | set guifont=Inconsolata\ 16 76 | endif 77 | 78 | " Set guioptions 79 | " No 'm' removes the menu bar 80 | " No 'T' removes the toolbar 81 | " 'c' uses console dialogs instead of windows. 82 | " 'a' uses autoselect 83 | set guioptions=egirLtca 84 | 85 | if v:version > 703 86 | " This makes copy and paste also work better. 87 | set clipboard=unnamedplus 88 | endif 89 | 90 | " Always show the tab bar. 91 | set showtabline=2 92 | 93 | function! GetTabLabel() abort 94 | " TODO Detect if a NerdTree window is open split with a file, and show 95 | " the name of the file in the tab instead. 96 | let l:full_name = expand('%:p') 97 | 98 | if empty(l:full_name) 99 | return '' 100 | endif 101 | 102 | let l:buffer = bufnr('') 103 | " Get the buffer names for all windows. 104 | let l:name_list = map( 105 | \ filter(getwininfo(), 'v:val.bufnr isnot l:buffer'), 106 | \ 'expand(''#'' . v:val.bufnr . '':p'')', 107 | \) 108 | let l:depth = 1 109 | 110 | while 1 111 | let l:dir = fnamemodify(l:full_name, repeat(':h', l:depth)) 112 | let l:depth += 1 113 | let l:filename = l:full_name[len(l:dir) + 1:] 114 | let l:lower_filename = tolower(l:filename) 115 | 116 | if len(l:dir) <= 1 117 | break 118 | endif 119 | 120 | let l:match_found = 0 121 | 122 | for l:other_name in l:name_list 123 | if tolower(l:other_name)[-len(l:lower_filename):] is? l:lower_filename 124 | let l:match_found = 1 125 | break 126 | endif 127 | endfor 128 | 129 | if !l:match_found 130 | break 131 | endif 132 | endwhile 133 | 134 | return l:filename 135 | endfunction 136 | 137 | " Make only filenames appear in gvim tabs. 138 | set guitablabel=%{GetTabLabel()} 139 | 140 | " Set maximum number of tabs to 20. 141 | set tabpagemax=20 142 | 143 | " Use right click for showing a popup menu. 144 | set mousemodel=popup_setpos 145 | 146 | " Remove some menu items we don't want. 147 | silent! aunmenu PopUp.Select\ Word 148 | silent! aunmenu PopUp.Select\ Sentence 149 | silent! aunmenu PopUp.Select\ Paragraph 150 | silent! aunmenu PopUp.Select\ Line 151 | silent! aunmenu PopUp.Select\ Block 152 | silent! aunmenu PopUp.Select\ Blockwise 153 | silent! aunmenu PopUp.Select\ All 154 | else 155 | " When the GUI is not running... 156 | 157 | " Use simple highlighting. 158 | set background=dark 159 | endif 160 | 161 | " Enable syntax highlighting by default. 162 | if has('syntax') 163 | if !g:vimrc_loaded 164 | syntax on 165 | endif 166 | 167 | " Reduce processing for syntax highlighting to make it less of a pain. 168 | syntax sync minlines=2000 169 | syntax sync maxlines=5000 170 | set synmaxcol=400 171 | set redrawtime=4000 172 | endif 173 | 174 | " Enable the status line at all times 175 | set laststatus=2 176 | 177 | " Enable 50 lines of command history 178 | set history=50 179 | 180 | " Enable the ruler 181 | set ruler 182 | 183 | " Set backspaces 184 | set backspace=indent,eol,start 185 | 186 | " Avoids updating the screen before commands are completed 187 | " set lazyredraw 188 | 189 | set scrolloff=999 190 | 191 | " Default to spaces instead of tabs 192 | set expandtab 193 | 194 | " Set tab width to 4. 195 | set tabstop=4 196 | set shiftwidth=4 197 | " Setting this will make backspace delete space indents 198 | set softtabstop=4 199 | 200 | " Autoindent 201 | set autoindent 202 | 203 | " Make the relative path automatic. 204 | set autochdir 205 | 206 | " Put all special files in the right place 207 | set backupdir=$VIMHOME/.backup// 208 | set directory=$VIMHOME/.swp// 209 | 210 | " Draw tabs and trailing spaces. 211 | set listchars=tab:>~ 212 | set list 213 | 214 | " Suffixes that get lower priority when doing tab completion for filenames. 215 | " These are files we are not likely to want to edit or read 216 | set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc 217 | 218 | " Automatically set the title to the full path. 219 | set titlestring=%(\ %{expand(\"%:p\")}\ %a%) 220 | 221 | " Use Blowfish for encryption, because it's awesome. 222 | set cryptmethod=blowfish 223 | 224 | " Enable persistent undo 225 | set undodir=$VIMHOME/.undo// 226 | set undofile 227 | set undolevels=1000 "maximum number of changes that can be undone 228 | set undoreload=10000 "maximum number lines to save for undo on a buffer reload 229 | 230 | " Automatically re-open files after they have changed without prompting. 231 | " This can be a little more destructive, but a lot less annoying. 232 | set autoread 233 | 234 | " Set the right margin. 235 | set colorcolumn=81 236 | " Let long lines run on past the margin. 237 | set nowrap 238 | 239 | " Disable automatic wrapping. 240 | set textwidth=0 241 | 242 | " Make some capitalised commands work the same as their normal forms. 243 | command! W w 244 | command! Q q 245 | command! -bang Qall qall 246 | 247 | " Make completion smarter. 248 | set ignorecase 249 | set smartcase 250 | set completeopt=menu,preview,noselect 251 | 252 | " viminfo settings 253 | " '100 : Remember marks for 100 previously edited files. 254 | " <50 : ??? 255 | " s10 : ??? 256 | " h : ??? 257 | " "100 : Save 100 lines for each register 258 | " :50 : Remember 50 lines of command history 259 | set viminfo='100,<50,s10,h,\"100,:50 260 | 261 | fun! OpenHpp() 262 | if expand('%:e') ==# 'cpp' 263 | " Open hpp files in a split view when opening cpp files. 264 | new +res\ 12 %:r.hpp 265 | endif 266 | endf 267 | 268 | " Disable folding because it's annoying. 269 | set nofoldenable 270 | 271 | " Switch to the directory files are in automatically. 272 | set autochdir 273 | 274 | " Keep buffers open after closing them, for the benefit of jumping. 275 | set hidden 276 | 277 | " Do not echo the mode, lightline will display it instead. 278 | set noshowmode 279 | 280 | set shortmess=filnxtToOc 281 | 282 | " Find search matches as they are typed. 283 | set incsearch 284 | 285 | " Configure the delay for custom chained keybinds. 286 | set timeoutlen=250 287 | 288 | " --- syntax file settings --- 289 | 290 | let g:c_syntax_for_h = 1 291 | let g:go_highlight_trailing_whitespace_error = 0 292 | 293 | " --- rainbow parens settings --- 294 | 295 | let g:rainbow_conf = { 296 | \ 'guifgs': ['#3b81e7', '#dccb3e', '#de2020', '#0bff22'], 297 | \ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'], 298 | \ 'operators': '_,_' 299 | \} 300 | let g:rainbow_active = 1 301 | 302 | " --- Vim grep settings --- 303 | 304 | set grepprg=rg\ --vimgrep\ --smart-case\ --follow 305 | 306 | " --- NERDTree settings --- 307 | 308 | " Close NERDTree automatically after opening a file with it. 309 | let g:NERDTreeQuitOnOpen = 1 310 | " Use a single click for opening things in NERDTree 311 | let g:NERDTreeMouseMode = 3 312 | let g:NERDTreeMapActivateNode = '' 313 | let g:NERDTreeIgnore = [ 314 | \ '\.pyc$', 315 | \ '^junit\.xml$', 316 | \ '^__pycache__$', 317 | \] 318 | 319 | 320 | " --- vim-lightline settings --- 321 | let g:lightline = { 322 | \ 'mode_map': { 323 | \ 'n': 'N', 324 | \ 'i': 'I', 325 | \ 'R': 'R', 326 | \ 'v': 'V', 327 | \ 'V': 'V', 328 | \ "\": 'VV', 329 | \ 'c' : 'C', 330 | \ 's' : 'S', 331 | \ 'S' : 'S-LINE', 332 | \ "\": 'S-BLOCK', 333 | \ 't': 'TERMINAL', 334 | \ }, 335 | \ 'active': { 336 | \ 'left': [ 337 | \ ['mode', 'paste'], 338 | \ ['readonly', 'filename', 'modified'], 339 | \ ], 340 | \ 'right': [ 341 | \ ['lineinfo'], 342 | \ ['python_status', 'javascript_status', 'filetype'], 343 | \ ], 344 | \ }, 345 | \ 'component_function': { 346 | \ 'python_status': 'python_tools#statusline#GetStatus', 347 | \ 'javascript_status': 'js_tools#GetStatus', 348 | \ }, 349 | \} 350 | 351 | 352 | " --- ALE settings --- 353 | " 354 | " Disable ALE warnings about trailing whitespace. 355 | highlight ALEErrorSign ctermfg=9 ctermbg=9 guifg=Red guibg=Red 356 | highlight ALEWarningSign ctermfg=11 ctermbg=11 guifg=#FFD166 guibg=#FFD166 357 | highlight ALEInfoSign ctermfg=4 ctermbg=4 guifg=#005f87 guibg=#005f87 358 | highlight SignColumn term=standout ctermfg=11 ctermbg=8 guifg=#efefef guibg=#3A3A3A 359 | let g:ale_warn_about_trailing_whitespace = 0 360 | let g:ale_maximum_file_size = 1024 * 1024 361 | let g:ale_completion_enabled = 1 362 | let g:ale_code_actions_enabled = 1 363 | let g:ale_set_balloons_legacy_echo = 1 364 | let g:ale_c_parse_compile_commands = 1 365 | let g:ale_lsp_suggestions = 0 366 | let g:ale_save_hidden = 1 367 | 368 | " ALE options for specific file patterns. 369 | let g:ale_pattern_options_enabled = 1 370 | let g:ale_pattern_options = { 371 | \ 'ale/doc/.*.txt$': { 372 | \ '&modifiable': 1, 373 | \ '&readonly': 0, 374 | \ }, 375 | \ 'site-packages/.*$': { 376 | \ 'ale_enabled': 0, 377 | \ '&modifiable': 0, 378 | \ }, 379 | \ '\v\.min\.(js|css)$': { 380 | \ 'ale_linters': [], 381 | \ 'ale_fixers': [], 382 | \ }, 383 | \ 'node_modules': { 384 | \ 'ale_fixers': [], 385 | \ }, 386 | \} 387 | 388 | " Options for different linters. 389 | let g:ale_python_mypy_ignore_invalid_syntax = 1 390 | let g:ale_python_mypy_options = '--incremental' 391 | let g:ale_typescript_tslint_ignore_empty_files = 1 392 | let g:ale_set_balloons = has('gui_running') ? 'hover' : 0 393 | 394 | " Use newer clang versions where available. 395 | if executable('clang-10') 396 | let g:ale_c_cc_executable = 'clang-10' 397 | let g:ale_cpp_cc_executable = 'clang++-10' 398 | endif 399 | 400 | if executable('clangd-10') 401 | let g:ale_c_clangd_executable = 'clangd-10' 402 | let g:ale_cpp_clangd_executable = 'clangd-10' 403 | endif 404 | 405 | if executable('clang-17') 406 | let g:ale_c_cc_executable = 'clang-17' 407 | let g:ale_cpp_cc_executable = 'clang++-17' 408 | endif 409 | 410 | if executable('clangd-17') 411 | let g:ale_c_clangd_executable = 'clangd-17' 412 | let g:ale_cpp_clangd_executable = 'clangd-17' 413 | endif 414 | 415 | " --- python-tools settings --- 416 | 417 | " Don't run migrations for pytest runs in python_tools 418 | let g:python_tools_pytest_no_migrations = 1 419 | 420 | " --- Extra custom settings --- 421 | let g:path_prefixes_to_trim = [] 422 | 423 | " --- Snippet settings --- 424 | 425 | " Left brace for snippets. 426 | let g:left_brace = "\n{" 427 | 428 | " --- vim-speech settings --- 429 | 430 | let $GOOGLE_APPLICATION_CREDENTIALS = $HOME 431 | \ . '/content/application/speech-to-text-key.json' 432 | let g:vim_speech_recording_status = '◉ REC' 433 | 434 | " --- neutral settings --- 435 | let g:neural = { 436 | \ 'source': { 437 | \ 'openai': { 438 | \ 'api_key': $OPENAI_API_KEY, 439 | \ }, 440 | \ }, 441 | \} 442 | 443 | " --- splitjoin settings --- 444 | " Default mappings are disabled, and configured in keybinds.vim instead. 445 | let g:splitjoin_split_mapping = '' 446 | let g:splitjoin_join_mapping = '' 447 | let g:splitjoin_curly_brace_padding = 0 448 | let g:splitjoin_trailing_comma = 1 449 | 450 | " --- autoloaded extra code --- 451 | 452 | let g:path_remove_regex_list = [ 453 | \ '^.*/ale/', 454 | \ '^.*/git/obp-dev/[^/]*/', 455 | \ '^.*/git/[^/]*/', 456 | \] 457 | 458 | " Run mostly blank init functions for loading extra settings, which can 459 | " be automatically reloaded when edited. 460 | call startup#keybinds#Init() 461 | call startup#autocmd#Init() 462 | call startup#spelling_corrections#Init() 463 | call startup#common#Init() 464 | call startup#command_abbreviations#Init() 465 | 466 | " --- finishing touches --- 467 | 468 | " Warn about not being able to write to .viminfo, which messes up restoring 469 | " the cursor position when editing. 470 | let s:info_filename = expand('~/.viminfo') 471 | 472 | if !empty(glob(s:info_filename)) && !filewritable(s:info_filename) 473 | echoerr 'The .viminfo file cannot be written to!' 474 | endif 475 | 476 | " Automatically reload vimrc on save 477 | augroup ReloadVimrcGroup 478 | autocmd! 479 | autocmd BufWritePost $MYVIMRC source $MYVIMRC 480 | augroup END 481 | 482 | if !g:vimrc_loaded 483 | execute 'packloadall' 484 | 485 | " Automatically regenerate help tags. 486 | silent! helptags ALL 487 | 488 | " Regenerate the spelling file on startup. 489 | execute 'silent mkspell!' 490 | \ ' ' . fnameescape($VIMHOME . '/spell/en.utf-8.add.spl') 491 | \ ' ' . fnameescape($VIMHOME . '/spell/en.utf-8.add') 492 | endif 493 | 494 | " Set tags by default to use HTML. 495 | call jspretmpl#register_tag('/\* *html *\*/', 'html') 496 | 497 | let g:vimrc_loaded = 1 498 | --------------------------------------------------------------------------------