diff options
-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 | 1 | ||||
-rw-r--r-- | ftplugin/scheme.vim | 17 | ||||
-rw-r--r-- | ftplugin/tex.vim | 6 | ||||
-rw-r--r-- | ftplugin/typescript.vim | 7 | ||||
-rw-r--r-- | ftplugin/wiki.vim | 1 | ||||
-rw-r--r-- | init.vim | 224 | ||||
-rw-r--r-- | lua/lsp.lua | 59 | ||||
-rw-r--r-- | lua/treesitter.lua | 18 | ||||
-rw-r--r-- | plugin/help.vim | 16 | ||||
-rw-r--r-- | plugin/ignores.vim | 11 | ||||
-rw-r--r-- | plugin/maps.vim | 46 | ||||
-rw-r--r-- | plugin/statusline.vim | 139 | ||||
-rw-r--r-- | syntax/kotlin.vim | 139 | ||||
-rw-r--r-- | syntax/proto.vim | 106 |
24 files changed, 890 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..cfd90ec --- /dev/null +++ b/ftplugin/rust.vim | |||
@@ -0,0 +1 @@ | |||
setlocal ts=4 sts=4 sw=4 expandtab | |||
diff --git a/ftplugin/scheme.vim b/ftplugin/scheme.vim new file mode 100644 index 0000000..4af180c --- /dev/null +++ b/ftplugin/scheme.vim | |||
@@ -0,0 +1,17 @@ | |||
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 | ||
8 | |||
9 | setlocal makeprg=guile-lint | ||
10 | |||
11 | augroup SchemeLint | ||
12 | autocmd! | ||
13 | autocmd BufWritePost *.scm silent make! <afile> | silent redraw | ||
14 | autocmd QuickFixCmdPost [^l]* cwindow | ||
15 | augroup END | ||
16 | |||
17 | CocDisable | ||
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.vim b/init.vim new file mode 100644 index 0000000..8eb7889 --- /dev/null +++ b/init.vim | |||
@@ -0,0 +1,224 @@ | |||
1 | let &t_ZM = "\e[3m" | ||
2 | |||
3 | call plug#begin('~/.local/share/nvim/plugged') | ||
4 | |||
5 | Plug 'airblade/vim-gitgutter' | ||
6 | Plug 'godlygeek/tabular' | ||
7 | Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | ||
8 | Plug 'junegunn/fzf.vim' | ||
9 | Plug 'vimwiki/vimwiki' | ||
10 | |||
11 | " tpope | ||
12 | Plug 'tpope/vim-repeat' | ||
13 | Plug 'tpope/vim-surround' | ||
14 | Plug 'tpope/vim-unimpaired' | ||
15 | Plug 'tpope/vim-fugitive' | ||
16 | |||
17 | " syntax and friends | ||
18 | Plug 'rust-lang/rust.vim', {'for': 'rust'} | ||
19 | Plug 'lervag/vimtex', {'for': 'tex'} | ||
20 | Plug 'neovimhaskell/haskell-vim', {'for': ['haskell', 'cabal']} | ||
21 | Plug 'elmcast/elm-vim' | ||
22 | Plug 'LnL7/vim-nix' | ||
23 | |||
24 | " my stuff | ||
25 | Plug 'git@ferrn:vim/vim-colors-plain' | ||
26 | Plug 'git@ferrn:vim/better-text-objs' | ||
27 | |||
28 | " nvim only | ||
29 | Plug 'hrsh7th/nvim-compe' | ||
30 | Plug 'neovim/nvim-lspconfig' | ||
31 | Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} | ||
32 | |||
33 | call plug#end() | ||
34 | |||
35 | |||
36 | " augroups | ||
37 | |||
38 | augroup plaintext | ||
39 | autocmd! | ||
40 | autocmd FileType text,markdown setlocal ts=2 sts=2 sw=2 expandtab textwidth=60 | ||
41 | augroup END | ||
42 | |||
43 | augroup webdev | ||
44 | autocmd! | ||
45 | autocmd FileType less,css,html,js?,ts? setlocal ts=2 sts=2 sw=2 expandtab | ||
46 | autocmd FileType less,css,html nnoremap <Leader>s viB:sort<cr> | ||
47 | augroup END | ||
48 | |||
49 | augroup restorecursor | ||
50 | autocmd BufReadPost * | ||
51 | \ if line("'\"") > 1 && line("'\"") <= line("$") | | ||
52 | \ execute "normal! g`\"" | | ||
53 | \ endif | ||
54 | augroup END | ||
55 | |||
56 | augroup vimrc-incsearch-highlight | ||
57 | autocmd! | ||
58 | autocmd CmdlineEnter /,\? :set hlsearch | ||
59 | autocmd CmdlineLeave /,\? :set nohlsearch | ||
60 | augroup END | ||
61 | |||
62 | augroup fzfstatus | ||
63 | if has('nvim') && !exists('g:fzf_layout') | ||
64 | autocmd! FileType fzf | ||
65 | autocmd FileType fzf set laststatus=0 noshowmode noruler | ||
66 | \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler | ||
67 | endif | ||
68 | augroup END | ||
69 | |||
70 | " general settings | ||
71 | set nobackup | ||
72 | set nowritebackup | ||
73 | set noswapfile " get rid of swapfiles everywhere | ||
74 | set dir=/tmp | ||
75 | |||
76 | syntax on | ||
77 | |||
78 | set omnifunc=syntaxcomplete#Complete | ||
79 | set completefunc=LanguageClient#complete | ||
80 | set list | ||
81 | filetype off | ||
82 | filetype plugin indent on | ||
83 | set laststatus=2 | ||
84 | set nowrap | ||
85 | set noshowmode | ||
86 | set listchars=tab:┊\ ,nbsp:␣,trail:·,extends:>,precedes:< | ||
87 | set fillchars=vert:\│,stl:\ ,stlnc:\ | ||
88 | set ignorecase | ||
89 | set smartcase | ||
90 | set sidescroll=40 | ||
91 | set incsearch | ||
92 | set undofile | ||
93 | set undodir=~/tmp | ||
94 | set path+=** | ||
95 | set backspace=indent,eol,start | ||
96 | set hidden | ||
97 | set wildmenu | ||
98 | set complete=.,w,b,i,u,t, | ||
99 | set background=dark | ||
100 | set mouse=a | ||
101 | set conceallevel=0 | ||
102 | set nonumber | ||
103 | set grepprg=rg\ --vimgrep\ --no-heading | ||
104 | set grepformat=%f:%l:%c:%m,%f:%l:%m | ||
105 | set cmdheight=2 | ||
106 | set shortmess+=c | ||
107 | set updatetime=300 | ||
108 | set signcolumn=yes | ||
109 | set inccommand=split | ||
110 | set showmatch | ||
111 | set diffopt+=vertical | ||
112 | set completeopt=menuone,noinsert,noselect | ||
113 | |||
114 | let g:netrw_browsex_viewer= "xdg-open" | ||
115 | |||
116 | colorscheme plain | ||
117 | |||
118 | set shiftwidth=4 " indent = 4 spaces | ||
119 | set expandtab | ||
120 | set tabstop=4 " tab = 4 spaces | ||
121 | set softtabstop=4 " backspace through spaces | ||
122 | |||
123 | " Functions | ||
124 | function! GetTabber() " a lil function that integrates well with Tabular.vim | ||
125 | let c = nr2char(getchar()) | ||
126 | :execute 'Tabularize /' . c | ||
127 | endfunction | ||
128 | |||
129 | " Ugh | ||
130 | command! WQ wq | ||
131 | command! Wq wq | ||
132 | command! Wqa wqa | ||
133 | command! WQa wqa | ||
134 | command! W w | ||
135 | command! Q q | ||
136 | |||
137 | " abbreviations | ||
138 | abclear | ||
139 | iab #i #include | ||
140 | iab #d #define | ||
141 | cab dst put =strftime('%d %a, %b %Y')<cr> | ||
142 | cab vg vimgrep | ||
143 | cab vga vimgrepadd | ||
144 | cab bfd bufdo | ||
145 | |||
146 | " man pages | ||
147 | let g:ft_man_open_mode = 'tab' | ||
148 | |||
149 | let g:gitgutter_override_sign_column_highlight = 0 | ||
150 | let g:gitgutter_sign_added = '+' | ||
151 | let g:gitgutter_sign_modified = '~' | ||
152 | let g:gitgutter_sign_removed = '-' | ||
153 | let g:gitgutter_sign_removed_first_line = '-' | ||
154 | let g:gitgutter_sign_modified_removed = '~' | ||
155 | |||
156 | let g:fzf_colors = | ||
157 | \ { 'fg': ['fg', 'Noise'], | ||
158 | \ 'bg': ['bg', 'Noise'], | ||
159 | \ 'hl': ['fg', 'Statement'], | ||
160 | \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], | ||
161 | \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], | ||
162 | \ 'hl+': ['fg', 'Statement'], | ||
163 | \ 'info': ['fg', 'PreProc'], | ||
164 | \ 'border': ['fg', 'Ignore'], | ||
165 | \ 'prompt': ['fg', 'Conditional'], | ||
166 | \ 'pointer': ['fg', 'Exception'], | ||
167 | \ 'marker': ['fg', 'Keyword'], | ||
168 | \ 'spinner': ['fg', 'Label'], | ||
169 | \ 'header': ['fg', 'Comment'] } | ||
170 | let g:fzf_layout = { 'down': '40%' } | ||
171 | let g:fzf_preview_window = [] | ||
172 | |||
173 | highlight GitGutterAdd ctermfg=8 | ||
174 | highlight GitGutterChange ctermfg=8 | ||
175 | highlight GitGutterDelete ctermfg=8 | ||
176 | |||
177 | let g:rustfmt_autosave = 1 | ||
178 | |||
179 | let g:latex_view_general_viewer = "zathura" | ||
180 | let g:vimtex_view_method = "zathura" | ||
181 | let g:tex_flavor = 'latex' | ||
182 | |||
183 | let g:elm_setup_keybindings = 0 | ||
184 | |||
185 | let g:completion_enable_auto_hover = 0 | ||
186 | let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy', 'all'] | ||
187 | let g:completion_trigger_on_delete = 1 | ||
188 | |||
189 | let g:compe = {} | ||
190 | let g:compe.enabled = v:true | ||
191 | let g:compe.autocomplete = v:true | ||
192 | let g:compe.debug = v:false | ||
193 | let g:compe.min_length = 1 | ||
194 | let g:compe.preselect = 'enable' | ||
195 | let g:compe.throttle_time = 80 | ||
196 | let g:compe.source_timeout = 200 | ||
197 | let g:compe.incomplete_delay = 400 | ||
198 | let g:compe.max_abbr_width = 100 | ||
199 | let g:compe.max_kind_width = 100 | ||
200 | let g:compe.max_menu_width = 100 | ||
201 | let g:compe.documentation = v:true | ||
202 | |||
203 | let g:compe.source = {} | ||
204 | let g:compe.source.path = v:true | ||
205 | let g:compe.source.buffer = v:true | ||
206 | let g:compe.source.calc = v:true | ||
207 | let g:compe.source.vsnip = v:false | ||
208 | let g:compe.source.nvim_lsp = v:true | ||
209 | let g:compe.source.nvim_lua = v:false | ||
210 | let g:compe.source.spell = v:true | ||
211 | let g:compe.source.tags = v:true | ||
212 | let g:compe.source.snippets_nvim = v:false | ||
213 | let g:compe.source.treesitter = v:true | ||
214 | let g:compe.source.omni = v:true | ||
215 | |||
216 | sign define LspDiagnosticsSignError text=× texthl=LspDiagnosticsSignError linehl= numhl= | ||
217 | sign define LspDiagnosticsSignWarning text=\! texthl=LspDiagnosticsSignWarning linehl= numhl= | ||
218 | sign define LspDiagnosticsSignInformation text=i texthl=LspDiagnosticsSignInformation linehl= numhl= | ||
219 | sign define LspDiagnosticsSignHint text=\~ texthl=LspDiagnosticsSignHint linehl= numhl= | ||
220 | |||
221 | lua << EOF | ||
222 | require 'lsp' | ||
223 | require 'treesitter' | ||
224 | EOF | ||
diff --git a/lua/lsp.lua b/lua/lsp.lua new file mode 100644 index 0000000..f921c70 --- /dev/null +++ b/lua/lsp.lua | |||
@@ -0,0 +1,59 @@ | |||
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 opts = { noremap=true, silent=true } | ||
10 | buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) | ||
11 | buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) | ||
12 | buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) | ||
13 | buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) | ||
14 | buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) | ||
15 | buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) | ||
16 | buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) | ||
17 | buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) | ||
18 | buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) | ||
19 | buf_set_keymap('n', '[g', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts) | ||
20 | buf_set_keymap('n', ']g', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts) | ||
21 | buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) | ||
22 | |||
23 | -- Set some keybinds conditional on server capabilities | ||
24 | if client.resolved_capabilities.document_formatting then | ||
25 | buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) | ||
26 | elseif client.resolved_capabilities.document_range_formatting then | ||
27 | buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts) | ||
28 | end | ||
29 | end | ||
30 | |||
31 | local servers = { "hls", "rnix", "bashls", "pyls" } | ||
32 | for _, lsp in ipairs(servers) do | ||
33 | nvim_lsp[lsp].setup { on_attach = on_attach } | ||
34 | end | ||
35 | |||
36 | local capabilities = vim.lsp.protocol.make_client_capabilities() | ||
37 | capabilities.textDocument.completion.completionItem.snippetSupport = true | ||
38 | |||
39 | nvim_lsp.rust_analyzer.setup { | ||
40 | capabilities = capabilities, | ||
41 | settings = { | ||
42 | ["rust-analyzer"] = { | ||
43 | procMacro = { | ||
44 | enable = true | ||
45 | }, | ||
46 | }, | ||
47 | }, | ||
48 | } | ||
49 | |||
50 | nvim_lsp.ccls.setup { | ||
51 | init_options = { | ||
52 | index = { | ||
53 | threads = 0; | ||
54 | }; | ||
55 | clang = { | ||
56 | excludeArgs = { "-frounding-math"} ; | ||
57 | }; | ||
58 | } | ||
59 | } | ||
diff --git a/lua/treesitter.lua b/lua/treesitter.lua new file mode 100644 index 0000000..d503b46 --- /dev/null +++ b/lua/treesitter.lua | |||
@@ -0,0 +1,18 @@ | |||
1 | require'nvim-treesitter.configs'.setup { | ||
2 | highlight = { | ||
3 | enable = true, | ||
4 | |||
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 | } | ||
diff --git a/plugin/help.vim b/plugin/help.vim new file mode 100644 index 0000000..9e1c998 --- /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 = 1 | ||
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..188cb69 --- /dev/null +++ b/plugin/maps.vim | |||
@@ -0,0 +1,46 @@ | |||
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 <Leader>l : Lines<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>w : MtaJumpToOtherTag<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 | cmap w!! %!sudo -S tee > /dev/null % | ||
30 | |||
31 | " visual | ||
32 | vnoremap > >gv | ||
33 | vnoremap < <gv | ||
34 | |||
35 | " operator-pending | ||
36 | onoremap ax a` | ||
37 | onoremap ix i` | ||
38 | |||
39 | " visual block | ||
40 | xnoremap + g<C-a> | ||
41 | xnoremap - g<C-x> | ||
42 | |||
43 | " completions | ||
44 | inoremap <silent><expr> <C-Space> compe#complete() | ||
45 | inoremap <silent><expr> <CR> compe#confirm('<CR>') | ||
46 | inoremap <silent><expr> <C-e> compe#close('<C-e>') | ||
diff --git a/plugin/statusline.vim b/plugin/statusline.vim new file mode 100644 index 0000000..5465d40 --- /dev/null +++ b/plugin/statusline.vim | |||
@@ -0,0 +1,139 @@ | |||
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! GitBranch() | ||
43 | return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") | ||
44 | endfunction | ||
45 | |||
46 | function! StatuslineGit() | ||
47 | let l:branchname = GitBranch() | ||
48 | return strlen(l:branchname) > 0?l:branchname.' ':'' | ||
49 | endfunction | ||
50 | |||
51 | function! ReadOnly() abort | ||
52 | if !&modifiable && &readonly | ||
53 | return ' RO' | ||
54 | elseif &modifiable && &readonly | ||
55 | return 'RO' | ||
56 | elseif !&modifiable && !&readonly | ||
57 | return '' | ||
58 | else | ||
59 | return '' | ||
60 | endif | ||
61 | endfunction | ||
62 | |||
63 | function! Filepath() abort | ||
64 | let l:basename = expand('%:h') | ||
65 | let l:filename = expand('%:t') | ||
66 | let l:extension = expand('%:e') | ||
67 | let l:prefix = (l:basename ==# '' || l:basename ==# '.') ? | ||
68 | \ '' : substitute(l:basename . '/', '\C^' . $HOME, '~', '') | ||
69 | |||
70 | if empty(l:prefix) && empty(l:filename) | ||
71 | return printf('%%4*%%f%%*%s %%m%%*', '%4*') | ||
72 | elseif empty(l:prefix) | ||
73 | return printf('%%4*%%f%%*%s %%m%%*', '%6*') | ||
74 | else | ||
75 | return printf('%%4*%s%%*%s%s%%*', l:prefix, &modified ? '%6*' : '%4*', l:filename) | ||
76 | endif | ||
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.lsp.diagnostic.get_count(0, [[Error]])") | ||
84 | let warns = luaeval("vim.lsp.diagnostic.get_count(0, [[Warning]])") | ||
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.='%6*·%*' . ' ' | ||
109 | let l:line.='%7*%{StatuslineGit()}' | ||
110 | let l:line.='%<' | ||
111 | let l:line.=Filepath() | ||
112 | |||
113 | let l:line.='%5*' | ||
114 | let l:line.=' %{ReadOnly()} %w%*' | ||
115 | let l:line.='%9* %=%*' | ||
116 | |||
117 | let l:line.=' ' . '%7*%l,%c%*' . ' ' | ||
118 | let l:line.=LinterStatus() | ||
119 | let l:line.='%4*'. &filetype | ||
120 | |||
121 | else | ||
122 | " inactive | ||
123 | let l:line.='%5*·%*' . ' ' | ||
124 | let l:line.='%#Blanks#' | ||
125 | let l:line.='%f %5*%m%*' | ||
126 | let l:line.='%#Blanks# %=%*' | ||
127 | endif | ||
128 | |||
129 | let l:line.='%*' | ||
130 | |||
131 | return l:line | ||
132 | endfunction | ||
133 | |||
134 | set statusline=%!StatusLine('active') | ||
135 | augroup MyStatusLine | ||
136 | autocmd! | ||
137 | autocmd WinEnter * setl statusline=%!StatusLine('active') | ||
138 | autocmd WinLeave * setl statusline=%!StatusLine('inactive') | ||
139 | augroup END | ||
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 | |||