diff options
| -rw-r--r-- | .vim/UltiSnips/all.snippets | 10 | ||||
| -rw-r--r-- | .vim/UltiSnips/markdown.snippets | 4 | ||||
| -rw-r--r-- | .vim/UltiSnips/tex.snippets | 8 | ||||
| -rw-r--r-- | .vim/ftplugin/go.lua | 16 | ||||
| -rw-r--r-- | .vim/ftplugin/markdown.lua | 2 | ||||
| -rw-r--r-- | .vim/ftplugin/tex.lua | 1 | ||||
| -rw-r--r-- | .vim/init.lua | 83 | ||||
| -rw-r--r-- | .vim/lua/colors.lua | 311 | ||||
| -rw-r--r-- | .vim/lua/colors.lua.in | 298 | ||||
| -rw-r--r-- | .vim/lua/conf/colors.lua | 9 | ||||
| -rw-r--r-- | .vim/lua/conf/diagnostic.lua | 20 | ||||
| -rw-r--r-- | .vim/lua/hardmode.lua | 62 | ||||
| -rw-r--r-- | .vim/lua/misc.lua | 36 | ||||
| -rw-r--r-- | .vim/lua/plugins.lua | 301 | ||||
| -rw-r--r-- | .vim/lua/plugins/_completion.lua | 48 | ||||
| -rw-r--r-- | .vim/lua/plugins/_lightbulb.lua | 19 | ||||
| -rw-r--r-- | .vim/lua/plugins/_lsp.lua | 213 | ||||
| -rw-r--r-- | .vim/lua/plugins/_markdown.lua | 21 | ||||
| -rw-r--r-- | .vim/lua/plugins/_neuron.lua | 15 | ||||
| -rw-r--r-- | .vim/lua/plugins/_telescope.lua | 181 | ||||
| -rw-r--r-- | .vim/lua/plugins/_treesitter.lua | 42 | ||||
| -rw-r--r-- | .vim/lua/plugins/_ultisnips.lua | 2 | ||||
| -rw-r--r-- | .vim/lua/utils.lua | 50 | ||||
| -rw-r--r-- | .vim/plugin/packer_compiled.vim | 38 |
24 files changed, 1305 insertions, 485 deletions
diff --git a/.vim/UltiSnips/all.snippets b/.vim/UltiSnips/all.snippets index 0b9cf72..0848883 100644 --- a/.vim/UltiSnips/all.snippets +++ b/.vim/UltiSnips/all.snippets @@ -14,9 +14,19 @@ snippet today "YYYY-MM-DD" `date +%Y-%m-%d` endsnippet +snippet todaytime "YYYY-MM-DDThh:mm" +`date +%Y-%m-%dT%H:%M` +endsnippet + snippet ok "✔" ✔ endsnippet snippet bad "✘" ✘ endsnippet +snippet arrow "→" +→ +endsnippet +snippet arrowb "⇒" +⇒ +endsnippet diff --git a/.vim/UltiSnips/markdown.snippets b/.vim/UltiSnips/markdown.snippets index 34b1c40..641e77c 100644 --- a/.vim/UltiSnips/markdown.snippets +++ b/.vim/UltiSnips/markdown.snippets @@ -37,3 +37,7 @@ snippet todoKV "todo: krankenversicherung" - [ ] filings - [ ] refund endsnippet + +snippet furigana +$\stackrel{\text{$2}}{\text{$1}}$$0 +endsnippet diff --git a/.vim/UltiSnips/tex.snippets b/.vim/UltiSnips/tex.snippets index abaf5c6..bc92b06 100644 --- a/.vim/UltiSnips/tex.snippets +++ b/.vim/UltiSnips/tex.snippets @@ -36,7 +36,8 @@ snippet latex "\documentclass{report}" \usepackage{polyglossia} % font \usepackage{fontspec} -\setmainfont{Luciole} +\setmainfont{IBM Plex Sans} +\setmonofont{IBM Plex Mono} \title{$1} \author{Robert Günzler} @@ -59,7 +60,8 @@ snippet brief "\documentclass{dinbrief}" \setdefaultlanguage[spelling=new]{german} % font \usepackage{fontspec} -\setmainfont{Luciole} +\setmainfont{IBM Plex Sans} +\setmonofont{IBM Plex Mono} % dinbrief options \nowindowtics \nowindowrules @@ -89,7 +91,7 @@ snippet brief "\documentclass{dinbrief}" $0 \vspace{10truemm} -\closing[\protect\setsign]{${3:Mit freundlichen Grüßen,}} +\closing[\protect\setsign]{${3:Mit freundlichen Grüßen}} \end{letter} \end{document} endsnippet diff --git a/.vim/ftplugin/go.lua b/.vim/ftplugin/go.lua deleted file mode 100644 index 74d6bf1..0000000 --- a/.vim/ftplugin/go.lua +++ /dev/null @@ -1,16 +0,0 @@ -local g = vim.g - --- local eval = vim.api.nvim_eval --- if eval("exists('g:loaded_neomake')") then --- g.neomake_go_build_maker = { --- exe = 'go', --- args = 'build', --- append_file = 0, --- } --- g.neomake_go_enabled_makers = { 'go', 'golangci_lint' } --- end - -require('utils').augroup2 { - neoformat_go = {{ 'BufWritePre', '*.go', - 'try | undojoin | Neoformat | catch | echoerr Neoformat\\ failed | endtry' }} -} diff --git a/.vim/ftplugin/markdown.lua b/.vim/ftplugin/markdown.lua deleted file mode 100644 index e4647b3..0000000 --- a/.vim/ftplugin/markdown.lua +++ /dev/null @@ -1,2 +0,0 @@ - -require('utils').opt('w', 'foldlevel', 2) diff --git a/.vim/ftplugin/tex.lua b/.vim/ftplugin/tex.lua deleted file mode 100644 index 723d992..0000000 --- a/.vim/ftplugin/tex.lua +++ /dev/null @@ -1 +0,0 @@ -vim.bo.makeprg = 'latexmk -1 -n %' diff --git a/.vim/init.lua b/.vim/init.lua index 62cb9a3..e25acf7 100644 --- a/.vim/init.lua +++ b/.vim/init.lua @@ -3,6 +3,9 @@ local fn = vim.fn local g = vim.g local o = vim.o +local nnoremap = require('astronauta.keymap').nnoremap +local inoremap = require('astronauta.keymap').tnoremap + g.mapleader = ' ' -- <leader> key to <space> g.maplocalleader = '\\' @@ -12,6 +15,7 @@ local u = require('utils') -- OPTIONS -- {{{ cmd('set clipboard+=unnamedplus') +u.opt('o', 'exrc', true) u.opt('o', 'title', true) u.opt('o', 'shiftround', true) u.opt('o', 'termguicolors', true) @@ -41,36 +45,45 @@ u.opt('o', 'showcmd', false) u.opt('o', 'laststatus', 2) u.opt('o', 'ruler', true) u.opt('o', 'mouse', 'a') -u.opt('o', 'spell', false) +u.opt('o', 'spell', true) u.opt('o', 'lazyredraw', true) u.opt('o', 'backspace', 'indent,eol,start') u.opt('o', 'undolevels', 1000) u.opt('o', 'updatetime', 300) u.opt('o', 'signcolumn', 'yes') + +u.opt('w', 'conceallevel', 2) +u.opt('w', 'concealcursor', 'cv') + +u.opt('o', 'expandtab', true) -- }}} -- COLORS -- {{{ -g.nihoncolors_transparent_background = true -cmd('colorscheme nihoncolors') +-- g.nihoncolors_transparent_background = true +cmd('colorscheme lush') -- }}} -- KEY BINDS -- {{{ -u.map('n', 'Q', ':quitall', { silent = false }) -u.map('n', 'gb', ':bnext<CR>') -u.map('n', 'gB', ':bprevious<CR>') +nnoremap { 'Q', function() cmd [[ quitall ]] end, silent = false } +nnoremap { 'gb', function() cmd [[ bnext ]] end } +nnoremap { 'gB', function() cmd [[ bprevious ]] end } + -- terminal u.map('t', '<ESC>', '<C-\\><C-n>') u.map('t', '<Leader>qq', '<C-\\><C-n>:bdelete!<CR>') --- completion -u.map('i', '<C-n>', 'pumvisible() ? "\\<C-n>" : completion#trigger_completion()', { expr = true }) -u.map('i', '<C-p>', 'pumvisible() ? "\\<C-n>" : completion#trigger_completion()', { expr = true }) -u.map('i', '<C-j>', '<cmd>lua require("completion.source").nextCompletion()<CR>') -u.map('i', '<C-k>', '<cmd>lua require("completion.source").prevCompletion()<CR>') + +nnoremap { 'gf', function() require('misc').open_under_cursor('open') end } +nnoremap { 'gF', function() require('misc').open_under_cursor() end } +nnoremap { 'gx', function() require('misc').open_under_cursor('url-launcher') end } +nnoremap { 'gGw', function() require('misc').word_under_cursor(function(s) require('telescope.builtin.files').grep_string({ search = s }) end) end } +nnoremap { 'gGe', function() require('misc').expr_under_cursor(function(s) require('telescope.builtin.files').grep_string({ search = s }) end) end } +nnoremap { 'gGf', function() require('misc').file_under_cursor(function(s) require('telescope.builtin.files').grep_string({ search = s }) end) end } -- }}} -- AUTO GROUPS -- {{{ -u.augroup('yank_highlight', {{'TextYankPost', '*', 'silent! lua require("vim.highlight").on_yank()'}}) -u.augroup('diagnostics', {{'CursorHold', '*', 'lua vim.lsp.diagnostic.show_line_diagnostics()'}}) +u.augroup2 { + yank_highlight = {{ 'TextYankPost', '*', 'silent! lua require("vim.highlight").on_yank()' }} +} -- }}} -- USER COMMANDS -- {{{ @@ -82,26 +95,32 @@ u.def('SortLine', 'call setline(".", join(sort(split(getline("."), " ")), " "))' vim.api.nvim_command('hi StatusLineInsert guifg=#00ffff guibg=None') vim.api.nvim_command('hi StatusLineCommand guifg=#ff3300 guibg=None') statusline = function() - local sl = '' - -- left - sl = sl .. statusline_color(vim.fn.mode()) - sl = sl .. [[ ⢷ %<%F %-m %-r ]] - -- right - sl = sl .. [[ %= %l:%v %y ]] - return sl + local sl = '' + -- left + sl = sl .. statusline_color(vim.fn.mode()) + sl = sl .. [[ ⢷ %<%F %-m %-r ]] + -- right + sl = sl .. [[ %= %l:%v %y ]] + return sl end statusline_color = function(mode) - if mode == 'i' then - return '%#StatusLineInsert#' - elseif mode == 'c' then - return '%#StatusLineCommand#' - elseif mode == 'v' or mode == 'V' or mode == '' then - return '%#Visual#' - elseif mode == 'R' or mode == 'Rv' then - return '%1*' - -- return '%#Include#' - else - return '%1*' - end + if mode == 'i' then + return '%#StatusLineInsert#' + elseif mode == 'c' then + return '%#StatusLineCommand#' + elseif mode == 'v' or mode == 'V' or mode == '' then + return '%#Visual#' + elseif mode == 'R' or mode == 'Rv' then + return '%1*' + -- return '%#Include#' + else + return '%1*' + end end -- }}} + +-- source .nvimrc if it exists +local local_vimrc = vim.fn.getcwd()..'/.nvimrc' +if vim.loop.fs_stat(local_vimrc) then + vim.cmd('source '..local_vimrc) +end diff --git a/.vim/lua/colors.lua b/.vim/lua/colors.lua new file mode 100644 index 0000000..a78fe61 --- /dev/null +++ b/.vim/lua/colors.lua @@ -0,0 +1,311 @@ + +local lush = require('lush') +local hsl = lush.hsl + +local p = { + normal = { + black = '#080808', -- 00 + red = '#cb1b45', -- 01 + green = '#227d51', -- 02 + yellow = '#f7d94c', -- 03 + blue = '#005caf', -- 04 + magenta = '#986db2', -- 05 + cyan = '#33a6b8', -- 06 + white = '#bdc0ba', -- 07 + }, + bright = { + black = '#0c0c0c', -- 08 + red = '#db4d6d', -- 09 + green = '#5dac81', -- 11 + yellow = '#fad689', -- 12 + blue = '#7b90d2', -- 13 + magenta = '#b28fce', -- 14 + cyan = '#a5dee4', -- 15 + white = '#fffffb', -- 16 + }, + dim = { + black = '#080808', + red = '#9f353a', + green = '#0f4c3a', + yellow = '#6c6024', + blue = '#113285', + magenta = '#4a225d', + cyan = '#0d5661', + white = '#4f4f48', + }, +} + +-- terminal buffer colors {{{ +-- TODO just let it use the default, for now... +-- let g:terminal_color_0 = color00[0] +-- let g:terminal_color_1 = color01[0] +-- let g:terminal_color_2 = color02[0] +-- let g:terminal_color_3 = color03[0] +-- let g:terminal_color_4 = color04[0] +-- let g:terminal_color_5 = color05[0] +-- let g:terminal_color_6 = color06[0] +-- let g:terminal_color_7 = color07[0] +-- let g:terminal_color_8 = color08[0] +-- let g:terminal_color_9 = color09[0] +-- let g:terminal_color_10 = color10[0] +-- let g:terminal_color_11 = color11[0] +-- let g:terminal_color_12 = color12[0] +-- let g:terminal_color_13 = color13[0] +-- let g:terminal_color_14 = color14[0] +-- let g:terminal_color_15 = color15[0] +-- }}} + +return lush(function() + return { + Underlined { gui = 'underline' }, -- (preferred) text that stands out, HTML links + Bold { gui = 'bold' }, + Italic { gui = 'italic' }, + Reverse { gui = 'reverse' }, + + ColorColumn { bg = hsl(p.dim.white).darken(40) }, -- used for the columns set with 'colorcolumn' + Conceal { gui = 'none' }, -- placeholder characters substituted for concealed text (see 'conceallevel') + Cursor { Reverse }, -- character under the cursor + lCursor { Cursor }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') + CursorIM { Cursor }, -- like Cursor, but used when in IME mode |CursorIM| + CursorColumn { ColorColumn }, -- Screen-column at the cursor, when 'cursorcolumn' is set. + CursorLine { ColorColumn }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. + -- Directory { }, -- directory names (and other special names in listings) + DiffAdd { fg = hsl(p.bright.green) }, -- diff mode: Added line |diff.txt| + DiffChange { fg = hsl(p.bright.cyan) }, -- diff mode: Changed line |diff.txt| + DiffDelete { fg = hsl(p.bright.red) }, -- diff mode: Deleted line |diff.txt| + DiffText { fg = hsl(p.normal.white) }, -- diff mode: Changed text within a changed line |diff.txt| + EndOfBuffer { fg = hsl(p.bright.blue) }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. + TermCursor { Cursor }, -- cursor in a focused terminal + TermCursorNC { Cursor }, -- cursor in an unfocused terminal + ErrorMsg { Bold, fg = hsl(p.bright.white), bg = hsl(p.dim.red) }, -- error messages on the command line + VertSplit { fg = hsl(p.dim.white), bg = 'none' }, -- the column separating vertically split windows + Folded { fg = hsl(p.bright.magenta), bg = 'none' }, -- line used for closed folds + FoldColumn { Folded }, -- 'foldcolumn' + SignColumn { gui = 'none' }, -- column where |signs| are displayed + Search { Bold, fg = hsl(p.normal.black), bg = hsl(p.bright.white) }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. + IncSearch { Search }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" + Substitute { fg = hsl(p.normal.blue) }, -- |:substitute| replacement text highlighting + LineNr { fg = hsl(p.dim.white) }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + CursorLineNr { Cursor }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + MatchParen { fg = hsl(p.bright.white), bg = hsl(p.dim.black), gui = 'underline' }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| + ModeMsg { fg = hsl(p.normal.yellow) }, -- 'showmode' message (e.g., "-- INSERT -- ") + -- MsgArea { }, -- Area for messages and cmdline + -- MsgSeparator { }, -- Separator for scrolled messages, `msgsep` flag of 'display' + MoreMsg { ModeMsg }, -- |more-prompt| + NonText { EndOfBuffer }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. + Normal { fg = hsl(p.bright.white) }, -- normal text + NormalFloat { Normal, bg = hsl(p.normal.black).lighten(6) }, -- Normal text in floating windows. + NormalNC { Normal }, -- normal text in non-current windows + Pmenu { NormalFloat }, -- Popup menu: normal item. + PmenuSel { Pmenu, gui = 'reverse' }, -- Popup menu: selected item. + PmenuSbar { bg = 'none' }, -- Popup menu: scrollbar. + PmenuThumb { bg = hsl(p.bright.white) }, -- Popup menu: Thumb of the scrollbar. + Question { fg = hsl(p.normal.green) }, -- |hit-enter| prompt and yes/no questions + -- QuickFixLine { }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. + SpecialKey { fg = hsl(p.dim.white) }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| SpellBad Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. SpellCap Word that should start with a capital. |spell| Combined with the highlighting used otherwise. SpellLocal Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. + -- SpellRare { }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. + StatusLine { fg = hsl(p.normal.white), bg = hsl(p.normal.black) }, -- status line of current window + StatusLineNC { fg = hsl(p.dim.white) }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + TabLine { fg = hsl(p.dim.white) }, -- tab pages line, not active tab page label + TabLineFill { StatusLineNC }, -- tab pages line, where there are no labels + TabLineSel { fg = hsl(p.bright.white), gui = 'bold' }, -- tab pages line, active tab page label + Title { fg = hsl(p.bright.blue) }, -- titles for output from ":set all", ":autocmd" etc. + Visual { fg = hsl(p.bright.white), bg = hsl(p.normal.magenta) }, -- Visual mode selection + VisualNOS { Visual }, -- Visual mode selection when vim is "Not Owning the Selection". + WarningMsg { fg = hsl(p.normal.yellow) }, -- warning messages + Whitespace { fg = hsl(p.dim.white) }, -- "nbsp", "space", "tab" and "trail" in 'listchars' + WildMenu { bg = hsl(p.bright.black) }, -- current match in 'wildmenu' completion + + String { fg = hsl(p.normal.yellow) }, -- a string constant: "this is a string" + Character { String }, -- a character constant: 'c', '\n' + Number { fg = hsl(p.bright.red).lighten(20) }, -- a number constant: 234, 0xff + Float { Number }, -- a floating point constant: 2.3e10 + Boolean { Number }, -- a boolean constant: TRUE, false + + Constant { Normal, gui = 'bold' }, -- (preferred) any constant + Identifier { Normal }, -- (preferred) any variable name + Function { Normal }, -- function name (also: methods for classes) + Comment { Italic, fg = hsl(p.dim.white).lighten(30) }, + + Statement { fg = hsl(p.bright.blue) }, -- (preferred) any statement + Keyword { Statement }, -- any other keyword + Conditional { Keyword }, -- if, then, else, endif, switch, etc. + Repeat { Keyword }, -- for, do, while, etc. + Label { Keyword }, -- case, default, etc. + Operator { Keyword }, -- "sizeof", "+", "*", etc. + Exception { Keyword }, -- try, catch, throw + + PreProc { fg = hsl(p.normal.cyan) }, -- (preferred) generic Preprocessor + Include { PreProc }, -- preprocessor #include + Define { PreProc }, -- preprocessor #define + Macro { PreProc }, -- same as Define + PreCondit { PreProc }, -- preprocessor #if, #else, #endif, etc. + + Type { fg = hsl(p.bright.green) }, -- (preferred) int, long, char, etc. + StorageClass { Type }, -- static, register, volatile, etc. + Structure { Type }, -- struct, union, enum, etc. + Typedef { Type }, -- A typedef + + Special { fg = hsl(p.normal.yellow) }, -- (preferred) any special symbol + SpecialChar { Special }, -- special character in a constant + Tag { Special, gui = 'underline' }, -- you can use CTRL-] on this + Delimiter { Special }, -- character that needs attention + SpecialComment { fg = hsl(p.bright.cyan), gui = 'italic' }, -- special things inside a comment + Debug { Special }, -- debugging statements + + -- Ignore { }, -- (preferred) left blank, hidden |hl-Ignore| + Error { Bold, fg = hsl(p.normal.red) }, -- (preferred) any erroneous construct + Todo { Bold, fg = hsl(p.bright.yellow) }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX + + -- Lang specific {{{ + -- C {{{2 + cType { Type, gui = 'bold' }, + -- cFormat {}, + -- cStorageClass { Bold }, + + cBoolean { Boolean, gui = 'bold' }, + -- cCharacter {}, + cConstant { Constant, gui = 'bold' }, + -- cConditional { Bold }, + cSpecial { Bold }, + -- cDefine {}, + -- cNumber {}, + -- cPreCondit {}, + -- cRepeat {}, + -- cLabel { fg = hsl(p.dim.black), bg = hsl(p.dim.red) }, + -- cAnsiFunction { Bold }, + -- cAnsiName {}, + -- cDelimiter {}, + -- cBraces {}, + -- cIdentifier {}, + -- cSemiColon {}, + -- cOperator {}, + -- cStatement {}, + -- cTodo { Bold }, + cStructure { Bold }, + -- cCustomParen {}, + -- cCustomFunc {}, + -- cUserFunction { Function, gui = 'bold' }, + -- cOctalZero { Bold }, + -- cFunction {}, + -- }}}2 + + -- Markdown {{{2 + -- mkdCode { markdownCode }, + mkdID { Constant }, + mkdURL { Tag }, + mkdLink { Tag }, + mkdLinkTitle { bg = hsl('#ff0000') }, + mkdDelimiter { Delimiter }, + mkdBlockQuote { Comment }, + mkdListItem { Number }, + mkdHeading { Title }, + -- 2}}} + -- }}} + + -- LSP {{{ + LspDiagnosticsError { Error }, -- used for "Error" diagnostics + LspDiagnosticsFloatingError { LspDiagnosticsError }, + LspDiagnosticsVirtualTextError { fg = LspDiagnosticsError.fg.darken(40) }, + LspDiagnosticsSignError { LspDiagnosticsError }, + + LspDiagnosticsWarning { WarningMsg }, -- used for "Warning" diagnostics + LspDiagnosticsFloatingWarning { LspDiagnosticsWarning }, + LspDiagnosticsVirtualTextWarning { fg = LspDiagnosticsWarning.fg.darken(60) }, + LspDiagnosticsSignWarning { LspDiagnosticsWarning }, + + LspDiagnosticsInformation { fg = hsl(p.normal.blue).lighten(20) }, -- used for "Information" diagnostics + LspDiagnosticsFloatingInformation { LspDiagnosticsInformation }, + LspDiagnosticsVirtualTextInformation { fg = LspDiagnosticsInformation.fg.darken(30) }, + LspDiagnosticsSignInformation { LspDiagnosticsInformation }, + + LspDiagnosticsHint { fg = hsl(p.normal.white) }, -- used for "Hint" diagnostics + LspDiagnosticsFloatingHint { LspDiagnosticsHint }, + LspDiagnosticsVirtualTextHint { fg = LspDiagnosticsHint.fg.darken(40) }, + LspDiagnosticsSignHint { LspDiagnosticsHint }, + + -- LspReferenceText { }, -- used for highlighting "text" references + -- LspReferenceRead { }, -- used for highlighting "read" references + -- LspReferenceWrite { }, -- used for highlighting "write" references + -- }}} + + -- TreeSitter {{{ + -- TSError { }, -- For syntax/parser errors. + -- TSPunctDelimiter { }, -- For delimiters ie: `.` + -- TSPunctBracket { }, -- For brackets and parens. + -- TSPunctSpecial { }, -- For special punctutation that does not fall in the catagories before. + -- TSConstant { }, -- For constants + -- TSConstBuiltin { }, -- For constant that are built in the language: `nil` in Lua. + -- TSConstMacro { }, -- For constants that are defined by macros: `NULL` in C. + -- TSString { }, -- For strings. + -- TSStringRegex { }, -- For regexes. + -- TSStringEscape { }, -- For escape characters within a string. + -- TSCharacter { }, -- For characters. + -- TSNumber { }, -- For integers. + -- TSBoolean { }, -- For booleans. + -- TSFloat { }, -- For floats. + -- TSFunction { }, -- For function (calls and definitions). + -- TSFuncBuiltin { }, -- For builtin functions: `table.insert` in Lua. + -- TSFuncMacro { }, -- For macro defined fuctions (calls and definitions): each `macro_rules` in Rust. + -- TSParameter { }, -- For parameters of a function. + -- TSParameterReference { }, -- For references to parameters of a function. + -- TSMethod { }, -- For method calls and definitions. + -- TSField { }, -- For fields. + -- TSProperty { }, -- Same as `TSField`. + -- TSConstructor { }, -- For constructor calls and definitions: `{ }` in Lua, and Java constructors. + -- TSConditional { }, -- For keywords related to conditionnals. + -- TSRepeat { }, -- For keywords related to loops. + -- TSLabel { }, -- For labels: `label:` in C and `:label:` in Lua. + -- TSOperator { }, -- For any operator: `+`, but also `->` and `*` in C. + -- TSKeyword { }, -- For keywords that don't fall in previous categories. + -- TSKeywordFunction { }, -- For keywords used to define a fuction. + -- TSException { }, -- For exception related keywords. + -- TSType { }, -- For types. + -- TSTypeBuiltin { }, -- For builtin types (you guessed it, right ?). + -- TSNamespace { }, -- For identifiers referring to modules and namespaces. + -- TSInclude { }, -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua. + -- TSAnnotation { }, -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. + -- TSText { }, -- For strings considered text in a markup language. + -- TSStrong { }, -- For text to be represented with strong. + -- TSEmphasis { }, -- For text to be represented with emphasis. + -- TSUnderline { }, -- For text to be represented with an underline. + -- TSTitle { }, -- Text that is part of a title. + -- TSLiteral { }, -- Literal text. + -- TSURI { }, -- Any URI like a link or email. + -- TSVariable { }, -- Any variable name that does not have another highlight. + -- TSVariableBuiltin { }, -- Variable names that are defined by the languages, like `this` or `self`. + -- }}} + + -- Plugin configs {{{ + IndentGuidesOdd { bg = hsl(p.bright.black) }, + IndentGuidesEven { bg = hsl(p.dim.white).darken(40) }, + + SignifyLineChange { DiffChange }, + SignifySignChange { SignifyLineChange }, + SignifyLineAdd { DiffAdd }, + SignifySignAdd { SignifyLineAdd }, + SignifyLineDelete { DiffDelete }, + SignifySignDelete { SignifyLineDelete }, + + -- git + gitcommitSummary { Bold }, + -- gitcommitHeader { Bold }, + -- gitcommitSelectedType {}, + -- gitcommitSelectedFile {}, + -- gitcommitUntrackedFile {}, + -- gitcommitBranch {}, + -- gitcommitDiscardedType {}, + gitcommitDiff { fg = hsl(p.dim.white) }, + diffFile { fg = hsl(p.bright.yellow) }, + diffSubname { diffFile }, + diffIndexLine { diffFile }, + diffAdded { DiffAdd }, + diffRemoved { DiffDelete }, + -- diffLine {}, + -- diffBDiffer {}, + -- diffNewFile {}, + -- }}} + } +end) + +-- vi:nowrap diff --git a/.vim/lua/colors.lua.in b/.vim/lua/colors.lua.in new file mode 100644 index 0000000..caafa52 --- /dev/null +++ b/.vim/lua/colors.lua.in @@ -0,0 +1,298 @@ + +local lush = require('lush') +local hsl = lush.hsl + +local palette = { + normal = { + black = '{{ .normal_black }}', + red = '{{ .normal_red }}', + green = '{{ .normal_green }}', + yellow = '{{ .normal_yellow }}', + blue = '{{ .normal_blue }}', + magenta = '{{ .normal_magenta }}', + cyan = '{{ .normal_cyan }}', + white = '{{ .normal_white }}', + }, + bright = { + black = '{{ .bright_black }}', + red = '{{ .bright_red }}', + green = '{{ .bright_green }}', + yellow = '{{ .bright_yellow }}', + blue = '{{ .bright_blue }}', + magenta = '{{ .bright_magenta }}', + cyan = '{{ .bright_cyan }}', + white = '{{ .bright_white }}', + }, + dim = { + black = '{{ .dim_black }}', + red = '{{ .dim_red }}', + green = '{{ .dim_green }}', + yellow = '{{ .dim_yellow }}', + blue = '{{ .dim_blue }}', + magenta = '{{ .dim_magenta }}', + cyan = '{{ .dim_cyan }}', + white = '{{ .dim_white }}', + }, +} + +-- terminal buffer colors {{{ +-- TODO just let it use the default, for now... +-- let g:terminal_color_0 = color00[0] +-- let g:terminal_color_1 = color01[0] +-- let g:terminal_color_2 = color02[0] +-- let g:terminal_color_3 = color03[0] +-- let g:terminal_color_4 = color04[0] +-- let g:terminal_color_5 = color05[0] +-- let g:terminal_color_6 = color06[0] +-- let g:terminal_color_7 = color07[0] +-- let g:terminal_color_8 = color08[0] +-- let g:terminal_color_9 = color09[0] +-- let g:terminal_color_10 = color10[0] +-- let g:terminal_color_11 = color11[0] +-- let g:terminal_color_12 = color12[0] +-- let g:terminal_color_13 = color13[0] +-- let g:terminal_color_14 = color14[0] +-- let g:terminal_color_15 = color15[0] +-- }}} + +return lush(function() + return { + Underlined { gui = 'underline' }, -- (preferred) text that stands out, HTML links + Bold { gui = 'bold' }, + Italic { gui = 'italic' }, + Reverse { gui = 'reverse' }, + + ColorColumn { bg = hsl(p.dim.white).darken(40) }, -- used for the columns set with 'colorcolumn' + -- Conceal { }, -- placeholder characters substituted for concealed text (see 'conceallevel') + Cursor { Reverse }, -- character under the cursor + lCursor { Cursor }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') + CursorIM { Cursor }, -- like Cursor, but used when in IME mode |CursorIM| + CursorColumn { ColorColumn }, -- Screen-column at the cursor, when 'cursorcolumn' is set. + CursorLine { ColorColumn }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. + -- Directory { }, -- directory names (and other special names in listings) + DiffAdd { fg = hsl(p.bright.green) }, -- diff mode: Added line |diff.txt| + DiffChange { fg = hsl(p.bright.cyan) }, -- diff mode: Changed line |diff.txt| + DiffDelete { fg = hsl(p.bright.red) }, -- diff mode: Deleted line |diff.txt| + DiffText { fg = hsl(p.normal.white) }, -- diff mode: Changed text within a changed line |diff.txt| + EndOfBuffer { fg = hsl(p.bright.blue) }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. + TermCursor { Cursor }, -- cursor in a focused terminal + TermCursorNC { Cursor }, -- cursor in an unfocused terminal + ErrorMsg { Bold, fg = hsl(p.bright.white), bg = hsl(p.dim.red) }, -- error messages on the command line + VertSplit { fg = hsl(p.dim.magenta), bg = 'none' }, -- the column separating vertically split windows + Folded { fg = hsl(p.bright.magenta), bg = 'none' }, -- line used for closed folds + FoldColumn { Folded }, -- 'foldcolumn' + SignColumn { gui = 'none' }, -- column where |signs| are displayed + Search { Bold, fg = hsl(p.normal.black), bg = hsl(p.bright.white) }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. + IncSearch { Search }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" + Substitute { fg = hsl(p.normal.blue) }, -- |:substitute| replacement text highlighting + LineNr { fg = hsl(p.dim.white) }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + CursorLineNr { Cursor }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + MatchParen { fg = hsl(p.bright.white), bg = hsl(p.dim.black) }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| + ModeMsg { fg = hsl(p.normal.yellow) }, -- 'showmode' message (e.g., "-- INSERT -- ") + -- MsgArea { }, -- Area for messages and cmdline + -- MsgSeparator { }, -- Separator for scrolled messages, `msgsep` flag of 'display' + -- MoreMsg { }, -- |more-prompt| + NonText { EndOfBuffer }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. + Normal { fg = hsl(p.bright.white) }, -- normal text + NormalFloat { Normal }, -- Normal text in floating windows. + NormalNC { Normal }, -- normal text in non-current windows + Pmenu { fg = hsl(p.bright.yellow), bg = hsl(p.normal.black) }, -- Popup menu: normal item. + PmenuSel { Pmenu, gui = 'reverse' }, -- Popup menu: selected item. + PmenuSbar { bg = 'none' }, -- Popup menu: scrollbar. + PmenuThumb { bg = hsl(p.bright.white) }, -- Popup menu: Thumb of the scrollbar. + -- Question { }, -- |hit-enter| prompt and yes/no questions + -- QuickFixLine { }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. + -- SpecialKey { }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| SpellBad Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. SpellCap Word that should start with a capital. |spell| Combined with the highlighting used otherwise. SpellLocal Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. + -- SpellRare { }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. + StatusLine { fg = hsl(p.normal.white), bg = hsl(p.normal.black) }, -- status line of current window + StatusLineNC { fg = hsl(p.dim.white) }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + TabLine { StatusLine }, -- tab pages line, not active tab page label + TabLineFill { gui = 'none' }, -- tab pages line, where there are no labels + -- TabLineSel { }, -- tab pages line, active tab page label + -- Title { }, -- titles for output from ":set all", ":autocmd" etc. + Visual { fg = hsl(p.bright.white), bg = hsl(p.normal.magenta) }, -- Visual mode selection + VisualNOS { Visual }, -- Visual mode selection when vim is "Not Owning the Selection". + WarningMsg { fg = hsl(p.normal.yellow) }, -- warning messages + Whitespace { fg = hsl(p.dim.white) }, -- "nbsp", "space", "tab" and "trail" in 'listchars' + WildMenu { bg = hsl(p.bright.black) }, -- current match in 'wildmenu' completion + + Constant { fg = hsl(p.bright.yellow).darken(50) }, -- (preferred) any constant + String { fg = hsl(p.normal.yellow) }, -- a string constant: "this is a string" + Character { String }, -- a character constant: 'c', '\n' + Number { fg = hsl(p.normal.cyan) }, -- a number constant: 234, 0xff + Float { Number }, -- a floating point constant: 2.3e10 + Boolean { Number }, -- a boolean constant: TRUE, false + + Identifier { fg = hsl(p.bright.magenta) }, -- (preferred) any variable name + Function { Identifier }, -- function name (also: methods for classes) + Comment { Italic, fg = hsl(p.dim.white).lighten(30) }, + + Statement { fg = hsl(p.normal.green) }, -- (preferred) any statement + Keyword { fg = hsl(p.bright.blue) }, -- any other keyword + Conditional { Keyword }, -- if, then, else, endif, switch, etc. + Repeat { Keyword }, -- for, do, while, etc. + Label { Keyword }, -- case, default, etc. + Operator { Keyword }, -- "sizeof", "+", "*", etc. + Exception { Keyword }, -- try, catch, throw + + PreProc { fg = hsl(p.normal.cyan) }, -- (preferred) generic Preprocessor + Include { PreProc }, -- preprocessor #include + Define { PreProc }, -- preprocessor #define + Macro { PreProc }, -- same as Define + PreCondit { PreProc }, -- preprocessor #if, #else, #endif, etc. + + Type { fg = hsl(p.bright.green) }, -- (preferred) int, long, char, etc. + StorageClass { Type }, -- static, register, volatile, etc. + Structure { Type }, -- struct, union, enum, etc. + Typedef { Type }, -- A typedef + + Special { fg = hsl(p.normal.yellow) }, -- (preferred) any special symbol + SpecialChar { Special }, -- special character in a constant + Tag { Special }, -- you can use CTRL-] on this + Delimiter { Special }, -- character that needs attention + SpecialComment { Special }, -- special things inside a comment + Debug { Special }, -- debugging statements + + -- Ignore { }, -- (preferred) left blank, hidden |hl-Ignore| + Error { Bold, fg = hsl(p.normal.red) }, -- (preferred) any erroneous construct + Todo { Italic, fg = hsl(p.normal.black), bg = hsl(p.bright.yellow) }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX + + -- Lang specific {{{ + -- C + cType { Type, gui = 'bold' }, + -- cFormat {}, + -- cStorageClass { Bold }, + + cBoolean { Boolean, gui = 'bold' }, + -- cCharacter {}, + cConstant { Constant, gui = 'bold' }, + -- cConditional { Bold }, + cSpecial { Bold }, + -- cDefine {}, + -- cNumber {}, + -- cPreCondit {}, + -- cRepeat {}, + -- cLabel { fg = hsl(p.dim.black), bg = hsl(p.dim.red) }, + -- cAnsiFunction { Bold }, + -- cAnsiName {}, + -- cDelimiter {}, + -- cBraces {}, + -- cIdentifier {}, + -- cSemiColon {}, + -- cOperator {}, + -- cStatement {}, + -- cTodo { Bold }, + cStructure { Bold }, + -- cCustomParen {}, + -- cCustomFunc {}, + -- cUserFunction { Function, gui = 'bold' }, + -- cOctalZero { Bold }, + -- cFunction {}, + -- }}} + + -- LSP {{{ + LspDiagnosticsError { Error }, -- used for "Error" diagnostics + LspDiagnosticsFloatingError { LspDiagnosticsError }, + LspDiagnosticsVirtualTextError { fg = LspDiagnosticsError.fg.darken(40) }, + LspDiagnosticsSignError { LspDiagnosticsError }, + + LspDiagnosticsWarning { WarningMsg }, -- used for "Warning" diagnostics + LspDiagnosticsFloatingWarning { LspDiagnosticsWarning }, + LspDiagnosticsVirtualTextWarning { fg = LspDiagnosticsWarning.fg.darken(60) }, + LspDiagnosticsSignWarning { LspDiagnosticsWarning }, + + LspDiagnosticsInformation { fg = hsl(p.normal.blue).lighten(20) }, -- used for "Information" diagnostics + LspDiagnosticsFloatingInformation { LspDiagnosticsInformation }, + LspDiagnosticsVirtualTextInformation { fg = LspDiagnosticsInformation.fg.darken(30) }, + LspDiagnosticsSignInformation { LspDiagnosticsInformation }, + + LspDiagnosticsHint { fg = hsl(p.normal.green) }, -- used for "Hint" diagnostics + LspDiagnosticsFloatingHint { LspDiagnosticsHint }, + LspDiagnosticsVirtualTextHint { fg = LspDiagnosticsHint.fg.darken(40) }, + LspDiagnosticsSignHint { LspDiagnosticsHint }, + + -- LspReferenceText { }, -- used for highlighting "text" references + -- LspReferenceRead { }, -- used for highlighting "read" references + -- LspReferenceWrite { }, -- used for highlighting "write" references + -- }}} + + -- TreeSitter {{{ + -- TSError { }, -- For syntax/parser errors. + -- TSPunctDelimiter { }, -- For delimiters ie: `.` + -- TSPunctBracket { }, -- For brackets and parens. + -- TSPunctSpecial { }, -- For special punctutation that does not fall in the catagories before. + -- TSConstant { }, -- For constants + -- TSConstBuiltin { }, -- For constant that are built in the language: `nil` in Lua. + -- TSConstMacro { }, -- For constants that are defined by macros: `NULL` in C. + -- TSString { }, -- For strings. + -- TSStringRegex { }, -- For regexes. + -- TSStringEscape { }, -- For escape characters within a string. + -- TSCharacter { }, -- For characters. + -- TSNumber { }, -- For integers. + -- TSBoolean { }, -- For booleans. + -- TSFloat { }, -- For floats. + -- TSFunction { }, -- For function (calls and definitions). + -- TSFuncBuiltin { }, -- For builtin functions: `table.insert` in Lua. + -- TSFuncMacro { }, -- For macro defined fuctions (calls and definitions): each `macro_rules` in Rust. + -- TSParameter { }, -- For parameters of a function. + -- TSParameterReference { }, -- For references to parameters of a function. + -- TSMethod { }, -- For method calls and definitions. + -- TSField { }, -- For fields. + -- TSProperty { }, -- Same as `TSField`. + -- TSConstructor { }, -- For constructor calls and definitions: `{ }` in Lua, and Java constructors. + -- TSConditional { }, -- For keywords related to conditionnals. + -- TSRepeat { }, -- For keywords related to loops. + -- TSLabel { }, -- For labels: `label:` in C and `:label:` in Lua. + -- TSOperator { }, -- For any operator: `+`, but also `->` and `*` in C. + -- TSKeyword { }, -- For keywords that don't fall in previous categories. + -- TSKeywordFunction { }, -- For keywords used to define a fuction. + -- TSException { }, -- For exception related keywords. + -- TSType { }, -- For types. + -- TSTypeBuiltin { }, -- For builtin types (you guessed it, right ?). + -- TSNamespace { }, -- For identifiers referring to modules and namespaces. + -- TSInclude { }, -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua. + -- TSAnnotation { }, -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. + -- TSText { }, -- For strings considered text in a markup language. + -- TSStrong { }, -- For text to be represented with strong. + -- TSEmphasis { }, -- For text to be represented with emphasis. + -- TSUnderline { }, -- For text to be represented with an underline. + -- TSTitle { }, -- Text that is part of a title. + -- TSLiteral { }, -- Literal text. + -- TSURI { }, -- Any URI like a link or email. + -- TSVariable { }, -- Any variable name that does not have another highlight. + -- TSVariableBuiltin { }, -- Variable names that are defined by the languages, like `this` or `self`. + -- }}} + + -- Plugin configs {{{ + IndentGuidesOdd { bg = hsl(p.bright.black) }, + IndentGuidesEven { bg = hsl(p.dim.white).darken(40) }, + + SignifyLineChange { DiffChange }, + SignifySignChange { SignifyLineChange }, + SignifyLineAdd { DiffAdd }, + SignifySignAdd { SignifyLineAdd }, + SignifyLineDelete { DiffDelete }, + SignifySignDelete { SignifyLineDelete }, + + -- git + gitcommitSummary { Bold }, + -- gitcommitHeader { Bold }, + -- gitcommitSelectedType {}, + -- gitcommitSelectedFile {}, + -- gitcommitUntrackedFile {}, + -- gitcommitBranch {}, + -- gitcommitDiscardedType {}, + gitcommitDiff { fg = hsl(p.dim.white) }, + diffFile { fg = hsl(p.bright.yellow) }, + diffSubname { diffFile }, + diffIndexLine { diffFile }, + diffAdded { DiffAdd }, + diffRemoved { DiffDelete }, + -- diffLine {}, + -- diffBDiffer {}, + -- diffNewFile {}, + -- }}} + } +end) + +-- vi:nowrap diff --git a/.vim/lua/conf/colors.lua b/.vim/lua/conf/colors.lua deleted file mode 100644 index 65d1fb1..0000000 --- a/.vim/lua/conf/colors.lua +++ /dev/null @@ -1,9 +0,0 @@ - -local lush = require('lush') -local hsl = lush.hsl - -return lush(function() - return { - Normal { bg = hsl} - } -end) diff --git a/.vim/lua/conf/diagnostic.lua b/.vim/lua/conf/diagnostic.lua deleted file mode 100644 index fe80fff..0000000 --- a/.vim/lua/conf/diagnostic.lua +++ /dev/null @@ -1,20 +0,0 @@ - -local g = vim.g -local cmd = vim.api.nvim_command - -g.diagnostic_enable_virtual_text = 1 -g.diagnostic_trimmed_virtual_text = '40' -g.diagnostic_insert_delay = 1 -cmd('nnoremap <silent> c[ <cmd>PrevDiagnosticCycle<cr>') -cmd('nnoremap <silent> c] <cmd>NextDiagnosticCycle<cr>') - - -vim.fn.sign_define("LspDiagnosticsErrorSign", {text="✘", texthl="LspDiagnosticsError"}) -vim.fn.sign_define("LspDiagnosticsWarningSign", {text="‼", texthl="LspDiagnosticsWarning"}) -vim.fn.sign_define("LspDiagnosticsInformationSign", {text="i", texthl="LspDiagnosticsInformation"}) -vim.fn.sign_define("LspDiagnosticsHintSign", {text="☛",texthl="LspDiagnosticsHint"}) - -cmd('highlight link LspDiagnosticsError Error') -cmd('highlight link LspDiagnosticsWarning WarningMsg') -cmd('highlight link LspDiagnosticsInformation Todo') -cmd('highlight link LspDiagnosticsHint Question') diff --git a/.vim/lua/hardmode.lua b/.vim/lua/hardmode.lua index ed7d4ac..e6fea02 100644 --- a/.vim/lua/hardmode.lua +++ b/.vim/lua/hardmode.lua @@ -3,36 +3,32 @@ -- https://coderoncode.com/posts/vim-is-the-perfect-ide local cmd = vim.cmd -local u = require('utils') - -local bail = ':silent! echohl ErrorMsg | echo "HARD MODE: hjkl operation only" | echohl None<CR>' - -u.map('n', 'R<up>', ':resize +2<CR>') -u.map('n', 'R<down>', ':resize -2<CR>') -u.map('n', 'R<left>', ':vertical resize +2<CR>') -u.map('n', 'R<right>', ':vertical resize +2<CR>') - -u.map('n', 'W<up>', ':wincmd k<CR>') -u.map('n', 'W<down>', ':wincmd j<CR>') -u.map('n', 'W<left>', ':wincmd h<CR>') -u.map('n', 'W<right>', ':wincmd l<CR>') - -u.map('n', 'Wm<up>', ':wincmd K<CR>') -u.map('n', 'Wm<down>', ':wincmd J<CR>') -u.map('n', 'Wm<left>', ':wincmd H<CR>') -u.map('n', 'Wm<right>', ':wincmd L<CR>') - -u.map('n', '<up>', bail) -u.map('n', '<down>', bail) -u.map('n', '<left>', bail) -u.map('n', '<right>', bail) - -u.map('v', '<up>', bail) -u.map('v', '<down>', bail) -u.map('v', '<left>', bail) -u.map('v', '<right>', bail) - -u.map('i', '<up>', '<esc>' .. bail) -u.map('i', '<down>', '<esc>' .. bail) -u.map('i', '<left>', '<esc>' .. bail) -u.map('i', '<right>', '<esc>' .. bail) +local nnoremap = require('astronauta.keymap').nnoremap +local vnoremap = require('astronauta.keymap').nnoremap + +local bail = 'silent! echohl ErrorMsg | echo "HARD MODE: hjkl operation only" | echohl None' + +nnoremap { 'R<up>', function() vim.cmd [[ resize +2 ]] end } +nnoremap { 'R<down>', function() vim.cmd [[ resize -2 ]] end } +nnoremap { 'R<left>', function() vim.cmd [[ vertical resize +2 ]] end } +nnoremap { 'R<right>', function() vim.cmd [[ vertical resize +2 ]] end } + +nnoremap { 'W<up>', function() vim.cmd [[ wincmd k ]] end } +nnoremap { 'W<down>', function() vim.cmd [[ wincmd j ]] end } +nnoremap { 'W<left>', function() vim.cmd [[ wincmd h ]] end } +nnoremap { 'W<right>', function() vim.cmd [[ wincmd l ]] end } + +nnoremap { 'Wm<up>', function() vim.cmd [[ wincmd K ]] end } +nnoremap { 'Wm<down>', function() vim.cmd [[ wincmd J ]] end } +nnoremap { 'Wm<left>', function() vim.cmd [[ wincmd H ]] end } +nnoremap { 'Wm<right>', function() vim.cmd [[ wincmd L ]] end } + +nnoremap { '<up>', function() vim.cmd(bail) end } +nnoremap { '<down>', function() vim.cmd(bail) end } +nnoremap { '<left>', function() vim.cmd(bail) end } +nnoremap { '<right>', function() vim.cmd(bail) end } + +vnoremap { '<up>', function() vim.cmd(bail) end } +vnoremap { '<down>', function() vim.cmd(bail) end } +vnoremap { '<left>', function() vim.cmd(bail) end } +vnoremap { '<right>', function() vim.cmd(bail) end } diff --git a/.vim/lua/misc.lua b/.vim/lua/misc.lua index 8b26ed1..4f2b9dc 100644 --- a/.vim/lua/misc.lua +++ b/.vim/lua/misc.lua @@ -2,17 +2,33 @@ local M = {} +function M.do_under_cursor(obj, cb) + return cb(vim.fn.expand(vim.fn.expand(obj))) +end + +function M.word_under_cursor(cb) + return M.do_under_cursor('<cword>', cb) +end + +function M.expr_under_cursor(cb) + return M.do_under_cursor('<cexpr>', cb) +end + +function M.file_under_cursor(cb) + return M.do_under_cursor('<cfile>', cb) +end + function M.open_under_cursor(cmd) - local txt = vim.fn.expand('<cfile>') - local txt = vim.fn.expand(txt) - if not cmd then - vim.fn.inputsave() - cmd = vim.fn.input('open with: ') - vim.fn.inputrestore() - end - if cmd then - c = vim.loop.spawn(cmd, { args = {txt} }, function() c:close() end) - end + return M.file_under_cursor(function(txt) + if not cmd then + vim.fn.inputsave() + cmd = vim.fn.input('open with: ') + vim.fn.inputrestore() + end + if cmd then + c = vim.loop.spawn(cmd, { args = {txt} }, function() c:close() end) + end + end) end return M diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua index 6ec9e61..d41024e 100644 --- a/.vim/lua/plugins.lua +++ b/.vim/lua/plugins.lua @@ -4,154 +4,167 @@ local g = vim.g local u = require('utils') function disable_distribution_plugins() - g.loaded_gzip = 1 - g.loaded_tar = 1 - g.loaded_tarPlugin = 1 - g.loaded_zip = 1 - g.loaded_zipPlugin = 1 - g.loaded_getscript = 1 - g.loaded_getscriptPlugin = 1 - g.loaded_vimball = 1 - g.loaded_vimballPlugin = 1 - g.loaded_matchit = 1 - -- g.loaded_matchparen = 1 - g.loaded_2html_plugin = 1 - g.loaded_logiPat = 1 - g.loaded_rrhelper = 1 - g.loaded_netrw = 1 - g.loaded_netrwPlugin = 1 - g.loaded_netrwSettings = 1 - g.loaded_netrwFileHandlers = 1 + g.loaded_gzip = 1 + g.loaded_tar = 1 + g.loaded_tarPlugin = 1 + g.loaded_zip = 1 + g.loaded_zipPlugin = 1 + g.loaded_getscript = 1 + g.loaded_getscriptPlugin = 1 + g.loaded_vimball = 1 + g.loaded_vimballPlugin = 1 + g.loaded_matchit = 1 + -- g.loaded_matchparen = 1 + g.loaded_2html_plugin = 1 + g.loaded_logiPat = 1 + g.loaded_rrhelper = 1 + g.loaded_netrw = 1 + g.loaded_netrwPlugin = 1 + g.loaded_netrwSettings = 1 + g.loaded_netrwFileHandlers = 1 end -- enable to bootstrap packer from ~/.local/share/nvim/site/pack/packer/opt/packer.nvim -- vim.cmd [[packadd packer.nvim]] return require'packer'.startup(function() - -- disable built-in plugins - disable_distribution_plugins() - - -- manage packer itself - use {'wbthomason/packer.nvim'} - - -- git status in the sign column - use {'mhinz/vim-signify', - config = "require('plugins._signify')" - } - - use {'tpope/vim-commentary'} -- auto-comment using `gcc` - use {'cohama/lexima.vim'} -- auto-close parens, brackets, etc. - use {'tpope/vim-surround'} -- edit surroundings in pairs - -- use {'neomake/neomake'} -- async job runner - use {'sbdchd/neoformat'} -- async code formatter - use {'justinmk/vim-dirvish'} -- folder browser - use {'justinmk/vim-sneak', - config = "vim.g['sneak#label'] = true" - } - - use {'neovim/nvim-lspconfig', - requires = { - {'nvim-lua/completion-nvim', - requires = {'steelsojka/completion-buffers'}, - config = "require('plugins._completion')"}, - 'kosayoda/nvim-lightbulb', - }, - config = "require('plugins._lsp')" - } - - use {'nvim-treesitter/nvim-treesitter', - requires = { - 'nvim-lua/completion-nvim', - 'nvim-treesitter/completion-treesitter', - 'nvim-treesitter/nvim-treesitter-refactor', - }, - config = "require('plugins._treesitter')" - } - - use {'nvim-telescope/telescope.nvim', - requires = { - 'nvim-lua/popup.nvim', - 'nvim-lua/plenary.nvim', - -- telescope plugins: - 'nvim-telescope/telescope-fzf-writer.nvim', - }, - config = "require('plugins._telescope')" - } - - -- polyfill for some missing stuff - use {'tjdevries/astronauta.nvim'} - - -- snippets - use {'SirVer/ultisnips', - requires = {'honza/vim-snippets'}, - config = "require('plugins._ultisnips')" - } - - use {'junegunn/vim-easy-align'} - - -- use {'tpope/vim-sleuth'} -- detect indentation - use {'nathanaelkane/vim-indent-guides', - config = "require('plugins._indent-guides')" - } - - use {'tpope/vim-repeat'} -- extend '.' to plugins - use {'sgur/vim-editorconfig'} -- implements editorconfig in vimscript - use {'michaeljsmith/vim-indent-object'} -- adds indentation text-objects - use {'kshenoy/vim-signature', disable = true} -- toggle, display and navigate marks - use {'norcalli/nvim-colorizer.lua', - config = "require('plugins._colorizer')" - } - - use {'rhysd/git-messenger.vim', - config = "require('plugins._git-messenger')" - } - - use {'rhysd/conflict-marker.vim', disable = true} - -- use {'liuchengxu/vista.vim'} -- sidebar populated by lsp, ctags, etc. - use {'kassio/neoterm', disable = true} - - -- languages - -- NOTE: these should only be loaded when they are required... - -- use {'rhysd/vim-grammarous', - -- ft = {'markdown', 'latex', 'tex'} - -- } - use {'lervag/vimtex', - ft = {'latex', 'tex'}, - config = "require('plugins._vimtex')" - } - use {'plasticboy/vim-markdown', - ft = {'markdown'}, - config = "require('plugins._markdown')" - } - use {'masukomi/vim-markdown-folding', - ft = {'markdown'} - } - use {'jjo/vim-cue', - ft = {'cue'} - } - use {'gentoo/gentoo-syntax'} - - -- multi-language support with lazy loading - -- NOTE: put language specific plugs before this to avoid conflicsts - use {'sheerun/vim-polyglot'} - - -- minimal ux - use {'junegunn/goyo.vim', - cmd = 'Goyo', - config = "require('plugins._goyo')" - } - use {'junegunn/limelight.vim', - cmd = 'Limelight', - config = "require('plugins._limelight')" - } - - use {'rktjmp/lush.nvim', - disable = true, - config="require('plugins._lush')"} - - -- vim config debugging - use {'dstein64/vim-startuptime', disable = true} - - -- local - use {'~/devel/upstream/github.com/knsh14/vim-github-link'} + -- disable built-in plugins + disable_distribution_plugins() + + -- manage packer itself + use {'wbthomason/packer.nvim'} + + -- git status in the sign column + use {'mhinz/vim-signify', + config = "require('plugins._signify')" + } + + use {'tpope/vim-commentary'} -- auto-comment using `gcc` + use {'cohama/lexima.vim'} -- auto-close parens, brackets, etc. + use {'tpope/vim-surround'} -- edit surroundings in pairs + -- use {'neomake/neomake'} -- async job runner + use {'sbdchd/neoformat'} -- async code formatter + use {'justinmk/vim-dirvish'} -- folder browser + use {'justinmk/vim-sneak', + config = "vim.g['sneak#label'] = true" + } + + use {'neovim/nvim-lspconfig', + requires = { + {'nvim-lua/completion-nvim', + requires = {'steelsojka/completion-buffers'}, + config = "require('plugins._completion')"}, + {'kosayoda/nvim-lightbulb', config = "require('plugins._lightbulb')"}, + }, + config = "require('plugins._lsp')" + } + + use {'nvim-treesitter/nvim-treesitter', + requires = { + 'nvim-lua/completion-nvim', + 'nvim-treesitter/completion-treesitter', + 'nvim-treesitter/nvim-treesitter-refactor', + }, + config = "require('plugins._treesitter')", + run = ':TSUpdate' + } + + use {'nvim-telescope/telescope.nvim', + requires = { + 'nvim-lua/popup.nvim', + 'nvim-lua/plenary.nvim', + -- telescope plugins: + 'nvim-telescope/telescope-fzf-writer.nvim', + }, + config = "require('plugins._telescope')" + } + + -- polyfill for some missing stuff + use {'tjdevries/astronauta.nvim'} + + -- snippets + use {'SirVer/ultisnips', + requires = {'honza/vim-snippets'}, + config = "require('plugins._ultisnips')" + } + + use {'junegunn/vim-easy-align'} + + -- use {'tpope/vim-sleuth'} -- detect indentation + use {'nathanaelkane/vim-indent-guides', + disable = true, + config = "require('plugins._indent-guides')" + } + + use {'tpope/vim-repeat'} -- extend '.' to plugins + use {'sgur/vim-editorconfig'} -- implements editorconfig in vimscript + use {'michaeljsmith/vim-indent-object'} -- adds indentation text-objects + use {'kshenoy/vim-signature', disable = true} -- toggle, display and navigate marks + use {'norcalli/nvim-colorizer.lua', + config = "require('plugins._colorizer')" + } + + use {'rhysd/git-messenger.vim', + config = "require('plugins._git-messenger')" + } + + use {'TimUntersberger/neogit', + cmd = 'Neogit' + } + + use {'rhysd/conflict-marker.vim', disable = true} + -- use {'liuchengxu/vista.vim'} -- sidebar populated by lsp, ctags, etc. + use {'kassio/neoterm', disable = true} + + -- zettelkasten via neuron + -- NOTE: needs telescope.nvim and plenary.nvim + use {'oberblastmeister/neuron.nvim', + branch = 'unstable', + requires = {'nvim-telescope/telescope.nvim'}, + config = "require('.plugins._neuron')" + } + + -- languages + -- NOTE: these should only be loaded when they are required... + -- use {'rhysd/vim-grammarous', + -- ft = {'markdown', 'latex', 'tex'} + -- } + use {'lervag/vimtex', + ft = {'latex', 'tex'}, + config = "require('plugins._vimtex')" + } + use {'plasticboy/vim-markdown', + ft = {'markdown'}, + config = "require('plugins._markdown')" + } + use {'masukomi/vim-markdown-folding', + ft = {'markdown'} + } + use {'jjo/vim-cue', + ft = {'cue'} + } + use {'gentoo/gentoo-syntax'} + + -- multi-language support with lazy loading + -- NOTE: put language specific plugs before this to avoid conflicsts + use {'sheerun/vim-polyglot'} + + -- minimal ux + use {'junegunn/goyo.vim', + cmd = 'Goyo', + config = "require('plugins._goyo')" + } + use {'junegunn/limelight.vim', + cmd = 'Limelight', + config = "require('plugins._limelight')" + } + + use {'rktjmp/lush.nvim',} + -- config="require('colors')"} + + -- vim config debugging + use {'dstein64/vim-startuptime', disable = true} + + -- local + use {'~/devel/upstream/github.com/knsh14/vim-github-link'} end) diff --git a/.vim/lua/plugins/_completion.lua b/.vim/lua/plugins/_completion.lua index 8a4a92e..504ab00 100644 --- a/.vim/lua/plugins/_completion.lua +++ b/.vim/lua/plugins/_completion.lua @@ -1,17 +1,53 @@ local g = vim.g local u = require('utils') +local inoremap = require('astronauta.keymap').inoremap g.completion_enable_auto_popup = true g.completion_enable_auto_signature = true g.completion_enable_auto_paren = false -g.completion_confirm_key = '<tab>' +g.completion_enable_auto_hover = true +g.completion_trigger_on_delete = true +g.completion_confirm_key = '<cr>' g.completion_enable_snippet = 'UltiSnips' +-- g.completion_matching_ignore_case = false +g.completion_matching_smart_case = true +g.completion_matching_strategy_list = {'exact', 'substring', 'fuzzy', 'all'} +g.completion_sorting = 'length' -- or: alphabet, none + g.completion_auto_change_source = true g.completion_chain_complete_list = { - {complete_items = {'lsp', 'snippet', 'buffers', 'ts', 'path'}}, - {mode = 'file'}, + {complete_items = {'lsp', 'snippet', 'buffers', 'path', 'ts'}}, + -- {mode = '<c-p>'}, + -- {mode = '<c-n>'}, + {mode = 'file'}, + {mode = 'spel'}, +} + +u.augroup2 { + completion_user = {{'BufEnter', '*', 'lua require("completion").on_attach()'}} } -u.augroup('completion', { - {'BufEnter', '*', 'lua require("completion").on_attach()'}, -}) +inoremap { '<tab>', function() require('completion').smart_tab() end } +inoremap { '<s-tab>', function() require('completion').smart_s_tab() end } +inoremap { '<c-j>', function() require('completion.source').nextCompletion() end } +inoremap { '<c-k>', function() require('completion.source').prevCompletion() end } + +-- inoremap { '<c-n>', function() +-- if vim.fn.pumvisible() == 1 then +-- vim.api.nvim_feedkeys('<c-n>') +-- else +-- require('completion').triggerCompletion() +-- end +-- end } + +-- inoremap { '<c-p>', function() +-- if vim.fn.pumvisible() == 1 then +-- vim.api.nvim_feedkeys('<c-p>') +-- else +-- require('completion').triggerCompletion() +-- end +-- end } + +-- require('utils').map('i', '<C-n>', 'pumvisible() ? "\\<C-n>" : completion#trigger_completion()', { expr = true }) +-- require('utils').map('i', '<C-p>', 'pumvisible() ? "\\<C-p>" : completion#trigger_completion()', { expr = true }) + diff --git a/.vim/lua/plugins/_lightbulb.lua b/.vim/lua/plugins/_lightbulb.lua new file mode 100644 index 0000000..cc3f941 --- /dev/null +++ b/.vim/lua/plugins/_lightbulb.lua @@ -0,0 +1,19 @@ + +require('nvim-lightbulb').update_lightbulb { + sign = { + enabled = true, + priority = 10, + }, + float = { + enabled = true, + text = '', + win_opts = {}, + }, + virtual_test = { + enabled = false + } +} + +require('utils').augroup('lightbulb', { + {'CursorHold,CursorHoldI', '*', "lua require'nvim-lightbulb'.update_lightbulb()"} +}) diff --git a/.vim/lua/plugins/_lsp.lua b/.vim/lua/plugins/_lsp.lua index 780f703..9a1a0bb 100644 --- a/.vim/lua/plugins/_lsp.lua +++ b/.vim/lua/plugins/_lsp.lua @@ -5,75 +5,172 @@ local util = require('lspconfig.util') local u = require('utils') local nnoremap = require('astronauta.keymap').nnoremap --- https://github.com/kosayoda/nvim-lightbulb -require('nvim-lightbulb').update_lightbulb { - sign = { - enabled = true, - priority = 10, - }, - float = { - enabled = true, - text = '', - win_opts = {}, - }, -} - +local M = {} local my_attach = function(client) - -- attach completion - require 'completion'.on_attach(client) - - -- lsp mappings - nnoremap { 'K', function() vim.lsp.buf.hover() end } - nnoremap { '<C-]>', function() vim.lsp.buf.definition() end } - nnoremap { 'grr', function() vim.lsp.buf.rename() end } - nnoremap { '<c-h>', function() vim.lsp.buf.signature_help() end } - nnoremap { ']d', function() vim.lsp.diagnostic.goto_next() end } - nnoremap { '[d', function() vim.lsp.diagnostic.goto_prev() end } - - -- nnoremap <silent> gD <cmd> lua vim.lsp.buf.declaration()<CR> - -- nnoremap <silent> gd <cmd> lua vim.lsp.buf.definition()<CR> - -- nnoremap <silent> gT <cmd> lua vim.lsp.buf.type_definition()<CR> - -- nnoremap <silent> gI <cmd> lua vim.lsp.buf.implementation()<CR> - -- nnoremap <silent> gr <cmd> lua vim.lsp.buf.references()<CR> - -- nnoremap <silent> g0 <cmd> lua vim.lsp.buf.document_symbol()<CR> - -- nnoremap <silent> gW <cmd> lua vim.lsp.buf.workspace_symbol()<CR> - -- nnoremap <silent> ;h <cmd> lua vim.lsp.buf.hover()<CR> - -- nnoremap <silent> ;s <cmd> lua vim.lsp.buf.signature_help()<CR> + -- attach completion + require 'completion'.on_attach(client) + + -- lsp mappings + nnoremap { 'K', function() vim.lsp.buf.hover() end } + nnoremap { '<C-]>', function() vim.lsp.buf.definition() end } + nnoremap { 'gd', function() vim.lsp.buf.definition() end } + nnoremap { 'grr', function() vim.lsp.buf.rename() end } + nnoremap { '<c-h>', function() vim.lsp.buf.signature_help() end } + nnoremap { ']d', function() vim.lsp.diagnostic.goto_next() end } + nnoremap { '[d', function() vim.lsp.diagnostic.goto_prev() end } + + nnoremap { '<leader>f', function() vim.lsp.buf.formatting() end } + + -- nnoremap { 'g0', function() vim.lsp.buf.document_symbol() end } + -- nnoremap { 'gr', function() vim.lsp.buf.references() end } + nnoremap { 'gW', function() vim.lsp.buf.workspace_symbol() end } + nnoremap { 'gD', function() vim.lsp.buf.declaration() end } + nnoremap { 'gT', function() vim.lsp.buf.type_definition() end } + nnoremap { 'gI', function() vim.lsp.buf.implementation() end } + + -- nnoremap <silent> ;s <cmd> lua vim.lsp.buf.signature_help()<CR> + nnoremap { '<leader>d', function() vim.lsp.diagnostic.show_line_diagnostics() end } + + u.augroup2 { + lsp_user = { + {'BufWritePre', '*', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}, + {'BufWritePre', '*.go', 'lua vim.lsp.buf.code_action({ source = { organizeImports = true } })'}, + {'CursorHold', '*', 'lua vim.lsp.diagnostic.show_line_diagnostics()'}, + } + } end +-- handler overwrites {{{ +-- configure builtin diagnositcs +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = false, + signs = true, + underline = true, + update_in_insert = true, + } +) + +-- overwrite codeAction handler to not ask for confirmation if only a single +-- action is given +vim.lsp.handlers["textDocument/codeAction"] = function(_, _, actions) + if actions == nil or vim.tbl_isempty(actions) then + -- skip printing 'no code actions available' + return + end + + local action_cosen + if #actions == 1 then + action_chosen = actions[1] + else + local option_strings = {"Code Actions:"} + for i, action in ipairs(actions) do + local title = action.title:gsub('\r\n', '\\r\\n') + title = title:gsub('\n', '\\n') + table.insert(option_strings, string.format("%d. %s", i, title)) + end + + local choice = vim.fn.inputlist(option_strings) + if choice < 1 or choice > #actions then + return + end + action_chosen = actions[choice] + end + + if action_chosen.edit or type(action_chosen.command) == "table" then + if action_chosen.edit then + vim.lsp.util.apply_workspace_edit(action_chosen.edit) + end + if type(action_chosen.command) == "table" then + vim.lsp.buf.execute_command(action_chosen.command) + end + else + vim.lsp.buf.execute_command(action_chosen) + end +end +-- }}} + +-- configure signs {{{ +vim.fn.sign_define("LspDiagnosticsSignError", {text="⚡"}) +vim.fn.sign_define("LspDiagnosticsSignWarning", {text="⯈"}) +vim.fn.sign_define("LspDiagnosticsSignInformation", {text="≈"}) +vim.fn.sign_define("LspDiagnosticsSignHint", {text="🞶"}) +-- }}} + -- lsp.ccls.setup{ --- on_attach = my_attach, +-- on_attach = my_attach, -- } lsp.gopls.setup{ - on_attach = my_attach, - root_dir = util.root_pattern('go.mod', '.git'), - -- NOTE: this is done to avoid the gopls warning about being outside gopath - -- message_level = vim.lsp.protocol.MessageType.Error, + on_attach = my_attach, + -- root_dir = util.root_pattern('go.mod', '.git'), + settings = { + gopls = { + -- analyses = { + -- composites = false + -- }, + codelenses = { + test = true, + tidy = true, + }, + gofumpt = true, + } + } } lsp.sumneko_lua.setup{ - on_attach = my_attach; - cmd = { 'lua-language-server' }; - settings = { - Lua = { - runtime = { - version = 'LuaJIT', - }, - diagnostics = { - globals = {'vim'}, - }, - workspace = { - library = { - [vim.fn.expand('$VIMRUNTIME/lua')] = true, - [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, - } - } - } - }, + on_attach = my_attach; + cmd = { 'lua-language-server' }; + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + diagnostics = { + globals = {'vim'}, + }, + workspace = { + library = { + [vim.fn.expand('$VIMRUNTIME/lua')] = true, + [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, + } + } + } + } } lsp.rust_analyzer.setup{ - on_attach = my_attach, - cmd = { 'env', 'CARGO_TARGET_DIR=/tmp', 'rust-analyzer' }, + on_attach = my_attach, + cmd = { 'env', 'CARGO_TARGET_DIR=/tmp', 'rust-analyzer' }, } + +lsp.efm.setup{ + on_attach = my_attach, + root_dir = util.root_pattern('.git', '.editorconfig'), + init_options = { documentFormatting = true }, + filetypes = { "sh" }, + settings = { + -- rootMarkers = {".git/"}, + languages = { + sh = { + { + lintCommand = 'shellcheck -f gcc -x', + lintSource = 'shellcheck', + lintFormats = { + '%f:%l:%c: %trror: %m', + '%f:%l:%c: %tarning: %m', + '%f:%l:%c: %tote: %m', + }, + formatCommand = 'shfmt -ci -s -bn', + formatStdin = true, + } + } + } + } +} + +lsp.zls.setup{ + on_attach = my_attach +} + +return M diff --git a/.vim/lua/plugins/_markdown.lua b/.vim/lua/plugins/_markdown.lua index c773d50..e02e160 100644 --- a/.vim/lua/plugins/_markdown.lua +++ b/.vim/lua/plugins/_markdown.lua @@ -1,9 +1,12 @@ -g.vim_markdown_folding_disabled = true -g.vim_markdown_math = true -g.vim_markdown_frontmatter = true -g.vim_markdown_json_frontmatter = true -g.vim_markdown_toml_frontmatter = true -g.vim_markdown_folding_level = 2 -g.vim_markdown_strikethrough = true -g.vim_markdown_auto_insert_bullets = true -g.vim_markdown_new_list_item_indent = false +vim.g.vim_markdown_folding_disabled = true +vim.g.vim_markdown_math = true +vim.g.vim_markdown_frontmatter = true +vim.g.vim_markdown_json_frontmatter = true +vim.g.vim_markdown_toml_frontmatter = true +vim.g.vim_markdown_yaml_frontmatter = true +-- vim.g.vim_markdown_folding_level = 2 +vim.g.vim_markdown_strikethrough = true +vim.g.vim_markdown_auto_insert_bullets = true +vim.g.vim_markdown_new_list_item_indent = false +vim.g.vim_markdown_conceal = true +vim.g.vim_markdown_conceal_code_blocks = true diff --git a/.vim/lua/plugins/_neuron.lua b/.vim/lua/plugins/_neuron.lua new file mode 100644 index 0000000..d99a13f --- /dev/null +++ b/.vim/lua/plugins/_neuron.lua @@ -0,0 +1,15 @@ + +local def = require('utils').def + +require('neuron').setup { + virtual_titles = true, + mappings = true, + run = nil, + neuron_dir = "~/.zk", + leader = "gz", +} + +def("NeuronServe", [[ lua require('neuron').rib {address = "127.0.0.1:8200", verbose = true} ]]) +def("NeuronZettels", [[ lua require('neuron/telescope').find_zettels {insert = false} ]]) +def("NeuronZettelsInsert", [[ lua require('neuron/telescope').find_zettels {insert = true} ]]) +def("NeuronTags", [[ lua require('neuron/telescope').find_tags() ]]) diff --git a/.vim/lua/plugins/_telescope.lua b/.vim/lua/plugins/_telescope.lua index d4f9b89..4841862 100644 --- a/.vim/lua/plugins/_telescope.lua +++ b/.vim/lua/plugins/_telescope.lua @@ -1,98 +1,113 @@ -- telescope.nvim et al config -local u = require('utils') +local nnoremap = require('astronauta.keymap').nnoremap local M = {} -- TELESCOPE config -- {{{ require('telescope').setup{ - defaults = { - -- vimgrep_arguments = { - -- 'rg', - -- '--color=never', - -- '--no-heading', - -- '--with-filename', - -- '--line-number', - -- '--column', - -- '--smart-case' - -- }, - - prompt_prefix = ' >', - borderchars = {'─', '│', '─', '│', '┌', '┐', '┘', '└'}, - winblend = 0, - preview_cutoff = 120, - - layout_strategy = 'flex', - - file_previewer = require('telescope.previewers').vim_buffer_cat_new, - grep_previewer = require('telescope.previewers').vim_buffer_vimgrep_new, - qflist_previewer = require('telescope.previewers').vim_buffer_qflist_new, - - extensions = { - fzf_writer = { - use_highlighter = true, - minimum_grep_characters = 4, - shorten_path = true, - } - } - } + defaults = { + initial_mode = 'normal', + prompt_prefix = '> ', + selection_caret = '* ', + + -- copied from dropdown theme + sorting_strategy = 'ascending', + layout_strategy = 'center', + results_title = false, + preview_title = 'P', + preview_cutoff = 1, + width = 0.88, + results_height = 15, + borderchars = { + { '─', '│', '─', '│', '┌', '┐', '┘', '└'}, + prompt = {'─', '│', ' ', '│', '┌', '┐', '│', '│'}, + results = {'─', '│', '─', '│', '├', '┤', '┘', '└'}, + preview = { '─', '│', '─', '│', '┌', '┐', '┘', '└'}, + }, + + file_previewer = require('telescope.previewers').vim_buffer_cat.new, + grep_previewer = require('telescope.previewers').vim_buffer_vimgrep.new, + qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new, + + extensions = { + fzf_writer = { + use_highlighter = true, + minimum_grep_characters = 4, + shorten_path = true, + } + } + } } -- }}} --- LOCAL finders -- {{{ -M.wrap = function(opts) - opts = opts or {} - my_opts = require('telescope.themes').get_dropdown({ width = 110 }) - return vim.tbl_deep_extend("force", my_opts, opts) -end - -M.live_grep = function() - require('telescope').extensions.fzf_writer.staged_grep(M.wrap()) -end - -M.repo_search = function() - require('telescope').extensions.fzf_writer.files(M.wrap({ - previewer = false, - cwd = require('lspconfig.util').root_pattern('.git')(vim.fn.expand('%:p')), - })) -end - -M.wiki = function() - require('telescope').extensions.fzf_writer.files(M.wrap({ - previewer = false, - cwd = '~/wiki/', - })) -end - -M.devel = function() - require('telescope').extensions.fzf_writer.files(M.wrap({ - previewer = false, - cwd = '~/devel/', - })) -end --- }}} - -- MAPPINGS -- {{{ -u.map('n', ';g', "<cmd>lua require('plugins._telescope').live_grep()<cr>") -u.map('n', ';r', "<cmd>lua require('plugins._telescope').repo_search()<cr>") --- u.map('n', ';w', "<cmd>lua require('plugins._telescope').wiki()<cr>") -u.map('n', ';d', "<cmd>lua require('plugins._telescope').devel()<cr>") - -local mapbuiltin = function(key, fn, previewer) - opts = (not previewer and '{ previewer = false }') or '{}' - u.map('n', key, "<cmd>lua require('telescope.builtin')."..fn.."(require('plugins._telescope').wrap("..opts.."))<cr>") -end - -mapbuiltin(';f', 'fd', true) -mapbuiltin(';q', 'quickfix') -mapbuiltin(';l', 'loclist') -mapbuiltin(';b', 'buffers') -mapbuiltin(';t', 'tags') -mapbuiltin(';lr', 'lsp_references') -mapbuiltin(';la', 'lsp_code_actions') -mapbuiltin(';lw', 'lsp_workspace_symbols') -mapbuiltin(';c', 'command_history') +nnoremap { ';g', function() + require('telescope').extensions.fzf_writer.staged_grep() +end } + +nnoremap { ';w', function() + local wr = require('lspconfig.util').root_pattern('.git')(vim.fn.expand('%:p')) + require('telescope').extensions.fzf_writer.files({ + previewer = false, + cwd = wr, + }) +end } + +nnoremap { ';q', function() + local ids = vim.fn.getqflist({winid = 1}) + if ids and not (ids.winid == 0) then + vim.api.nvim_win_close(ids.winid, true) + end + require('telescope.builtin').quickfix() +end } + +nnoremap { ';l', function() + local ids = vim.fn.getloclist(0, {winid = 1}) + if ids and not (ids.winid == 0) then + vim.api.nvim_win_close(ids.winid, true) + end + require('telescope.builtin').loclist() +end } + +nnoremap { ';f', function() + require('telescope.builtin').fd() +end } + +nnoremap { ';b', function() + require('telescope.builtin').buffers() +end } + +nnoremap { ';t', function() + require('telescope.builtin').tags() +end } + +nnoremap { ';h', function() + require('telescope.builtin').command_history() +end } + +nnoremap { ';c', function() + require('telescope.builtin').commands() +end } + +-- LSP stuff + +nnoremap { 'gA', function() + require('telescope.builtin').lsp_code_actions() +end } + +nnoremap { 'gA', function() + require('telescope.builtin').lsp_code_actions() +end } + +nnoremap { 'g0', function() + require('telescope.builtin').lsp_document_symbols() +end } + +nnoremap { 'gr', function() + require('telescope.builtin').lsp_references() +end } -- }}} diff --git a/.vim/lua/plugins/_treesitter.lua b/.vim/lua/plugins/_treesitter.lua index ef24286..c5225bc 100644 --- a/.vim/lua/plugins/_treesitter.lua +++ b/.vim/lua/plugins/_treesitter.lua @@ -1,24 +1,24 @@ require('nvim-treesitter.configs').setup { - ensure_installed = { "c", "c_sharp", "javascript", "lua", "bash" }, - highlight = { - enable = false, - }, - indent = { - enable = true, - }, - refactor = { - navigation = { - enable = true, - keymaps = { - goto_definition = "<c-]>", - }, - }, - smart_rename = { - enable = true, - keymaps = { - smart_rename = "grr", - }, - }, - }, + ensure_installed = { "c", "c_sharp", "lua", "bash" }, + highlight = { + enable = false, + }, + indent = { + enable = true, + }, + refactor = { + navigation = { + enable = true, + keymaps = { + goto_definition = "<c-]>", + }, + }, + smart_rename = { + enable = true, + keymaps = { + smart_rename = "grr", + }, + }, + }, } diff --git a/.vim/lua/plugins/_ultisnips.lua b/.vim/lua/plugins/_ultisnips.lua index f2a6f6e..cd077d2 100644 --- a/.vim/lua/plugins/_ultisnips.lua +++ b/.vim/lua/plugins/_ultisnips.lua @@ -1,4 +1,4 @@ -- vim.g.UltiSnipsListSnippets = "<c-tab>" -vim.g.UltiSnipsExpandTrigger = "<Tab>" +vim.g.UltiSnipsExpandTrigger = vim.g.completion_confirm_key vim.g.UltiSnipsJumpForwardTrigger = "<c-n>" vim.g.UltiSnipsJumpBackwardTrigger = "<c-p>" diff --git a/.vim/lua/utils.lua b/.vim/lua/utils.lua index 271d593..1141e8d 100644 --- a/.vim/lua/utils.lua +++ b/.vim/lua/utils.lua @@ -4,42 +4,42 @@ local M = {} -- crutch until https://github.com/neovim/neovim/pull/13479 M.opt = function(scope, key, val) - local scopes = {o = vim.o, b = vim.bo, w = vim.wo} - if not ( scope and key and val ) then return end - scopes[scope][key] = val - if scope ~= 'o' then scopes['o'][key] = val end + local scopes = {o = vim.o, b = vim.bo, w = vim.wo} + if not ( scope and key and val ) then return end + scopes[scope][key] = val + if scope ~= 'o' then scopes['o'][key] = val end end M.map = function(mode, lhs, rhs, opts) - if not ( mode and lhs and rhs ) then return end - local o = {noremap = true, silent = true} - if opts then o = vim.tbl_extend('force', o, opts) end - vim.api.nvim_set_keymap(mode, lhs, rhs, o) + if not ( mode and lhs and rhs ) then return end + local o = {noremap = true, silent = true} + if opts then o = vim.tbl_extend('force', o, opts) end + vim.api.nvim_set_keymap(mode, lhs, rhs, o) end M.augroup = function(name, autocmds) - if not ( name and autocmds ) then return end - vim.cmd('augroup ' .. name) - vim.cmd('autocmd!') - for _, au in ipairs(autocmds) do - vim.cmd('autocmd ' .. table.concat(au, ' ')) - end - vim.cmd('augroup END') + if not ( name and autocmds ) then return end + vim.cmd('augroup ' .. name) + vim.cmd('autocmd!') + for _, au in ipairs(autocmds) do + vim.cmd('autocmd ' .. table.concat(au, ' ')) + end + vim.cmd('augroup END') end M.augroup2 = function(tbl) - for name, autocmds in pairs(tbl) do - vim.cmd('augroup ' .. name) - vim.cmd('autocmd!') - for _, au in ipairs(autocmds) do - vim.cmd('autocmd ' .. table.concat(au, ' ')) - end - vim.cmd('augroup END') - end + for name, autocmds in pairs(tbl) do + vim.cmd('augroup ' .. name) + vim.cmd('autocmd!') + for _, au in ipairs(autocmds) do + vim.cmd('autocmd ' .. table.concat(au, ' ')) + end + vim.cmd('augroup END') + end end M.def = function(name, cmd, ...) - local opts = table.concat((... or {}), ' ') - vim.cmd('command! ' .. opts .. ' ' .. name .. ' ' .. cmd) + local opts = table.concat((... or {}), ' ') + vim.cmd('command! ' .. opts .. ' ' .. name .. ' ' .. cmd) end return M diff --git a/.vim/plugin/packer_compiled.vim b/.vim/plugin/packer_compiled.vim index 36bdfe6..6e796b8 100644 --- a/.vim/plugin/packer_compiled.vim +++ b/.vim/plugin/packer_compiled.vim @@ -76,16 +76,32 @@ _G.packer_plugins = { needs_bufread = false, path = "/home/robert/.local/share/nvim/site/pack/packer/opt/limelight.vim" }, + ["lush.nvim"] = { + loaded = true, + path = "/home/robert/.local/share/nvim/site/pack/packer/start/lush.nvim" + }, neoformat = { loaded = true, path = "/home/robert/.local/share/nvim/site/pack/packer/start/neoformat" }, + neogit = { + commands = { "Neogit" }, + loaded = false, + needs_bufread = true, + path = "/home/robert/.local/share/nvim/site/pack/packer/opt/neogit" + }, + ["neuron.nvim"] = { + config = { "require('.plugins._neuron')" }, + loaded = true, + path = "/home/robert/.local/share/nvim/site/pack/packer/start/neuron.nvim" + }, ["nvim-colorizer.lua"] = { config = { "require('plugins._colorizer')" }, loaded = true, path = "/home/robert/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua" }, ["nvim-lightbulb"] = { + config = { "require('plugins._lightbulb')" }, loaded = true, path = "/home/robert/.local/share/nvim/site/pack/packer/start/nvim-lightbulb" }, @@ -154,11 +170,6 @@ _G.packer_plugins = { loaded = true, path = "/home/robert/.local/share/nvim/site/pack/packer/start/vim-github-link" }, - ["vim-indent-guides"] = { - config = { "require('plugins._indent-guides')" }, - loaded = true, - path = "/home/robert/.local/share/nvim/site/pack/packer/start/vim-indent-guides" - }, ["vim-indent-object"] = { loaded = true, path = "/home/robert/.local/share/nvim/site/pack/packer/start/vim-indent-object" @@ -208,16 +219,18 @@ _G.packer_plugins = { } } --- Config for: nvim-treesitter -require('plugins._treesitter') +-- Config for: nvim-lightbulb +require('plugins._lightbulb') -- Config for: completion-nvim require('plugins._completion') -- Config for: nvim-colorizer.lua require('plugins._colorizer') -- Config for: vim-sneak vim.g['sneak#label'] = true --- Config for: vim-indent-guides -require('plugins._indent-guides') +-- Config for: nvim-treesitter +require('plugins._treesitter') +-- Config for: nvim-lspconfig +require('plugins._lsp') -- Config for: vim-signify require('plugins._signify') -- Config for: git-messenger.vim @@ -226,12 +239,13 @@ require('plugins._git-messenger') require('plugins._telescope') -- Config for: ultisnips require('plugins._ultisnips') --- Config for: nvim-lspconfig -require('plugins._lsp') +-- Config for: neuron.nvim +require('.plugins._neuron') -- Command lazy-loads -vim.cmd [[command! -nargs=* -range -bang -complete=file Limelight lua require("packer.load")({'limelight.vim'}, { cmd = "Limelight", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args> }, _G.packer_plugins)]] vim.cmd [[command! -nargs=* -range -bang -complete=file Goyo lua require("packer.load")({'goyo.vim'}, { cmd = "Goyo", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args> }, _G.packer_plugins)]] +vim.cmd [[command! -nargs=* -range -bang -complete=file Limelight lua require("packer.load")({'limelight.vim'}, { cmd = "Limelight", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args> }, _G.packer_plugins)]] +vim.cmd [[command! -nargs=* -range -bang -complete=file Neogit lua require("packer.load")({'neogit'}, { cmd = "Neogit", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args> }, _G.packer_plugins)]] vim.cmd [[augroup packer_load_aucmds]] vim.cmd [[au!]] |