diff options
Diffstat (limited to '.vim/lua')
| -rw-r--r-- | .vim/lua/color_palette.lua | 32 | ||||
| -rw-r--r-- | .vim/lua/color_palette.lua.in | 32 | ||||
| -rw-r--r-- | .vim/lua/colors.lua | 225 | ||||
| -rw-r--r-- | .vim/lua/colors.lua.in | 298 | ||||
| -rw-r--r-- | .vim/lua/job.lua | 45 | ||||
| -rw-r--r-- | .vim/lua/lsp.lua | 168 | ||||
| -rw-r--r-- | .vim/lua/misc.lua | 26 | ||||
| -rw-r--r-- | .vim/lua/plugins.lua | 487 | ||||
| -rw-r--r-- | .vim/lua/plugins/_colorizer.lua | 8 | ||||
| -rw-r--r-- | .vim/lua/plugins/_completion.lua | 53 | ||||
| -rw-r--r-- | .vim/lua/plugins/_git-messenger.lua | 4 | ||||
| -rw-r--r-- | .vim/lua/plugins/_goyo.lua | 12 | ||||
| -rw-r--r-- | .vim/lua/plugins/_indent-guides.lua | 4 | ||||
| -rw-r--r-- | .vim/lua/plugins/_lightbulb.lua | 19 | ||||
| -rw-r--r-- | .vim/lua/plugins/_limelight.lua | 7 | ||||
| -rw-r--r-- | .vim/lua/plugins/_lsp.lua | 176 | ||||
| -rw-r--r-- | .vim/lua/plugins/_markdown.lua | 12 | ||||
| -rw-r--r-- | .vim/lua/plugins/_neuron.lua | 15 | ||||
| -rw-r--r-- | .vim/lua/plugins/_signify.lua | 10 | ||||
| -rw-r--r-- | .vim/lua/plugins/_telescope.lua | 114 | ||||
| -rw-r--r-- | .vim/lua/plugins/_treesitter.lua | 24 | ||||
| -rw-r--r-- | .vim/lua/plugins/_ultisnips.lua | 4 | ||||
| -rw-r--r-- | .vim/lua/plugins/_vimtex.lua | 8 | ||||
| -rw-r--r-- | .vim/lua/utils.lua | 29 |
24 files changed, 794 insertions, 1018 deletions
diff --git a/.vim/lua/color_palette.lua b/.vim/lua/color_palette.lua new file mode 100644 index 0000000..f30e97e --- /dev/null +++ b/.vim/lua/color_palette.lua @@ -0,0 +1,32 @@ +return { + 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', + }, +} diff --git a/.vim/lua/color_palette.lua.in b/.vim/lua/color_palette.lua.in new file mode 100644 index 0000000..4d3fe52 --- /dev/null +++ b/.vim/lua/color_palette.lua.in @@ -0,0 +1,32 @@ +return { + 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 }}', + }, +} diff --git a/.vim/lua/colors.lua b/.vim/lua/colors.lua index ac6109f..32af6b2 100644 --- a/.vim/lua/colors.lua +++ b/.vim/lua/colors.lua @@ -1,207 +1,149 @@ - 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] --- }}} +local p = require('color_palette') return lush(function() - return { - None { fg = 'none', bg = 'none', gui = 'none' }, - Underlined { gui = 'underline' }, -- (preferred) text that stands out, HTML links + return { Bold { gui = 'bold' }, Italic { gui = 'italic' }, + None { fg = 'none', bg = 'none', gui = 'none' }, Reverse { gui = 'reverse' }, + Underlined { gui = 'underline' }, -- (preferred) text that stands out, HTML links 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| + TermCursor { Cursor }, -- cursor in a focused terminal + TermCursorNC { Cursor }, -- cursor in an unfocused terminal + lCursor { Cursor }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') 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) + CursorLineNr { Cursor }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. DiffAdd { fg = hsl(p.bright.black), bg = hsl(p.bright.green) }, -- diff mode: Added line |diff.txt| - DiffChange { fg = hsl(p.bright.black), bg = hsl(p.bright.cyan) }, -- diff mode: Changed line |diff.txt| + DiffChange { fg = hsl(p.bright.black), bg = hsl(p.bright.cyan).darken(20) }, -- diff mode: Changed line |diff.txt| DiffDelete { fg = hsl(p.bright.black), bg = 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| + DiffText { DiffChange }, -- diff mode: Changed text within a changed line |diff.txt| + -- Directory { }, -- directory names (and other special names in listings) 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 -- ") + MoreMsg { fg = hsl(p.normal.cyan) }, -- |more-prompt| -- 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. + NormalFloat { Normal, bg = hsl(p.dim.white) }, -- 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. + PmenuSel { Pmenu, gui = 'reverse' }, -- Popup menu: selected item. 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. + SignColumn { gui = 'none' }, -- column where |signs| are displayed 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.bright.white), bg = 'none', gui = 'bold' }, -- status line of current window StatusLineNC { StatusLine, gui = 'none' }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + Substitute { fg = hsl(p.normal.blue) }, -- |:substitute| replacement text highlighting 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. + VertSplit { fg = hsl(p.dim.white), bg = 'none' }, -- the column separating vertically split windows 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 + Boolean { fg = hsl(p.bright.red).lighten(20) }, -- a boolean constant: TRUE, false 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 + Number { Boolean }, -- 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) }, - + Macro { fg = hsl(p.normal.cyan) }, -- same as Define + Constant { gui = 'bold' }, -- (preferred) any constant + Special { fg = hsl(p.normal.yellow) }, -- (preferred) any special symbol + SpecialComment { fg = hsl(p.bright.cyan), gui = 'italic' }, -- special things inside a comment Statement { fg = hsl(p.bright.blue) }, -- (preferred) any statement - Keyword { Statement }, -- any other keyword + Keyword { fg = hsl(p.normal.green) }, -- any other keyword + Tag { Special, gui = 'underline' }, -- you can use CTRL-] on this + Type { fg = hsl(p.bright.green) }, -- (preferred) int, long, char, etc. Conditional { Keyword }, -- if, then, else, endif, switch, etc. - Repeat { Keyword }, -- for, do, while, etc. + Define { Macro }, -- preprocessor #define + Delimiter { Special }, -- character that needs attention + Exception { Keyword }, -- try, catch, throw + Function { Normal }, -- function name (also: methods for classes) + Identifier { Normal }, -- (preferred) any variable name + Include { Macro }, -- preprocessor #include 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. + PreCondit { Macro }, -- preprocessor #if, #else, #endif, etc. + PreProc { Macro }, -- (preferred) generic Preprocessor + Repeat { Keyword }, -- for, do, while, etc. + SpecialChar { Special }, -- special character in a constant + Typedef { Type }, -- A typedef 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 + Ignore { None }, -- (preferred) left blank, hidden |hl-Ignore| 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' }, + -- C {{{ + -- cAnsiFunction { Bold }, + -- cAnsiName {}, + -- cBraces {}, -- cCharacter {}, - cConstant { Constant, gui = 'bold' }, -- cConditional { Bold }, - cSpecial { Bold }, + -- cCustomFunc {}, + -- cCustomParen {}, -- cDefine {}, + -- cDelimiter {}, + -- cFormat {}, + -- cFunction {}, + -- cIdentifier {}, + -- cLabel { fg = hsl(p.dim.black), bg = hsl(p.dim.red) }, -- cNumber {}, + -- cOctalZero { Bold }, + -- cOperator {}, -- cPreCondit {}, -- cRepeat {}, - -- cLabel { fg = hsl(p.dim.black), bg = hsl(p.dim.red) }, - -- cAnsiFunction { Bold }, - -- cAnsiName {}, - -- cDelimiter {}, - -- cBraces {}, - -- cIdentifier {}, -- cSemiColon {}, - -- cOperator {}, -- cStatement {}, + -- cStorageClass { Bold }, -- cTodo { Bold }, - cStructure { Bold }, - -- cCustomParen {}, - -- cCustomFunc {}, -- cUserFunction { Function, gui = 'bold' }, - -- cOctalZero { Bold }, - -- cFunction {}, - -- }}}2 + cBoolean { Boolean, gui = 'bold' }, + cConstant { Constant, gui = 'bold' }, + cSpecial { Bold }, + cStructure { Bold }, + cType { Type, gui = 'bold' }, + -- }}} - -- Markdown {{{2 + -- Markdown {{{ -- mkdCode { markdownCode }, + mkdBlockQuote { Comment }, + mkdDelimiter { Delimiter }, + mkdHeading { Title }, mkdID { Constant }, - mkdURL { Tag }, mkdLink { Tag }, mkdLinkTitle { bg = hsl('#ff0000') }, - mkdDelimiter { Delimiter }, - mkdBlockQuote { Comment }, mkdListItem { Number }, - mkdHeading { Title }, - -- 2}}} + mkdURL { Tag }, + -- }}} -- }}} -- LSP {{{ @@ -215,9 +157,9 @@ return lush(function() LspDiagnosticsVirtualTextWarning { fg = LspDiagnosticsWarning.fg.darken(60) }, LspDiagnosticsSignWarning { LspDiagnosticsWarning }, - LspDiagnosticsInformation { fg = hsl(p.normal.blue).lighten(20) }, -- used for "Information" diagnostics + LspDiagnosticsInformation { MoreMsg }, -- used for "Information" diagnostics LspDiagnosticsFloatingInformation { LspDiagnosticsInformation }, - LspDiagnosticsVirtualTextInformation { fg = LspDiagnosticsInformation.fg.darken(30) }, + LspDiagnosticsVirtualTextInformation { fg = LspDiagnosticsInformation.fg.darken(20) }, LspDiagnosticsSignInformation { LspDiagnosticsInformation }, LspDiagnosticsHint { fg = hsl(p.normal.white) }, -- used for "Hint" diagnostics @@ -231,7 +173,7 @@ return lush(function() -- }}} -- TreeSitter {{{ - -- TSError { }, -- For syntax/parser errors. + TSError { Error }, -- 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. @@ -281,14 +223,18 @@ return lush(function() IndentGuidesOdd { bg = hsl(p.bright.black) }, IndentGuidesEven { bg = hsl(p.dim.white).darken(40) }, + IndentBlanklineChar { fg = hsl(p.dim.white), gui = 'nocombine'}, + + -- signify {{{ SignifyLineChange { DiffChange }, SignifyLineAdd { DiffAdd }, SignifyLineDelete { DiffDelete }, SignifySignChange { fg = SignifyLineChange.bg }, SignifySignAdd { fg = SignifyLineAdd.bg }, SignifySignDelete { fg = SignifyLineDelete.bg }, + -- }}} - -- git + -- git {{{ gitcommitSummary { Bold }, -- gitcommitHeader { Bold }, -- gitcommitSelectedType {}, @@ -305,13 +251,34 @@ return lush(function() -- diffLine {}, -- diffBDiffer {}, -- diffNewFile {}, + -- }}} - -- git-messenger + -- git-messenger {{{ gitmessengerPopupNormal { CursorLine }, gitmessengerHeader { Statement }, gitmessengerHash { Special }, gitmessengerHistory { Title }, gitmessengerEmail { Comment }, + -- }}} + + -- nvim-lightbulb {{{ + LightBulbFloatWin { LspDiagnosticsFloatingHint }, + LightBulbVirtualText { LspDiagnosticsVirtualTextHint }, + -- }}} + + CompeDocumentation { NormalFloat }, + + -- startify {{{ + StartifyBracket { fg = hsl(p.bright.blue) }, + StartifyFile { fg = hsl(p.normal.red), gui = 'bold' }, + StartifyNumber { fg = hsl(p.bright.blue).darken(20) }, + StartifyPath { fg = hsl(p.normal.green).lighten(10) }, + StartifySlash { fg = hsl(p.normal.white) }, + StartifySection { fg = hsl(p.bright.yellow) }, + StartifySpecial { fg = hsl(p.normal.red) }, + StartifyHeader { fg = hsl(p.dim.white) }, + StartifyFooter { fg = hsl(p.dim.white) }, + -- }}} -- Plugin configs END }}} @@ -320,7 +287,5 @@ return lush(function() StatusLineCommand { StatusLine }, StatusLineVisual { Visual }, StatusLineReplace { StatusLine }, - } + } end) - --- vi:nowrap diff --git a/.vim/lua/colors.lua.in b/.vim/lua/colors.lua.in deleted file mode 100644 index caafa52..0000000 --- a/.vim/lua/colors.lua.in +++ /dev/null @@ -1,298 +0,0 @@ - -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/job.lua b/.vim/lua/job.lua new file mode 100644 index 0000000..a3591e5 --- /dev/null +++ b/.vim/lua/job.lua @@ -0,0 +1,45 @@ + +local M = {} + +function M.jobstart(cmd) + local output = {} + + local function on_event(job_id, data, event) + if event == 'stdout' or event == 'stderr' then + if data then + vim.list_extend(output, data) + end + end + if event == 'exit' then + vim.fn.setqflist({}, ' ', { + title = cmd, + lines = output, + }) + vim.api.nvim_command('doautocmd QuickFixCmdPost') + end + end + + local job_id = require('spinner.job').jobstart(cmd, { + on_stdout = on_event, + on_stderr = on_event, + on_exit = on_event, + stdout_buffered = true, + stderr_buffered = true, + }) + return job_id +end + +function M.make(args) + local args = args or {} + local makeprg = vim.opt.makeprg:get() + local cmd = vim.split(vim.fn.expandcmd(makeprg), ' ') + table.foreach(args, function(_, v) table.insert(cmd, v) end) + return M.jobstart(cmd) +end + +function M.sh(cmd) + local cmd = {vim.env.SHELL, '-c', cmd} + return M.jobstart(cmd) +end + +return M diff --git a/.vim/lua/lsp.lua b/.vim/lua/lsp.lua new file mode 100644 index 0000000..0e5f736 --- /dev/null +++ b/.vim/lua/lsp.lua @@ -0,0 +1,168 @@ +local lsp = require('lspconfig') +local nnoremap = require('astronauta.keymap').nnoremap +local spinner_lsp= require('spinner.lsp') + +local my_attach = function(client, bufnr) + spinner_lsp.on_attach(client, bufnr) + + -- lsp mappings + nnoremap { 'K' , vim.lsp.buf.hover } + nnoremap { '<C-]>' , vim.lsp.buf.definition } + nnoremap { 'gd' , vim.lsp.buf.definition } + nnoremap { 'grr' , vim.lsp.buf.rename } + nnoremap { '<c-h>' , vim.lsp.buf.signature_help } + nnoremap { ']d' , vim.lsp.diagnostic.goto_next } + nnoremap { '[d' , vim.lsp.diagnostic.goto_prev } + + nnoremap { '<leader>f' , vim.lsp.buf.formatting } + -- nnoremap { 'g0', vim.lsp.buf.document_symbol } + nnoremap { 'gR' , vim.lsp.buf.references } + nnoremap { 'gW' , vim.lsp.buf.workspace_symbol } + nnoremap { 'gD' , vim.lsp.buf.declaration } + nnoremap { 'gT' , vim.lsp.buf.type_definition } + nnoremap { 'gI' , vim.lsp.buf.implementation } + + -- nnoremap <silent> ;s <cmd> lua vim.lsp.buf.signature_help()<CR> + nnoremap { '<leader>d' , vim.lsp.diagnostic.show_line_diagnostics } + + require('utils').augroup2 { + lsp_user = { + {'BufWritePre' , '*' , 'lua vim.lsp.buf.formatting_seq_sync(nil, 1000)'}, + {'BufWritePre' , '*.go' , 'lua vim.lsp.buf.code_action({ only = {"source.organizeImports"} })'}, + {'CursorHold' , '*' , 'lua vim.lsp.diagnostic.show_line_diagnostics()'}, + } + } +end + +local setup = function() + local caps = vim.lsp.protocol.make_client_capabilities() + -- enable lsp-based snippets + caps.textDocument.completion.completionItem.snippetSupport = true + caps.textDocument.completion.completionItem.resolveSupport = { + properties = { + 'documentation', + 'detail', + 'additionalTextEdits', + } + } + + spinner_lsp.setup() + spinner_lsp.init_capabilities(caps) + + -- handler overwrites + -- configure builtin diagnositics + vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( -- {{{ + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = false, + signs = true, + underline = true, + update_in_insert = false, + } + ) + -- }}} + + -- 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 + -- }}} + + vim.fn.sign_define("LspDiagnosticsSignError", {text="⚡", numhl="Error"}) + vim.fn.sign_define("LspDiagnosticsSignWarning", {text="⯈", numhl="Warning"}) + vim.fn.sign_define("LspDiagnosticsSignInformation", {text="ℹ"}) + vim.fn.sign_define("LspDiagnosticsSignHint", {text="🞶"}) + + -- lsp.ccls.setup { + -- on_attach = my_attach, + -- capabilities = caps, + -- } + + lsp.gopls.setup { + on_attach = my_attach, + capabilities = caps, + settings = { + gopls = { + -- analyses = { + -- composites = false + -- }, + codelenses = { + test = true, + tidy = true, + }, + gofumpt = true, + } + } + } + + lsp.sumneko_lua.setup { + on_attach = my_attach, + capabilities = caps, + 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, + capabilities = caps, + cmd = { 'env', 'CARGO_TARGET_DIR=/tmp', 'rust-analyzer' }, + } + + lsp.zls.setup { + on_attach = my_attach, + capabilities = caps, + } + +end + +return { + my_attach = my_attach, + setup = setup +} diff --git a/.vim/lua/misc.lua b/.vim/lua/misc.lua index 4f2b9dc..0067efb 100644 --- a/.vim/lua/misc.lua +++ b/.vim/lua/misc.lua @@ -31,4 +31,30 @@ function M.open_under_cursor(cmd) end) end +function get_visual_selection() + pos1 = vim.fn.getpos("'<") + ln1, col1 = pos1[2], pos1[3] + pos2 = vim.fn.getpos("'>") + ln2, col2 = pos2[2], pos2[3] + lines = vim.fn.getline(ln1, ln2) + if vim.opt.selection:get() == 'inclusive' then + lines[#lines] = lines[#lines]:sub(1,col2) + else + lines[#lines] = lines[#lines]:sub(1,col2-1) + end + lines[1] = lines[1]:sub(col1) + return pos1, pos2, lines +end + +function M.sort_line() + local fn = vim.fn + pos1, pos2, lines = get_visual_selection() + for i=1, #lines do + local ln = pos1[2] + (i-1) + local line = fn.join(fn.sort(fn.split(lines[i], " "))) + line = fn.substitute(fn.getline(ln), lines[i], line, "") + vim.fn.setline(ln, line) + end +end + return M diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua index f5f9a37..cb8bdb1 100644 --- a/.vim/lua/plugins.lua +++ b/.vim/lua/plugins.lua @@ -1,14 +1,22 @@ +-- vim: foldenable -- load by calling `lua require('plugins')` from your init.vim local g = vim.g local u = require('utils') --- local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim' --- if vim.fn.empty(vim.fn.glob(install_path)) > 0 then --- vim.fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }) --- vim.api.nvim_command 'packadd packer.nvim' --- end +-- force packer into a system directory +local sysdata = vim.fn.stdpath('data_dirs')[1] -function disable_distribution_plugins() +local install_path = sysdata .. '/site/pack/packer/start/packer.nvim' +if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + vim.fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }) + vim.api.nvim_command 'packadd packer.nvim' +end + +if not vim.fn.filewritable(vim.fn.stdpath('cache')) == 2 then + return +end + +function disable_distribution_plugins() --{{{ g.loaded_gzip = 1 g.loaded_tar = 1 g.loaded_tarPlugin = 1 @@ -27,12 +35,9 @@ function disable_distribution_plugins() 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]] +end -- }}} -return require'packer'.startup(function() +return require('packer').startup({function() -- disable built-in plugins disable_distribution_plugins() @@ -40,119 +45,388 @@ return require'packer'.startup(function() use {'wbthomason/packer.nvim'} -- git status in the sign column - use {'mhinz/vim-signify', - config = "require('plugins._signify')" - } + use {'mhinz/vim-signify', -- {{{ + config = function() + local nnoremap = require('astronauta.keymap').nnoremap + + vim.g.signify_sign_change = '~' + + nnoremap { ']h', function() vim.fn['sy#jump#next_hunk'](1) end } + nnoremap { '[h', function() vim.fn['sy#jump#prev_hunk'](1) end } + end} -- }}} use {'tpope/vim-commentary'} -- auto-comment using `gcc` - use {'cohama/lexima.vim'} -- auto-close parens, brackets, etc. + + use {'windwp/nvim-autopairs', + config = function() + require('nvim-autopairs').setup() + end} + 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 {'ggandor/lightspeed.nvim'} + + use {'jose-elias-alvarez/null-ls.nvim', -- {{{ + requires = {'nvim-lua/plenary.nvim'}, + config = function() + local nls = require('null-ls') + nls.config { + sources = { + nls.builtins.formatting.clang_format, -- c* + nls.builtins.formatting.gofumpt, -- go + nls.builtins.formatting.json_tool, -- json + nls.builtins.formatting.rustfmt, -- rust + nls.builtins.formatting.shfmt, -- *sh + nls.builtins.formatting.yapf, -- python + nls.builtins.diagnostics.shellcheck, -- *sh + } + } + + require('lspconfig')['null-ls'].setup { + on_attach = require('lsp').my_attach + } + end} -- }}} use {'neovim/nvim-lspconfig', - requires = { - {'kosayoda/nvim-lightbulb', config = "require('plugins._lightbulb')"}, - }, - config = "require('plugins._lsp')" - } + requires = {'~/devel/projects/spinner.nvim'}, + config = function() + require('lsp').setup() + end} + + use {'kosayoda/nvim-lightbulb', -- {{{ + config = function() + require('nvim-lightbulb').update_lightbulb { + sign = { + enabled = true, + priority = 10, + }, + float = { + enabled = true, + text = ' ', + win_opts = {}, + }, + virtual_text = { + enabled = false, + text = ' ', + }, + status_text = { + enabled = false, + } + } + + vim.fn.sign_define('LightBulbSign', {text="⚐", texthl="LightBulbVirtualText"}) - use {'nvim-treesitter/nvim-treesitter', + require('utils').augroup2 { + lightbulb = { + {'CursorHold', '*', "lua require('nvim-lightbulb').update_lightbulb()"} + } + } + end} -- }}} + + use {'nvim-treesitter/nvim-treesitter', -- {{{ + run = ':TSUpdate', requires = { 'nvim-treesitter/completion-treesitter', 'nvim-treesitter/nvim-treesitter-refactor', }, - config = "require('plugins._treesitter')", - run = ':TSUpdate', - } + config = function() + require('nvim-treesitter.configs').setup { + ensure_installed = { + "bash", + "c", + "c_sharp", + "css", + "dockerfile", + "html", + "go", "gomod", + "javascript", + "ledger", + "lua", + "rust", + "typescript", + }, + highlight = { + enable = false, + }, + indent = { + enable = true, + }, + refactor = { + navigation = { + enable = true, + keymaps = { + goto_definition = "<c-]>", + }, + }, + smart_rename = { + enable = true, + keymaps = { + smart_rename = "grr", + }, + }, + }, + } + end} -- }}} - use {'nvim-lua/completion-nvim', - requires = {'steelsojka/completion-buffers'}, - config = "require('plugins._completion')", - } + use {'hrsh7th/nvim-compe', -- {{{ + -- requires nvim-autopairs + config = function() + require('compe').setup { + enabled = true, + autocomplete = true, + preselect = 'enable', + documentation = { + border = 'single', + }, + source = { + path = true, + buffer = true, + tags = true, + nvim_lsp = true, + nvim_lua = true, + orgmode = true, + ultisnips = true, + } + } - -- use {'hrsh7th/nvim-compe', - -- config = "require('plugins._compe')", - -- } + vim.cmd [[ + inoremap <silent><expr> <c-space> compe#complete() + inoremap <silent><expr> <c-e> compe#close('<c-e>') + ]] + + require('nvim-autopairs.completion.compe').setup { + map_cr = true, + map_complete = true, + } + end} -- }}} - use {'nvim-telescope/telescope.nvim', + 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')" - } + config = function() + local nnoremap = require('astronauta.keymap').nnoremap + + require('telescope').setup{ + defaults = { + -- initial_mode = 'input', + prompt_prefix = '> ', + selection_caret = '* ', + + sorting_strategy = 'ascending', + + preview_title = '', + layout_strategy = 'bottom_pane', + layout_config = { + preview_cutoff = 1, + height = 20, + }, + border = true, + borderchars = { + 'z', + prompt = { '─', ' ', ' ', ' ', '─', '─', ' ', ' ' }, + results = { ' ' }, + -- results = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' }, + preview = { '─', '│', '─', '│', '┌', '┐', '┘', '└'}, + + -- "center" + -- { '─', '│', '─', '│', '┌', '┐', '┘', '└'}, + -- 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, + } + } + } + } + + nnoremap { ';q', require('telescope.builtin').quickfix } + nnoremap { ';c', require('telescope.builtin').loclist } + + nnoremap { ';g', require('telescope').extensions.fzf_writer.staged_grep } + nnoremap { ';f', require('telescope.builtin').fd } + nnoremap { ';l', require('telescope.builtin').current_buffer_fuzzy_find } + nnoremap { ';w', require('telescope.builtin').file_browser } + nnoremap { ';b', require('telescope.builtin').buffers } + nnoremap { ';t', require('telescope.builtin').tags } + nnoremap { ';h', require('telescope.builtin').command_history } + nnoremap { ';H', require('telescope.builtin').help_tags } + nnoremap { ';c', require('telescope.builtin').commands } + + nnoremap { ';v', function() + require('telescope.builtin').find_files({ + prompt_title = 'vimrc', + previewer = false, + cwd = vim.fn.stdpath('config'), + }) + end } + + -- LSP stuff + nnoremap { ';a', require('telescope.builtin').lsp_code_actions } + nnoremap { ';0', require('telescope.builtin').lsp_document_symbols } + nnoremap { ';r', require('telescope.builtin').lsp_references } + end} -- }}} -- polyfill for some missing stuff use {'tjdevries/astronauta.nvim'} -- snippets - use {'SirVer/ultisnips', + use {'SirVer/ultisnips', -- {{{ requires = {'honza/vim-snippets'}, - config = "require('plugins._ultisnips')" - } + config = function() + vim.g.UltiSnipsJumpForwardTrigger = "<tab>" + vim.g.UltiSnipsJumpBackwardTrigger = "<s-tab>" + end} -- }}} + + -- use {'L3MON4D3/LuaSnip', + -- config = "require('plugins._ultisnips')", + -- } use {'junegunn/vim-easy-align'} - use {'editorconfig/editorconfig-vim', - config = "require('plugins._editorconfig')" - } - -- use {'tpope/vim-sleuth'} -- detect indentation - use {'nathanaelkane/vim-indent-guides', - disable = true, - config = "require('plugins._indent-guides')" - } + use {'editorconfig/editorconfig-vim', -- {{{ + config = function() + require('utils').augroup2 { + editorconfig = { + { 'FileType', 'gitcommit', 'let b:EditorConfig_disable = 1' }, + } + } + end} -- }}} - use {'tpope/vim-repeat'} -- extend '.' to plugins - 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 {'lukas-reineke/indent-blankline.nvim', + config = function() + vim.g.indent_blankline_char = '▏' + end} - use {'rhysd/git-messenger.vim', - config = "require('plugins._git-messenger')" - } + use {'tpope/vim-repeat'} -- extend '.' to plugins + use {'michaeljsmith/vim-indent-object'} -- indentation text-objects + use {'kshenoy/vim-signature', disable = true} -- toggle, display and navigate marks + use {'norcalli/nvim-colorizer.lua', -- {{{ + config = function() + require('colorizer').setup(nil, { + name = true; + RRGGBB = true; + RRGGBBAA = false; + rgb_fn = true; + hsl_fn = true; + mode = 'background'; + }) + end} -- }}} - use {'TimUntersberger/neogit'} + use {'rhysd/git-messenger.vim', -- {{{ + config = function() + -- vim.g.git_messenger_include_diff = false + vim.g.git_messenger_always_into_popup = true + vim.g.git_messenger_close_on_cursor_moved = true + vim.g.git_messenger_no_default_mappings = true + end} -- }}} + -- use {'TimUntersberger/neogit', + -- config = "require('astronauta.keymap').nnoremap { '<leader>gg', function() require('neogit').open({ kind = 'split' }) end }" + -- } + + use {'liuchengxu/vista.vim'} 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', + use {'oberblastmeister/neuron.nvim', -- {{{ branch = 'unstable', requires = {'nvim-telescope/telescope.nvim'}, - config = "require('.plugins._neuron')" - } + config = function() + require('neuron').setup { + virtual_titles = true, + mappings = true, + run = nil, + neuron_dir = "~/.zk", + leader = "gz", + } + + vim.cmd [[ command! NeuronServe lua require('neuron').rib {address = "127.0.0.1:8200", verbose = true} ]] + vim.cmd [[ command! NeuronZettels lua require('neuron.telescope').find_zettels {insert = false} ]] + vim.cmd [[ command! NeuronZettelsInsert lua require('neuron.telescope').find_zettels {insert = true} ]] + vim.cmd [[ command! NeuronTags lua require('neuron.telescope').find_tags() ]] + end} -- }}} + + use {'kristijanhusak/orgmode.nvim', -- {{{ + config = function() + local nnoremap = require('astronauta.keymap').nnoremap + + require('orgmode').setup { + org_agenda_files = {'$HOME/.zk/.orgmode/*.org'}, + org_default_notes_file = '$HOME/.zk/.orgmode/todo.org', + } + + local pickers = require('telescope.pickers') + local finders = require('telescope.finders') + + nnoremap { ';o', function() + pickers.new(opts, { + prompt_title = 'Orgmode', + finder = finders.new_table(require('orgmode.config'):get_all_files()), + }):find() + end } + + vim.cmd [[ command! Orgmode lua require('orgmode').action('agenda.prompt') ]] + vim.cmd [[ command! OrgmodeCapture lua require('orgmode').action('capture.refile') ]] + vim.cmd [[ command! OrgmodeInsert lua require('orgmode').action('org_mappings.insert_heading_respect_content') ]] + vim.cmd [[ command! OrgmodeTodoCycle lua require('orgmode').action('org_mappings.todo_next_state') ]] + vim.cmd [[ command! OrgmodeTag lua require('orgmode').action('org_mappings.set_tags') ]] + vim.cmd [[ command! OrgmodeArchive lua require('orgmode').action('org_mappings.toggle_archive_tag') ]] + end} -- }}} -- languages -- NOTE: these should only be loaded when they are required... -- use {'rhysd/vim-grammarous', -- ft = {'markdown', 'latex', 'tex'} -- } - use {'lervag/vimtex', + use {'lervag/vimtex', -- {{{ ft = {'latex', 'tex'}, - config = "require('plugins._vimtex')" - } - use {'plasticboy/vim-markdown', + config = function() + vim.g.tex_flavor = 'latex' + vim.g.vimtex_compiler_enabled = 0 + vim.g.vimtex_compiler_method = 'tectonic' + vim.g.vimtex_compiler_tectonic = "{'executable': 'tectonic'}" + vim.g.vimtex_view_method = 'zathura' + -- vim.g.vimtex_view_zathura_check_libsynctex = false + -- vim.g.vimtex_view_use_temp_files = true + -- vim.g.vimtex_view_forward_search_on_start = false + end} -- }}} + + use {'plasticboy/vim-markdown', -- {{{ ft = {'markdown'}, - config = "require('plugins._markdown')" - } - use {'masukomi/vim-markdown-folding', - ft = {'markdown'} - } - use {'jjo/vim-cue', - ft = {'cue'} - } + config = function() + 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 + end} -- }}} + + use {'masukomi/vim-markdown-folding', ft = {'markdown'}} + use {'jjo/vim-cue', ft = {'cue'}} use {'gentoo/gentoo-syntax'} -- multi-language support with lazy loading @@ -160,22 +434,53 @@ return require'packer'.startup(function() g.polyglot_disabled = { 'autoindent' } 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 {'folke/zen-mode.nvim', -- {{{ + config = function() + require('zen-mode').setup { + window = { + backdrop = 1, + width = 0.3, + -- height = 1, + options = { + number = false, + list = false, + }, + }, + plugins = { + options = { + enabled = true, + ruler = false, + showcmd = false, + }, + twilight = { enabled = true }, + } + } + end} -- }}} - use {'rktjmp/lush.nvim',} - -- config="require('colors')"} + use {'folke/twilight.nvim', -- {{{ + config = function() + require('twilight').setup { + context = 15, + dimming = { + alpha = 0.3, + color = { 'Normal', '#ffffff' }, + }, + } + end} -- }}} - -- vim config debugging - use {'dstein64/vim-startuptime', disable = true} + use {'mhinz/vim-startify', -- {{{ + config = function() + require('utils').augroup2 { + startify = {{ 'FileType', 'startify', [[ IndentBlanklineDisable ]] }} + } + end} -- }}} + + use {'rktjmp/lush.nvim'} -- local use {'~/devel/upstream/github.com/knsh14/vim-github-link'} -end) + +end, +config = { + package_root = require('packer.util').join_paths(sysdata, 'site', 'pack'), +}}) diff --git a/.vim/lua/plugins/_colorizer.lua b/.vim/lua/plugins/_colorizer.lua deleted file mode 100644 index 7b6f678..0000000 --- a/.vim/lua/plugins/_colorizer.lua +++ /dev/null @@ -1,8 +0,0 @@ -require('colorizer').setup(nil, { - name = true; - RRGGBB = true; - RRGGBBAA = false; - rgb_fn = true; - hsl_fn = true; - mode = 'background'; -}) diff --git a/.vim/lua/plugins/_completion.lua b/.vim/lua/plugins/_completion.lua deleted file mode 100644 index 5497c4b..0000000 --- a/.vim/lua/plugins/_completion.lua +++ /dev/null @@ -1,53 +0,0 @@ -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_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', 'path', 'buffers', 'ts'}}, - -- {mode = '<c-p>'}, - -- {mode = '<c-n>'}, - {mode = 'file'}, - {mode = 'spel'}, -} - -u.augroup2 { - completion_user = {{'BufEnter', '*', 'lua require("completion").on_attach()'}} -} - -inoremap { '<tab>', require('completion').smart_tab} -inoremap { '<s-tab>', require('completion').smart_s_tab } -inoremap { '<c-j>', require('completion.source').nextCompletion } -inoremap { '<c-k>', require('completion.source').prevCompletion } - --- 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/_git-messenger.lua b/.vim/lua/plugins/_git-messenger.lua deleted file mode 100644 index dceadeb..0000000 --- a/.vim/lua/plugins/_git-messenger.lua +++ /dev/null @@ -1,4 +0,0 @@ --- vim.g.git_messenger_include_diff = false -vim.g.git_messenger_always_into_popup = true -vim.g.git_messenger_close_on_cursor_moved = true -vim.g.git_messenger_no_default_mappings = true diff --git a/.vim/lua/plugins/_goyo.lua b/.vim/lua/plugins/_goyo.lua deleted file mode 100644 index 538712d..0000000 --- a/.vim/lua/plugins/_goyo.lua +++ /dev/null @@ -1,12 +0,0 @@ -vim.g.goyo_width = 120 -vim.g.goyo_height = 90 -vim.g.goyo_linenr = false - -require('utils').augroup2 { - goyo_hooks = { - {'User', 'GoyoEnter', 'set laststatus=0 scrolloff=999'}, - {'User', 'GoyoEnter', 'Limelight'}, - {'User', 'GoyoLeave', 'set laststatus=2 scrolloff=5'}, - {'User', 'GoyoLeave', 'Limelight!'}, - } -} diff --git a/.vim/lua/plugins/_indent-guides.lua b/.vim/lua/plugins/_indent-guides.lua deleted file mode 100644 index eb3c4aa..0000000 --- a/.vim/lua/plugins/_indent-guides.lua +++ /dev/null @@ -1,4 +0,0 @@ -vim.g.indent_guides_enable_on_vim_startup = false -vim.g.indent_guides_start_level = 2 -vim.g.indent_guides_color_change_percent = 2 -vim.g.indent_guides_guide_size = 1 diff --git a/.vim/lua/plugins/_lightbulb.lua b/.vim/lua/plugins/_lightbulb.lua deleted file mode 100644 index cc3f941..0000000 --- a/.vim/lua/plugins/_lightbulb.lua +++ /dev/null @@ -1,19 +0,0 @@ - -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/_limelight.lua b/.vim/lua/plugins/_limelight.lua deleted file mode 100644 index b77fdfc..0000000 --- a/.vim/lua/plugins/_limelight.lua +++ /dev/null @@ -1,7 +0,0 @@ -vim.g.limelight_conceal_ctermfg = 'gray' -vim.g.limelight_conceal_ctermbg = 'none' -vim.g.limelight_conceal_guifg = '#828282' -vim.g.limelight_conceal_guibg = 'none' -vim.g.limelight_default_coefficient = 0.5 -vim.g.limelight_paragraph_span = 1 -vim.g.limelight_priority = -1 diff --git a/.vim/lua/plugins/_lsp.lua b/.vim/lua/plugins/_lsp.lua deleted file mode 100644 index 39a10b9..0000000 --- a/.vim/lua/plugins/_lsp.lua +++ /dev/null @@ -1,176 +0,0 @@ --- lsp config - -local lsp = require('lspconfig') -local util = require('lspconfig.util') -local u = require('utils') -local nnoremap = require('astronauta.keymap').nnoremap - -local M = {} -local my_attach = function(client) - -- attach completion - require 'completion'.on_attach(client) - - -- lsp mappings - nnoremap { 'K' , vim.lsp.buf.hover } - nnoremap { '<C-]>' , vim.lsp.buf.definition } - nnoremap { 'gd' , vim.lsp.buf.definition } - nnoremap { 'grr' , vim.lsp.buf.rename } - nnoremap { '<c-h>' , vim.lsp.buf.signature_help } - nnoremap { ']d' , vim.lsp.diagnostic.goto_next } - nnoremap { '[d' , vim.lsp.diagnostic.goto_prev } - - nnoremap { '<leader>f' , vim.lsp.buf.formatting } - -- nnoremap { 'g0', vim.lsp.buf.document_symbol } - nnoremap { 'gR' , vim.lsp.buf.references } - nnoremap { 'gW' , vim.lsp.buf.workspace_symbol } - nnoremap { 'gD' , vim.lsp.buf.declaration } - nnoremap { 'gT' , vim.lsp.buf.type_definition } - nnoremap { 'gI' , vim.lsp.buf.implementation } - - -- nnoremap <silent> ;s <cmd> lua vim.lsp.buf.signature_help()<CR> - nnoremap { '<leader>d' , vim.lsp.diagnostic.show_line_diagnostics } - - 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 = false, - } -) --- }}} - --- 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="⚡", numhl="Error"}) -vim.fn.sign_define("LspDiagnosticsSignWarning", {text="⯈", numhl="Warning"}) -vim.fn.sign_define("LspDiagnosticsSignInformation", {text="≈"}) -vim.fn.sign_define("LspDiagnosticsSignHint", {text="🞶"}) --- }}} - --- lsp.ccls.setup{ --- on_attach = my_attach, --- } - -lsp.gopls.setup{ - 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, - } - } - } - } -} - -lsp.rust_analyzer.setup{ - 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", "c" }, - 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 deleted file mode 100644 index e02e160..0000000 --- a/.vim/lua/plugins/_markdown.lua +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index d99a13f..0000000 --- a/.vim/lua/plugins/_neuron.lua +++ /dev/null @@ -1,15 +0,0 @@ - -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/_signify.lua b/.vim/lua/plugins/_signify.lua deleted file mode 100644 index 41ced80..0000000 --- a/.vim/lua/plugins/_signify.lua +++ /dev/null @@ -1,10 +0,0 @@ -local def = require('utils').def -local nnoremap = require('astronauta.keymap').nnoremap - -vim.g.signify_sign_change = '~' - -nnoremap { ']h', function() vim.fn['sy#jump#next_hunk'](1) end } -nnoremap { '[h', function() vim.fn['sy#jump#prev_hunk'](1) end } - -def("SignifyNextHunk", [[ call sy#jump#next_hunk(1) ]]) -def("SignifyPrevHunk", [[ call sy#jump#prev_hunk(1) ]]) diff --git a/.vim/lua/plugins/_telescope.lua b/.vim/lua/plugins/_telescope.lua deleted file mode 100644 index 44931fa..0000000 --- a/.vim/lua/plugins/_telescope.lua +++ /dev/null @@ -1,114 +0,0 @@ --- telescope.nvim et al config - -local nnoremap = require('astronauta.keymap').nnoremap - -local M = {} - --- TELESCOPE config -- {{{ -require('telescope').setup{ - 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, - } - } - } -} --- }}} - --- MAPPINGS -- {{{ - -nnoremap { ';g', function() - require('telescope').extensions.fzf_writer.staged_grep() -end } - -nnoremap { ';w', function() - require('telescope.builtin').find_files({ - prompt_title = 'workspace', - previewer = false, - cwd = vim.lsp.buf.list_workspace_folders()[1] or require('lspconfig.util').root_pattern('.git')(vim.fn.expand('%:p')), - }) -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 } - --- }}} - -return M diff --git a/.vim/lua/plugins/_treesitter.lua b/.vim/lua/plugins/_treesitter.lua deleted file mode 100644 index c5225bc..0000000 --- a/.vim/lua/plugins/_treesitter.lua +++ /dev/null @@ -1,24 +0,0 @@ - -require('nvim-treesitter.configs').setup { - 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 deleted file mode 100644 index cd077d2..0000000 --- a/.vim/lua/plugins/_ultisnips.lua +++ /dev/null @@ -1,4 +0,0 @@ --- vim.g.UltiSnipsListSnippets = "<c-tab>" -vim.g.UltiSnipsExpandTrigger = vim.g.completion_confirm_key -vim.g.UltiSnipsJumpForwardTrigger = "<c-n>" -vim.g.UltiSnipsJumpBackwardTrigger = "<c-p>" diff --git a/.vim/lua/plugins/_vimtex.lua b/.vim/lua/plugins/_vimtex.lua deleted file mode 100644 index 2a3d550..0000000 --- a/.vim/lua/plugins/_vimtex.lua +++ /dev/null @@ -1,8 +0,0 @@ -vim.g.tex_flavor = 'latex' -vim.g.vimtex_compiler_enabled = 1 -vim.g.vimtex_compiler_method = 'tectonic' -vim.g.vimtex_compiler_tectonic = "{'executable': 'tectonic'}" -vim.g.vimtex_view_method = 'zathura' --- vim.g.vimtex_view_zathura_check_libsynctex = false --- vim.g.vimtex_view_use_temp_files = true --- vim.g.vimtex_view_forward_search_on_start = false diff --git a/.vim/lua/utils.lua b/.vim/lua/utils.lua index 1141e8d..b0edacd 100644 --- a/.vim/lua/utils.lua +++ b/.vim/lua/utils.lua @@ -2,30 +2,6 @@ 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 -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) -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') -end M.augroup2 = function(tbl) for name, autocmds in pairs(tbl) do vim.cmd('augroup ' .. name) @@ -37,9 +13,4 @@ M.augroup2 = function(tbl) end end -M.def = function(name, cmd, ...) - local opts = table.concat((... or {}), ' ') - vim.cmd('command! ' .. opts .. ' ' .. name .. ' ' .. cmd) -end - return M |