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