diff options
author | Akshay <[email protected]> | 2024-07-23 20:26:43 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2024-07-23 20:26:43 +0100 |
commit | ddc6f72c5b1cf6916ef2705b226d0c53950b9386 (patch) | |
tree | 56b1d651dfe18a5e45b8cc6477ff8cb49991d98c |
init
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | after/syntax/python.vim | 6 | ||||
-rw-r--r-- | after/syntax/scheme.vim | 19 | ||||
-rw-r--r-- | ftdetect/kotlin.vim | 2 | ||||
-rw-r--r-- | ftplugin/asm.vim | 1 | ||||
-rw-r--r-- | ftplugin/go.vim | 4 | ||||
-rw-r--r-- | ftplugin/haskell.vim | 30 | ||||
-rw-r--r-- | ftplugin/javascript.vim | 8 | ||||
-rw-r--r-- | ftplugin/kotlin.vim | 19 | ||||
-rw-r--r-- | ftplugin/python.vim | 8 | ||||
-rw-r--r-- | ftplugin/rust.vim | 13 | ||||
-rw-r--r-- | ftplugin/scheme.vim | 7 | ||||
-rw-r--r-- | ftplugin/tex.vim | 6 | ||||
-rw-r--r-- | ftplugin/typescript.vim | 7 | ||||
-rw-r--r-- | ftplugin/wiki.vim | 1 | ||||
l--------- | init.lua | 1 | ||||
-rw-r--r-- | lua/completions.lua | 53 | ||||
-rw-r--r-- | lua/leap-ast.lua | 51 | ||||
-rw-r--r-- | lua/leap.lua | 10 | ||||
-rw-r--r-- | lua/lsp.lua | 68 | ||||
-rw-r--r-- | lua/treesitter.lua | 41 | ||||
-rw-r--r-- | plugin/help.vim | 16 | ||||
-rw-r--r-- | plugin/ignores.vim | 11 | ||||
-rw-r--r-- | plugin/maps.vim | 58 | ||||
-rw-r--r-- | plugin/statusline.vim | 137 | ||||
-rw-r--r-- | spell/en.utf-8.add | 22 | ||||
-rw-r--r-- | spell/en.utf-8.add.spl | bin | 0 -> 375 bytes | |||
-rw-r--r-- | syntax/kotlin.vim | 139 | ||||
-rw-r--r-- | syntax/proto.vim | 106 |
29 files changed, 847 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e883c08 --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1,3 @@ | |||
1 | .netrwhist | ||
2 | after/.netrwhist | ||
3 | autoload/ | ||
diff --git a/after/syntax/python.vim b/after/syntax/python.vim new file mode 100644 index 0000000..278cdc2 --- /dev/null +++ b/after/syntax/python.vim | |||
@@ -0,0 +1,6 @@ | |||
1 | syntax keyword pyNiceLambda lambda conceal cchar=λ | ||
2 | highlight link pyNiceLambda secondAccent | ||
3 | |||
4 | highlight! link Conceal Noise | ||
5 | |||
6 | setlocal conceallevel=1 | ||
diff --git a/after/syntax/scheme.vim b/after/syntax/scheme.vim new file mode 100644 index 0000000..9a2972b --- /dev/null +++ b/after/syntax/scheme.vim | |||
@@ -0,0 +1,19 @@ | |||
1 | syntax keyword scmNiceLambda lambda conceal cchar=λ | ||
2 | |||
3 | syntax clear schemeFunction | ||
4 | |||
5 | syntax match scmNiceOperator "<=" conceal cchar=≤ | ||
6 | syntax match scmNiceOperator ">=" conceal cchar=≥ | ||
7 | |||
8 | syn region scmNiceQuote matchgroup=secondAccent start=/'[`']*/ end=/[ \t\n()\[\]";]/me=e-1 | ||
9 | syn region scmNiceQuote matchgroup=secondAccent start=/'['`]*"/ skip=/\\[\\"]/ end=/"/ | ||
10 | syn region scmNiceQuote matchgroup=secondAccent start=/'['`]*|/ skip=/\\[\\|]/ end=/|/ | ||
11 | syn region scmNiceQuote matchgroup=secondAccent start=/'['`]*#\?(/ end=/)/ contains=ALLBUT,schemeQuasiquote,schemeQuasiquoteForm,schemeUnquote,schemeForm,schemeDatumCommentForm,schemeImport,@schemeImportCluster,@schemeSyntaxCluster | ||
12 | |||
13 | highlight link scmNiceLambda schemeSyntax | ||
14 | highlight link scmNiceOperator Noise | ||
15 | highlight link scmNiceQuote secondAccent | ||
16 | |||
17 | highlight! link Conceal Noise | ||
18 | |||
19 | setlocal conceallevel=1 | ||
diff --git a/ftdetect/kotlin.vim b/ftdetect/kotlin.vim new file mode 100644 index 0000000..6d5ebb7 --- /dev/null +++ b/ftdetect/kotlin.vim | |||
@@ -0,0 +1,2 @@ | |||
1 | autocmd BufNewFile,BufRead *.kt setfiletype kotlin | ||
2 | autocmd BufNewFile,BufRead *.kts setfiletype kotlin | ||
diff --git a/ftplugin/asm.vim b/ftplugin/asm.vim new file mode 100644 index 0000000..dde370b --- /dev/null +++ b/ftplugin/asm.vim | |||
@@ -0,0 +1 @@ | |||
syntax off | |||
diff --git a/ftplugin/go.vim b/ftplugin/go.vim new file mode 100644 index 0000000..6efd1fe --- /dev/null +++ b/ftplugin/go.vim | |||
@@ -0,0 +1,4 @@ | |||
1 | setlocal noexpandtab | ||
2 | setlocal autoindent | ||
3 | setlocal smarttab | ||
4 | setlocal formatoptions=croql | ||
diff --git a/ftplugin/haskell.vim b/ftplugin/haskell.vim new file mode 100644 index 0000000..651f033 --- /dev/null +++ b/ftplugin/haskell.vim | |||
@@ -0,0 +1,30 @@ | |||
1 | function! s:OverwriteBuffer(output) | ||
2 | let winview = winsaveview() | ||
3 | silent! undojoin | ||
4 | normal! gg"_dG | ||
5 | call append(0, split(a:output, '\v\n')) | ||
6 | normal! G"_dd | ||
7 | call winrestview(winview) | ||
8 | endfunction | ||
9 | |||
10 | function! s:RunStylishHaskell() | ||
11 | let output = system("stylish-haskell" . " " . bufname("%")) | ||
12 | let errors = matchstr(output, '\(Language\.Haskell\.Stylish\.Parse\.parseModule:[^\x0]*\)') | ||
13 | if v:shell_error != 0 | ||
14 | echom output | ||
15 | elseif empty(errors) | ||
16 | call s:OverwriteBuffer(output) | ||
17 | write | ||
18 | else | ||
19 | echom errors | ||
20 | endif | ||
21 | endfunction | ||
22 | |||
23 | set formatprg=stylish-haskell | ||
24 | set makeprg=hlint | ||
25 | |||
26 | augroup HaskellLint | ||
27 | autocmd! | ||
28 | autocmd BufWritePost *.hs | call s:RunStylishHaskell() | silent make! <afile> | silent redraw! | ||
29 | autocmd QuickFixCmdPost [^l]* cwindow | ||
30 | augroup END | ||
diff --git a/ftplugin/javascript.vim b/ftplugin/javascript.vim new file mode 100644 index 0000000..454c153 --- /dev/null +++ b/ftplugin/javascript.vim | |||
@@ -0,0 +1,8 @@ | |||
1 | setlocal tabstop=2 | ||
2 | setlocal shiftwidth=2 | ||
3 | setlocal softtabstop=2 | ||
4 | setlocal formatoptions=croq | ||
5 | setlocal expandtab | ||
6 | setlocal autoindent | ||
7 | setlocal smarttab | ||
8 | |||
diff --git a/ftplugin/kotlin.vim b/ftplugin/kotlin.vim new file mode 100644 index 0000000..d001ac1 --- /dev/null +++ b/ftplugin/kotlin.vim | |||
@@ -0,0 +1,19 @@ | |||
1 | setlocal tabstop=4 | ||
2 | setlocal softtabstop=4 | ||
3 | setlocal shiftwidth=4 | ||
4 | setlocal expandtab | ||
5 | setlocal autoindent | ||
6 | setlocal smarttab | ||
7 | setlocal formatoptions=croql | ||
8 | |||
9 | setlocal comments=:// | ||
10 | setlocal commentstring=//\ %s | ||
11 | |||
12 | setlocal makeprg=ktlint | ||
13 | |||
14 | augroup KtLint | ||
15 | autocmd! | ||
16 | autocmd BufWritePost *.kt silent make! <afile> | silent redraw | ||
17 | autocmd QuickFixCmdPost [^l]* cwindow | ||
18 | augroup END | ||
19 | |||
diff --git a/ftplugin/python.vim b/ftplugin/python.vim new file mode 100644 index 0000000..89b7508 --- /dev/null +++ b/ftplugin/python.vim | |||
@@ -0,0 +1,8 @@ | |||
1 | setlocal tabstop=4 | ||
2 | setlocal softtabstop=4 | ||
3 | setlocal shiftwidth=4 | ||
4 | setlocal expandtab | ||
5 | setlocal autoindent | ||
6 | setlocal smarttab | ||
7 | setlocal formatoptions=croql | ||
8 | setlocal formatprg=yapf | ||
diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim new file mode 100644 index 0000000..50645fa --- /dev/null +++ b/ftplugin/rust.vim | |||
@@ -0,0 +1,13 @@ | |||
1 | setlocal ts=4 sts=4 sw=4 expandtab | ||
2 | |||
3 | set formatprg=rustfmt | ||
4 | set errorformat= | ||
5 | \%-G, | ||
6 | \%-Gerror:\ aborting\ %.%#, | ||
7 | \%-Gerror:\ Could\ not\ compile\ %.%#, | ||
8 | \%Eerror:\ %m, | ||
9 | \%Eerror[E%n]:\ %m, | ||
10 | \%Wwarning:\ %m, | ||
11 | \%Inote:\ %m, | ||
12 | \%C\ %#-->\ %f:%l:%c, | ||
13 | \%E\ \ left:%m,%C\ right:%m\ %f:%l:%c,%Z | ||
diff --git a/ftplugin/scheme.vim b/ftplugin/scheme.vim new file mode 100644 index 0000000..784bf29 --- /dev/null +++ b/ftplugin/scheme.vim | |||
@@ -0,0 +1,7 @@ | |||
1 | setlocal tabstop=2 | ||
2 | setlocal softtabstop=2 | ||
3 | setlocal shiftwidth=2 | ||
4 | setlocal expandtab | ||
5 | setlocal autoindent | ||
6 | setlocal smarttab | ||
7 | setlocal formatoptions=croql | ||
diff --git a/ftplugin/tex.vim b/ftplugin/tex.vim new file mode 100644 index 0000000..515fb7a --- /dev/null +++ b/ftplugin/tex.vim | |||
@@ -0,0 +1,6 @@ | |||
1 | setlocal wrap | ||
2 | setlocal number | ||
3 | nnoremap j gj | ||
4 | nnoremap k gk | ||
5 | let g:tex_conceal="abdmgs" | ||
6 | let g:tex_fold_enabled=1 | ||
diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim new file mode 100644 index 0000000..c6132bb --- /dev/null +++ b/ftplugin/typescript.vim | |||
@@ -0,0 +1,7 @@ | |||
1 | setlocal tabstop=2 | ||
2 | setlocal shiftwidth=2 | ||
3 | setlocal softtabstop=2 | ||
4 | setlocal formatoptions=croq | ||
5 | setlocal expandtab | ||
6 | setlocal autoindent | ||
7 | setlocal smarttab | ||
diff --git a/ftplugin/wiki.vim b/ftplugin/wiki.vim new file mode 100644 index 0000000..88a5339 --- /dev/null +++ b/ftplugin/wiki.vim | |||
@@ -0,0 +1 @@ | |||
set textwidth=72 | |||
diff --git a/init.lua b/init.lua new file mode 120000 index 0000000..a230fe7 --- /dev/null +++ b/init.lua | |||
@@ -0,0 +1 @@ | |||
/nix/store/7krz5l0yqf14bigxxc8m1va9bmkq0qq0-home-manager-files/.config/nvim/init.lua \ No newline at end of file | |||
diff --git a/lua/completions.lua b/lua/completions.lua new file mode 100644 index 0000000..bd90178 --- /dev/null +++ b/lua/completions.lua | |||
@@ -0,0 +1,53 @@ | |||
1 | local cmp = require 'cmp' | ||
2 | |||
3 | cmp.setup({ | ||
4 | snippet = { | ||
5 | expand = function(args) end, | ||
6 | }, | ||
7 | mapping = { | ||
8 | ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), | ||
9 | ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), | ||
10 | ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), | ||
11 | ['<C-y>'] = cmp.config.disable, | ||
12 | ['<C-e>'] = cmp.mapping({ | ||
13 | i = cmp.mapping.abort(), | ||
14 | c = cmp.mapping.close(), | ||
15 | }), | ||
16 | ['<CR>'] = cmp.mapping.confirm({ select = true }), | ||
17 | |||
18 | ['<C-n>'] = cmp.mapping(function(fallback) | ||
19 | if cmp.visible() then | ||
20 | cmp.select_next_item() | ||
21 | else | ||
22 | fallback() | ||
23 | end | ||
24 | end, { 'i', 's', 'c' }), | ||
25 | |||
26 | ['<C-p>'] = cmp.mapping(function(fallback) | ||
27 | if cmp.visible() then | ||
28 | cmp.select_prev_item() | ||
29 | else | ||
30 | fallback() | ||
31 | end | ||
32 | end, { 'i', 's', 'c' }), | ||
33 | }, | ||
34 | sources = cmp.config.sources({ | ||
35 | { name = 'nvim_lsp' }, | ||
36 | }, { | ||
37 | { name = 'buffer' }, | ||
38 | }) | ||
39 | }) | ||
40 | |||
41 | cmp.setup.cmdline('/', { | ||
42 | sources = { | ||
43 | { name = 'buffer' } | ||
44 | } | ||
45 | }) | ||
46 | |||
47 | cmp.setup.cmdline(':', { | ||
48 | sources = cmp.config.sources({ | ||
49 | { name = 'path' } | ||
50 | }, { | ||
51 | { name = 'cmdline' } | ||
52 | }) | ||
53 | }) | ||
diff --git a/lua/leap-ast.lua b/lua/leap-ast.lua new file mode 100644 index 0000000..22a5876 --- /dev/null +++ b/lua/leap-ast.lua | |||
@@ -0,0 +1,51 @@ | |||
1 | local api = vim.api | ||
2 | -- Note: The functions used here will be upstreamed eventually. | ||
3 | local ts_utils = require('nvim-treesitter.ts_utils') | ||
4 | |||
5 | local function get_ast_nodes() | ||
6 | local wininfo = vim.fn.getwininfo(api.nvim_get_current_win())[1] | ||
7 | -- Get current TS node. | ||
8 | local cur_node = ts_utils.get_node_at_cursor(0) | ||
9 | if not cur_node then return end | ||
10 | -- Get parent nodes recursively. | ||
11 | local nodes = { cur_node } | ||
12 | local parent = cur_node:parent() | ||
13 | while parent do | ||
14 | table.insert(nodes, parent) | ||
15 | parent = parent:parent() | ||
16 | end | ||
17 | -- Create Leap targets from TS nodes. | ||
18 | local targets = {} | ||
19 | local startline, startcol | ||
20 | for _, node in ipairs(nodes) do | ||
21 | startline, startcol, _, _ = node:range() -- (0,0) | ||
22 | if startline + 1 >= wininfo.topline then | ||
23 | local target = { node = node, pos = { startline + 1, startcol + 1 } } | ||
24 | table.insert(targets, target) | ||
25 | end | ||
26 | end | ||
27 | if #targets >= 1 then return targets end | ||
28 | end | ||
29 | |||
30 | local function select_range(target) | ||
31 | local mode = api.nvim_get_mode().mode | ||
32 | if not mode:match('n?o') then | ||
33 | -- Force going back to Normal (implies mode = v | V | ). | ||
34 | vim.cmd('normal! ' .. mode) | ||
35 | end | ||
36 | ts_utils.update_selection(0, target.node, | ||
37 | mode:match('V') and 'linewise' or | ||
38 | mode:match('') and 'blockwise' or | ||
39 | 'charwise' | ||
40 | ) | ||
41 | end | ||
42 | |||
43 | local function leap() | ||
44 | require('leap').leap { | ||
45 | targets = get_ast_nodes(), | ||
46 | action = api.nvim_get_mode().mode ~= 'n' and select_range, -- or jump | ||
47 | backward = true | ||
48 | } | ||
49 | end | ||
50 | |||
51 | return { leap = leap } | ||
diff --git a/lua/leap.lua b/lua/leap.lua new file mode 100644 index 0000000..14be3bd --- /dev/null +++ b/lua/leap.lua | |||
@@ -0,0 +1,10 @@ | |||
1 | local leap = require 'leap' | ||
2 | leap.opts.safe_labels = {} | ||
3 | leap.opts.labels = { | ||
4 | "a", "r", "s", "t", "n", "e", "i", "o", "d", "h", | ||
5 | "A", "R", "S", "T", "N", "E", "I", "O", "D", "H" | ||
6 | } | ||
7 | leap.opts.special_keys = { | ||
8 | next_target = '<c-n>', | ||
9 | prev_target = '<c-p>', | ||
10 | } | ||
diff --git a/lua/lsp.lua b/lua/lsp.lua new file mode 100644 index 0000000..349c719 --- /dev/null +++ b/lua/lsp.lua | |||
@@ -0,0 +1,68 @@ | |||
1 | local nvim_lsp = require('lspconfig') | ||
2 | local on_attach = function(client, bufnr) | ||
3 | local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end | ||
4 | local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end | ||
5 | |||
6 | buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') | ||
7 | |||
8 | -- Mappings. | ||
9 | local bufopts = { noremap=true, silent=true, buffer=bufnr } | ||
10 | vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) | ||
11 | vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) | ||
12 | vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) | ||
13 | vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) | ||
14 | vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) | ||
15 | |||
16 | local opts = { noremap=true, silent=true } | ||
17 | vim.keymap.set('n', '<space>d', vim.diagnostic.open_float, opts) | ||
18 | vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) | ||
19 | vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) | ||
20 | vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts) | ||
21 | vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts) | ||
22 | end | ||
23 | |||
24 | local servers = { "hls", "bashls" } | ||
25 | for _, lsp in ipairs(servers) do | ||
26 | nvim_lsp[lsp].setup { | ||
27 | on_attach = on_attach, | ||
28 | } | ||
29 | end | ||
30 | |||
31 | local capabilities = require('cmp_nvim_lsp') | ||
32 | .default_capabilities(vim.lsp.protocol.make_client_capabilities()) | ||
33 | |||
34 | capabilities.textDocument.completion.completionItem.snippetSupport = true | ||
35 | |||
36 | -- nvim_lsp.rust_analyzer.setup { | ||
37 | -- on_attach = on_attach, | ||
38 | -- settings = { | ||
39 | -- ["rust-analyzer"] = { | ||
40 | -- procMacro = { | ||
41 | -- enable = true | ||
42 | -- }, | ||
43 | -- cargo = { | ||
44 | -- allFeatures = false, | ||
45 | -- }, | ||
46 | -- checkOnSave = false, | ||
47 | -- }, | ||
48 | -- }, | ||
49 | -- } | ||
50 | |||
51 | nvim_lsp.ccls.setup { | ||
52 | capabilities = capabilities, | ||
53 | on_attach = on_attach, | ||
54 | init_options = { | ||
55 | index = { | ||
56 | threads = 0; | ||
57 | }; | ||
58 | clang = { | ||
59 | extraArgs = { "-fopenmp" }; | ||
60 | excludeArgs = { "-frounding-math" } ; | ||
61 | }; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | nvim_lsp.jdtls.setup{ | ||
66 | cmd = {"jdtls"}; | ||
67 | } | ||
68 | |||
diff --git a/lua/treesitter.lua b/lua/treesitter.lua new file mode 100644 index 0000000..f63cb3b --- /dev/null +++ b/lua/treesitter.lua | |||
@@ -0,0 +1,41 @@ | |||
1 | require'nvim-treesitter.configs'.setup { | ||
2 | highlight = { | ||
3 | enable = false, | ||
4 | -- disable = { "c"}, | ||
5 | }, | ||
6 | incremental_selection = { | ||
7 | enable = true, | ||
8 | keymaps = { | ||
9 | init_selection = "gnn", | ||
10 | node_incremental = "g}", | ||
11 | scope_incremental = "grc", | ||
12 | node_decremental = "g{", | ||
13 | }, | ||
14 | }, | ||
15 | indent = { | ||
16 | enable = false | ||
17 | }, | ||
18 | playground = { | ||
19 | enable = true, | ||
20 | disable = {}, | ||
21 | updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code | ||
22 | persist_queries = false, -- Whether the query persists across vim sessions | ||
23 | keybindings = { | ||
24 | toggle_query_editor = 'o', | ||
25 | toggle_hl_groups = 'i', | ||
26 | toggle_injected_languages = 't', | ||
27 | toggle_anonymous_nodes = 'a', | ||
28 | toggle_language_display = 'I', | ||
29 | focus_language = 'f', | ||
30 | unfocus_language = 'F', | ||
31 | update = 'R', | ||
32 | goto_node = '<cr>', | ||
33 | show_help = '?', | ||
34 | }, | ||
35 | }, | ||
36 | query_linter = { | ||
37 | enable = true, | ||
38 | use_virtual_text = true, | ||
39 | lint_events = {"BufWrite", "CursorHold"}, | ||
40 | }, | ||
41 | } | ||
diff --git a/plugin/help.vim b/plugin/help.vim new file mode 100644 index 0000000..decdab6 --- /dev/null +++ b/plugin/help.vim | |||
@@ -0,0 +1,16 @@ | |||
1 | " Only apply to .txt files... | ||
2 | augroup HelpInTabs | ||
3 | autocmd! | ||
4 | autocmd BufEnter *.txt call HelpInNewTab() | ||
5 | augroup END | ||
6 | |||
7 | " Only apply to help files... | ||
8 | function! HelpInNewTab () | ||
9 | if &buftype == 'help' && g:help_in_tabs | ||
10 | "Convert the help window to a tab... | ||
11 | execute "normal \<C-W>T" | ||
12 | endif | ||
13 | endfunction | ||
14 | |||
15 | let g:help_in_tabs = 0 | ||
16 | |||
diff --git a/plugin/ignores.vim b/plugin/ignores.vim new file mode 100644 index 0000000..3ab37f0 --- /dev/null +++ b/plugin/ignores.vim | |||
@@ -0,0 +1,11 @@ | |||
1 | set wildignore+=.git,.hg,.svn | ||
2 | set wildignore+=*.aux,*.out,*.toc | ||
3 | set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class | ||
4 | set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp | ||
5 | set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg | ||
6 | set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac | ||
7 | set wildignore+=*.eot,*.otf,*.ttf,*.woff | ||
8 | set wildignore+=*.doc,*.pdf,*.cbr,*.cbz | ||
9 | set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb | ||
10 | set wildignore+=*.swp,.lock,.DS_Store,._* | ||
11 | |||
diff --git a/plugin/maps.vim b/plugin/maps.vim new file mode 100644 index 0000000..b61e994 --- /dev/null +++ b/plugin/maps.vim | |||
@@ -0,0 +1,58 @@ | |||
1 | mapclear | ||
2 | |||
3 | let mapleader=' ' | ||
4 | |||
5 | " clipboard | ||
6 | map <leader>cc :w !xclip -sel c<CR> | ||
7 | |||
8 | " normal | ||
9 | nnoremap <Leader>o : only<cr> | ||
10 | nnoremap - : b#<cr> | ||
11 | nnoremap <Leader>b : Buffers<cr> | ||
12 | nnoremap <Leader>n : bnext<cr> | ||
13 | nnoremap <Leader>p : bprev<cr> | ||
14 | nnoremap <Leader>z : FZF<cr> | ||
15 | nnoremap <Leader>l : Lines<cr> | ||
16 | nnoremap <Leader>e : Explore<cr> | ||
17 | nnoremap <Leader>t : call GetTabber()<cr> | ||
18 | nnoremap <Leader><ESC> : nohlsearch<cr> | ||
19 | nnoremap <C-l> :nohlsearch<cr>:diffupdate<cr>:syntax sync fromstart<cr><c-l> | ||
20 | nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr> | ||
21 | nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr> | ||
22 | nnoremap <expr> gb '`[' . strpart(getregtype(), 0, 1) . '`]' | ||
23 | |||
24 | |||
25 | nnoremap <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' | ||
26 | \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" | ||
27 | \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR> | ||
28 | |||
29 | nnoremap <Leader>s <Plug>(leap-forward-to) | ||
30 | nnoremap <Leader>S <Plug>(leap-backward-to) | ||
31 | |||
32 | cmap w!! %!sudo -S tee > /dev/null % | ||
33 | |||
34 | " visual | ||
35 | vnoremap > >gv | ||
36 | vnoremap < <gv | ||
37 | vnoremap <silent> * :<C-U> | ||
38 | \let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR> | ||
39 | \gvy/<C-R>=&ic?'\c':'\C'<CR><C-R><C-R>=substitute( | ||
40 | \escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR> | ||
41 | \gVzv:call setreg('"', old_reg, old_regtype)<CR> | ||
42 | vnoremap <silent> # :<C-U> | ||
43 | \let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR> | ||
44 | \gvy?<C-R>=&ic?'\c':'\C'<CR><C-R><C-R>=substitute( | ||
45 | \escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR> | ||
46 | \gVzv:call setreg('"', old_reg, old_regtype)<CR> | ||
47 | |||
48 | " operator-pending | ||
49 | onoremap ax a` | ||
50 | onoremap ix i` | ||
51 | |||
52 | " visual block | ||
53 | xnoremap + g<C-a> | ||
54 | xnoremap - g<C-x> | ||
55 | |||
56 | " completions | ||
57 | inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | ||
58 | inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" | ||
diff --git a/plugin/statusline.vim b/plugin/statusline.vim new file mode 100644 index 0000000..a5264a4 --- /dev/null +++ b/plugin/statusline.vim | |||
@@ -0,0 +1,137 @@ | |||
1 | scriptencoding utf-8 | ||
2 | |||
3 | " statusline | ||
4 | |||
5 | let g:currentmode={ | ||
6 | \ 'n' : 'NORMAL ', | ||
7 | \ 'no' : 'N·OPERATOR PENDING ', | ||
8 | \ 'v' : 'VISUAL ', | ||
9 | \ 'V' : 'V·LINE ', | ||
10 | \ '' : 'V·BLOCK ', | ||
11 | \ 's' : 'SELECT ', | ||
12 | \ 'S' : 'S·LINE ', | ||
13 | \ '' : 'S·BLOCK ', | ||
14 | \ 'i' : 'INSERT ', | ||
15 | \ 'R' : 'REPLACE ', | ||
16 | \ 'Rv' : 'V·REPLACE ', | ||
17 | \ 'c' : 'COMMAND ', | ||
18 | \ 'cv' : 'VIM EX ', | ||
19 | \ 'ce' : 'EX ', | ||
20 | \ 'r' : 'PROMPT ', | ||
21 | \ 'rm' : 'MORE ', | ||
22 | \ 'r?' : 'CONFIRM ', | ||
23 | \ '!' : 'SHELL ', | ||
24 | \ 't' : 'TERMINAL '} | ||
25 | |||
26 | hi PrimaryBlock ctermfg=00 ctermbg=6 | ||
27 | hi SecondaryBlock ctermfg=07 ctermbg=10 | ||
28 | hi Blanks ctermfg=08 ctermbg=0 | ||
29 | |||
30 | hi User1 ctermfg=01 ctermbg=0 | ||
31 | hi User2 ctermfg=02 ctermbg=0 | ||
32 | hi User3 ctermfg=03 ctermbg=0 | ||
33 | hi User4 ctermfg=12 ctermbg=0 | ||
34 | hi User5 ctermfg=05 ctermbg=0 | ||
35 | hi User6 ctermfg=06 ctermbg=0 | ||
36 | hi User7 ctermfg=07 ctermbg=0 | ||
37 | hi User8 ctermfg=08 ctermbg=0 | ||
38 | hi User9 ctermfg=00 ctermbg=0 | ||
39 | |||
40 | highlight EndOfBuffer ctermfg=black ctermbg=black | ||
41 | |||
42 | function! ReadOnly() abort | ||
43 | if !&modifiable && &readonly | ||
44 | return ' RO' | ||
45 | elseif &modifiable && &readonly | ||
46 | return 'RO' | ||
47 | elseif !&modifiable && !&readonly | ||
48 | return '' | ||
49 | else | ||
50 | return '' | ||
51 | endif | ||
52 | endfunction | ||
53 | |||
54 | function! Filepath() abort | ||
55 | let l:basename = expand('%:h') | ||
56 | let l:filename = expand('%:t') | ||
57 | let l:extension = expand('%:e') | ||
58 | let l:prefix = (l:basename ==# '' || l:basename ==# '.') ? | ||
59 | \ '' : substitute(l:basename . '/', '\C^' . $HOME, '~', '') | ||
60 | |||
61 | if empty(l:prefix) && empty(l:filename) | ||
62 | return printf('%%4*%%f%%*%s %%m%%*', '%4*') | ||
63 | elseif empty(l:prefix) | ||
64 | return printf('%%4*%%f%%*%s %%m%%*', '%6*') | ||
65 | else | ||
66 | return printf('%%4*%s%%*%s%s%%*', l:prefix, &modified ? '%6*' : '%4*', l:filename) | ||
67 | endif | ||
68 | endfunction | ||
69 | |||
70 | function! QuickFixStatus() abort | ||
71 | let l:qfl=getqflist() | ||
72 | let l:qftitle = getqflist({'title' : 0}).title | ||
73 | if len(qfl) != 0 | ||
74 | return l:qftitle | ||
75 | else | ||
76 | return '' | ||
77 | endfunction | ||
78 | |||
79 | function! LinterStatus() abort | ||
80 | let sl = '' | ||
81 | let msgs = [] | ||
82 | if luaeval('not vim.tbl_isempty(vim.lsp.buf_get_clients(0))') | ||
83 | let errs = luaeval("#vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })") | ||
84 | let warns = luaeval("#vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })") | ||
85 | if errs != 0 | ||
86 | call add(msgs, printf('%%5*%s×%%* ', errs)) | ||
87 | endif | ||
88 | if warns != 0 | ||
89 | call add(msgs, printf('%%3*%s!%%* ', warns)) | ||
90 | endif | ||
91 | return join(msgs, '') | ||
92 | else | ||
93 | return '' | ||
94 | endif | ||
95 | endfunction | ||
96 | |||
97 | function! StatusLine(mode) abort | ||
98 | let l:line='' | ||
99 | |||
100 | " help or man pages | ||
101 | if &filetype ==# 'help' || &filetype ==# 'man' | ||
102 | let l:line.=' %#StatusLineNC# ['. &filetype .'] %f ' | ||
103 | return l:line | ||
104 | endif | ||
105 | |||
106 | " active | ||
107 | if a:mode ==# 'active' | ||
108 | let l:line.=Filepath() | ||
109 | let l:line.='%5*' | ||
110 | let l:line.=QuickFixStatus() | ||
111 | |||
112 | let l:line.='%5*' | ||
113 | let l:line.=' %{ReadOnly()} %w%*' | ||
114 | let l:line.='%9* %=%*' | ||
115 | |||
116 | let l:line.=' ' . '%7*%l,%c%*' . ' ' | ||
117 | let l:line.=LinterStatus() | ||
118 | let l:line.='%4*'. &filetype | ||
119 | |||
120 | else | ||
121 | " inactive | ||
122 | let l:line.='%#Blanks#' | ||
123 | let l:line.='%f %5*%m%*' | ||
124 | let l:line.='%#Blanks# %=%*' | ||
125 | endif | ||
126 | |||
127 | let l:line.='%*' | ||
128 | |||
129 | return l:line | ||
130 | endfunction | ||
131 | |||
132 | set statusline=%!StatusLine('active') | ||
133 | augroup MyStatusLine | ||
134 | autocmd! | ||
135 | autocmd WinEnter * setl statusline=%!StatusLine('active') | ||
136 | autocmd WinLeave * setl statusline=%!StatusLine('inactive') | ||
137 | augroup END | ||
diff --git a/spell/en.utf-8.add b/spell/en.utf-8.add new file mode 100644 index 0000000..333c6d8 --- /dev/null +++ b/spell/en.utf-8.add | |||
@@ -0,0 +1,22 @@ | |||
1 | metadata | ||
2 | ImageInformationHeader | ||
3 | Ramayana | ||
4 | Narayana | ||
5 | Garuda | ||
6 | Iravata | ||
7 | Sita | ||
8 | Kakasura | ||
9 | Ramayanam | ||
10 | Dasaratha | ||
11 | Ayodhya | ||
12 | Ravana | ||
13 | Rakshasa | ||
14 | Hanuman | ||
15 | dharma | ||
16 | Pandu | ||
17 | Pandavas | ||
18 | Vasudeva | ||
19 | Devaki | ||
20 | Rakshasas | ||
21 | right | ||
22 | #xersice | ||
diff --git a/spell/en.utf-8.add.spl b/spell/en.utf-8.add.spl new file mode 100644 index 0000000..6ec00f8 --- /dev/null +++ b/spell/en.utf-8.add.spl | |||
Binary files differ | |||
diff --git a/syntax/kotlin.vim b/syntax/kotlin.vim new file mode 100644 index 0000000..48fc6ce --- /dev/null +++ b/syntax/kotlin.vim | |||
@@ -0,0 +1,139 @@ | |||
1 | " Vim syntax file | ||
2 | " Language: Kotlin | ||
3 | " Maintainer: Alexander Udalov | ||
4 | " Latest Revision: 13 July 2020 | ||
5 | |||
6 | if exists('b:current_syntax') | ||
7 | finish | ||
8 | endif | ||
9 | |||
10 | syn keyword ktStatement break continue return | ||
11 | syn keyword ktConditional if else when | ||
12 | syn keyword ktRepeat do for while | ||
13 | syn keyword ktOperator in is by | ||
14 | syn keyword ktKeyword get set out super this where | ||
15 | syn keyword ktException try catch finally throw | ||
16 | |||
17 | syn keyword ktInclude import package | ||
18 | |||
19 | " The following is generated by generate-stdlib-class-names.main.kts | ||
20 | syn keyword ktType AbstractCollection AbstractCoroutineContextElement AbstractCoroutineContextKey AbstractDoubleTimeSource AbstractIterator AbstractList AbstractLongTimeSource | ||
21 | syn keyword ktType AbstractMap AbstractMutableCollection AbstractMutableList AbstractMutableMap AbstractMutableSet AbstractSet AccessDeniedException Accessor Annotation | ||
22 | syn keyword ktType AnnotationRetention AnnotationTarget Any Appendable ArithmeticException Array ArrayDeque ArrayList AssertionError Boolean BooleanArray BooleanIterator | ||
23 | syn keyword ktType BuilderInference Byte ByteArray ByteIterator CallsInPlace CancellationException Char CharArray CharCategory CharDirectionality CharIterator CharProgression | ||
24 | syn keyword ktType CharRange CharSequence CharacterCodingException Charsets ClassCastException Cloneable ClosedFloatingPointRange ClosedRange Collection Comparable Comparator | ||
25 | syn keyword ktType ConcurrentModificationException ConditionalEffect Continuation ContinuationInterceptor ContractBuilder CoroutineContext DeepRecursiveFunction DeepRecursiveScope | ||
26 | syn keyword ktType Delegates Deprecated DeprecatedSinceKotlin DeprecationLevel Destructured Double DoubleArray DoubleIterator DslMarker Duration DurationUnit Effect Element | ||
27 | syn keyword ktType EmptyCoroutineContext Entry Enum Error Exception Experimental ExperimentalContracts ExperimentalJsExport ExperimentalMultiplatform ExperimentalStdlibApi | ||
28 | syn keyword ktType ExperimentalTime ExperimentalTypeInference ExperimentalUnsignedTypes ExtensionFunctionType FileAlreadyExistsException FileSystemException FileTreeWalk | ||
29 | syn keyword ktType FileWalkDirection Float FloatArray FloatIterator Function Function0 Function1 Function10 Function11 Function12 Function13 Function14 Function15 Function16 | ||
30 | syn keyword ktType Function17 Function18 Function19 Function2 Function20 Function21 Function22 Function3 Function4 Function5 Function6 Function7 Function8 Function9 FunctionN | ||
31 | syn keyword ktType Getter Grouping HashMap HashSet IllegalArgumentException IllegalStateException IndexOutOfBoundsException IndexedValue Int IntArray IntIterator IntProgression | ||
32 | syn keyword ktType IntRange InvocationKind Iterable Iterator JsExport JsName JvmDefault JvmDefaultWithoutCompatibility JvmField JvmMultifileClass JvmName JvmOverloads JvmStatic | ||
33 | syn keyword ktType JvmSuppressWildcards JvmSynthetic JvmWildcard KAnnotatedElement KCallable KClass KClassifier KDeclarationContainer KFunction KMutableProperty KMutableProperty0 | ||
34 | syn keyword ktType KMutableProperty1 KMutableProperty2 KParameter KProperty KProperty0 KProperty1 KProperty2 KType KTypeParameter KTypeProjection KVariance KVisibility Key Kind | ||
35 | syn keyword ktType KotlinNullPointerException KotlinReflectionNotSupportedError KotlinVersion Lazy LazyThreadSafetyMode Level LinkedHashMap LinkedHashSet List ListIterator Long | ||
36 | syn keyword ktType LongArray LongIterator LongProgression LongRange Map MatchGroup MatchGroupCollection MatchNamedGroupCollection MatchResult Metadata Monotonic MustBeDocumented | ||
37 | syn keyword ktType MutableCollection MutableEntry MutableIterable MutableIterator MutableList MutableListIterator MutableMap MutableSet NoSuchElementException NoSuchFileException | ||
38 | syn keyword ktType NoWhenBranchMatchedException NotImplementedError Nothing NullPointerException Number NumberFormatException ObservableProperty OnErrorAction OptIn | ||
39 | syn keyword ktType OptionalExpectation OverloadResolutionByLambdaReturnType Pair ParameterName PropertyDelegateProvider PublishedApi PurelyImplements Random RandomAccess | ||
40 | syn keyword ktType ReadOnlyProperty ReadWriteProperty Regex RegexOption Repeatable ReplaceWith RequiresOptIn RestrictsSuspension Result Retention Returns ReturnsNotNull | ||
41 | syn keyword ktType RuntimeException Sequence SequenceScope Set Setter SharedImmutable Short ShortArray ShortIterator SimpleEffect SinceKotlin Strictfp String StringBuilder Suppress | ||
42 | syn keyword ktType Synchronized Target TestTimeSource ThreadLocal Throwable Throws TimeMark TimeSource TimedValue Transient Triple TypeCastException Typography UByte UByteArray | ||
43 | syn keyword ktType UByteIterator UInt UIntArray UIntIterator UIntProgression UIntRange ULong ULongArray ULongIterator ULongProgression ULongRange UShort UShortArray UShortIterator | ||
44 | syn keyword ktType UninitializedPropertyAccessException Unit UnsafeVariance UnsupportedOperationException UseExperimental Volatile | ||
45 | |||
46 | syn keyword ktModifier annotation companion enum inner internal private protected public abstract final open override sealed vararg dynamic expect actual | ||
47 | syn keyword ktStructure class object interface typealias fun val var constructor init | ||
48 | |||
49 | syn keyword ktReservedKeyword typeof | ||
50 | |||
51 | syn keyword ktBoolean true false | ||
52 | syn keyword ktConstant null | ||
53 | |||
54 | syn keyword ktModifier data tailrec lateinit reified external inline noinline crossinline const operator infix suspend | ||
55 | |||
56 | syn match ktOperator "\v\?:|::|\<\=? | \>\=?|[!=]\=\=?|<as>\??|[-!%&*+/|]" | ||
57 | |||
58 | syn keyword ktTodo TODO FIXME XXX contained | ||
59 | syn match ktShebang "\v^#!.*$" | ||
60 | syn match ktLineComment "\v//.*$" contains=ktTodo,@Spell | ||
61 | syn region ktComment matchgroup=ktCommentMatchGroup start="/\*" end="\*/" contains=ktComment,ktTodo,@Spell | ||
62 | |||
63 | syn region ktDocComment start="/\*\*" end="\*/" contains=ktDocTag,ktTodo,@Spell | ||
64 | syn match ktDocTag "\v\@(author|constructor|receiver|return|since|suppress)>" contained | ||
65 | syn match ktDocTag "\v\@(exception|param|property|throws|see|sample)>\s*\S+" contains=ktDocTagParam contained | ||
66 | syn match ktDocTagParam "\v(\s|\[)\S+" contained | ||
67 | syn match ktComment "/\*\*/" | ||
68 | |||
69 | syn match ktSpecialCharError "\v\\." contained | ||
70 | syn match ktSpecialChar "\v\\([tbnr'"$\\]|u\x{4})" contained | ||
71 | syn region ktString start='"' skip='\\"' end='"' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError | ||
72 | syn region ktString start='"""' end='""""*' contains=ktSimpleInterpolation,ktComplexInterpolation | ||
73 | syn match ktCharacter "\v'[^']*'" contains=ktSpecialChar,ktSpecialCharError | ||
74 | syn match ktCharacter "\v'\\''" contains=ktSpecialChar | ||
75 | syn match ktCharacter "\v'[^\\]'" | ||
76 | |||
77 | " TODO: highlight label in 'this@Foo' | ||
78 | syn match ktAnnotation "\v(\w)@<!\@[[:alnum:]_.]*(:[[:alnum:]_.]*)?" | ||
79 | syn match ktLabel "\v\w+\@" | ||
80 | |||
81 | syn match ktSimpleInterpolation "\v\$\h\w*" contained | ||
82 | syn region ktComplexInterpolation matchgroup=ktComplexInterpolationBrace start="\v\$\{" end="\v\}" contains=ALLBUT,ktSimpleInterpolation,ktTodo,ktSpecialCharError,ktSpecialChar,ktDocTag,ktDocTagParam | ||
83 | |||
84 | syn match ktNumber "\v<\d+[_[:digit:]]*(uL?|UL?|[LFf])?" | ||
85 | syn match ktNumber "\v<0[Xx]\x+[_[:xdigit:]]*(uL?|UL?|L)?" | ||
86 | syn match ktNumber "\v<0[Bb][01]+[_01]*(uL?|UL?|L)?" | ||
87 | syn match ktFloat "\v<\d*(\d[eE][-+]?\d+|\.\d+([eE][-+]?\d+)?)[Ff]?" | ||
88 | |||
89 | syn match ktEscapedName "\v`.*`" | ||
90 | |||
91 | syn match ktExclExcl "!!" | ||
92 | syn match ktArrow "->" | ||
93 | |||
94 | hi def link ktStatement Statement | ||
95 | hi def link ktConditional Conditional | ||
96 | hi def link ktRepeat Repeat | ||
97 | hi def link ktOperator Operator | ||
98 | hi def link ktKeyword Keyword | ||
99 | hi def link ktException Exception | ||
100 | hi def link ktReservedKeyword Error | ||
101 | |||
102 | hi def link ktInclude Include | ||
103 | |||
104 | hi def link ktType Type | ||
105 | hi def link ktModifier StorageClass | ||
106 | hi def link ktStructure Structure | ||
107 | hi def link ktTypedef Typedef | ||
108 | |||
109 | hi def link ktBoolean Boolean | ||
110 | hi def link ktConstant Constant | ||
111 | |||
112 | hi def link ktTodo Todo | ||
113 | hi def link ktShebang Comment | ||
114 | hi def link ktLineComment Comment | ||
115 | hi def link ktComment Comment | ||
116 | hi def link ktCommentMatchGroup Comment | ||
117 | hi def link ktDocComment Comment | ||
118 | hi def link ktDocTag Special | ||
119 | hi def link ktDocTagParam Identifier | ||
120 | |||
121 | hi def link ktSpecialChar SpecialChar | ||
122 | hi def link ktSpecialCharError Error | ||
123 | hi def link ktString String | ||
124 | hi def link ktCharacter Character | ||
125 | |||
126 | hi def link ktAnnotation Identifier | ||
127 | hi def link ktLabel Identifier | ||
128 | |||
129 | hi def link ktSimpleInterpolation Identifier | ||
130 | hi def link ktComplexInterpolationBrace Identifier | ||
131 | |||
132 | hi def link ktNumber Number | ||
133 | hi def link ktFloat Float | ||
134 | |||
135 | hi def link ktExclExcl Special | ||
136 | hi def link ktArrow Structure | ||
137 | |||
138 | let b:current_syntax = 'kotlin' | ||
139 | |||
diff --git a/syntax/proto.vim b/syntax/proto.vim new file mode 100644 index 0000000..8545631 --- /dev/null +++ b/syntax/proto.vim | |||
@@ -0,0 +1,106 @@ | |||
1 | " Protocol Buffers - Google's data interchange format | ||
2 | " Copyright 2008 Google Inc. All rights reserved. | ||
3 | " https://developers.google.com/protocol-buffers/ | ||
4 | " | ||
5 | " Redistribution and use in source and binary forms, with or without | ||
6 | " modification, are permitted provided that the following conditions are | ||
7 | " met: | ||
8 | " | ||
9 | " * Redistributions of source code must retain the above copyright | ||
10 | " notice, this list of conditions and the following disclaimer. | ||
11 | " * Redistributions in binary form must reproduce the above | ||
12 | " copyright notice, this list of conditions and the following disclaimer | ||
13 | " in the documentation and/or other materials provided with the | ||
14 | " distribution. | ||
15 | " * Neither the name of Google Inc. nor the names of its | ||
16 | " contributors may be used to endorse or promote products derived from | ||
17 | " this software without specific prior written permission. | ||
18 | " | ||
19 | " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
20 | " "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
21 | " LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
22 | " A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
23 | " OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
24 | " SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
25 | " LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
26 | " DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
27 | " THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
28 | " (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
29 | " OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
30 | |||
31 | " This is the Vim syntax file for Google Protocol Buffers. | ||
32 | " | ||
33 | " Usage: | ||
34 | " | ||
35 | " 1. cp proto.vim ~/.vim/syntax/ | ||
36 | " 2. Add the following to ~/.vimrc: | ||
37 | " | ||
38 | " augroup filetype | ||
39 | " au! BufRead,BufNewFile *.proto setfiletype proto | ||
40 | " augroup end | ||
41 | " | ||
42 | " Or just create a new file called ~/.vim/ftdetect/proto.vim with the | ||
43 | " previous lines on it. | ||
44 | |||
45 | if version < 600 | ||
46 | syntax clear | ||
47 | elseif exists("b:current_syntax") | ||
48 | finish | ||
49 | endif | ||
50 | |||
51 | syn case match | ||
52 | |||
53 | syn keyword pbTodo contained TODO FIXME XXX | ||
54 | syn cluster pbCommentGrp contains=pbTodo | ||
55 | |||
56 | syn keyword pbSyntax syntax import option | ||
57 | syn keyword pbStructure package message group oneof | ||
58 | syn keyword pbRepeat optional required repeated | ||
59 | syn keyword pbDefault default | ||
60 | syn keyword pbExtend extend extensions to max reserved | ||
61 | syn keyword pbRPC service rpc returns | ||
62 | |||
63 | syn keyword pbType int32 int64 uint32 uint64 sint32 sint64 | ||
64 | syn keyword pbType fixed32 fixed64 sfixed32 sfixed64 | ||
65 | syn keyword pbType float double bool string bytes | ||
66 | syn keyword pbTypedef enum | ||
67 | syn keyword pbBool true false | ||
68 | |||
69 | syn match pbInt /-\?\<\d\+\>/ | ||
70 | syn match pbInt /\<0[xX]\x+\>/ | ||
71 | syn match pbFloat /\<-\?\d*\(\.\d*\)\?/ | ||
72 | syn region pbComment start="\/\*" end="\*\/" contains=@pbCommentGrp | ||
73 | syn region pbComment start="//" skip="\\$" end="$" keepend contains=@pbCommentGrp | ||
74 | syn region pbString start=/"/ skip=/\\./ end=/"/ | ||
75 | syn region pbString start=/'/ skip=/\\./ end=/'/ | ||
76 | |||
77 | if version >= 508 || !exists("did_proto_syn_inits") | ||
78 | if version < 508 | ||
79 | let did_proto_syn_inits = 1 | ||
80 | command -nargs=+ HiLink hi link <args> | ||
81 | else | ||
82 | command -nargs=+ HiLink hi def link <args> | ||
83 | endif | ||
84 | |||
85 | HiLink pbTodo Todo | ||
86 | |||
87 | HiLink pbSyntax Include | ||
88 | HiLink pbStructure Structure | ||
89 | HiLink pbRepeat Repeat | ||
90 | HiLink pbDefault Keyword | ||
91 | HiLink pbExtend Keyword | ||
92 | HiLink pbRPC Keyword | ||
93 | HiLink pbType Type | ||
94 | HiLink pbTypedef Typedef | ||
95 | HiLink pbBool Boolean | ||
96 | |||
97 | HiLink pbInt Number | ||
98 | HiLink pbFloat Float | ||
99 | HiLink pbComment Comment | ||
100 | HiLink pbString String | ||
101 | |||
102 | delcommand HiLink | ||
103 | endif | ||
104 | |||
105 | let b:current_syntax = "proto" | ||
106 | |||