From 02e1c9be35e13e26b34bbfd680e18f3093ee2949 Mon Sep 17 00:00:00 2001 From: Alec Goncharow Date: Fri, 12 Jan 2024 19:51:00 -0500 Subject: ultimate yak shave: custom colorscheme --- .config/nvim/colors/yaks.vim | 379 ++++++++++++++++++++++++++++++++ .config/nvim/init.lua | 10 +- .config/nvim/lua/autocomplete.lua | 8 +- .config/nvim/lua/bqf_conf.lua | 53 +++++ .config/nvim/lua/jabs_conf.lua | 69 ++++++ .config/nvim/lua/ls.lua | 69 ------ .config/nvim/lua/lsp.lua | 26 ++- .config/nvim/lua/lspsaga_conf.lua | 44 +++- .config/nvim/lua/nerdcommenter_conf.lua | 7 + .config/nvim/lua/plugins.lua | 22 +- .config/nvim/lua/settings.lua | 19 +- .config/nvim/syntax/qf.vim | 23 ++ .config/nvim/syntax/zig.vim | 298 +++++++++++++++++++++++++ .config/sway/config | 2 +- 14 files changed, 933 insertions(+), 96 deletions(-) create mode 100644 .config/nvim/colors/yaks.vim create mode 100644 .config/nvim/lua/bqf_conf.lua create mode 100644 .config/nvim/lua/jabs_conf.lua delete mode 100644 .config/nvim/lua/ls.lua create mode 100644 .config/nvim/lua/nerdcommenter_conf.lua create mode 100644 .config/nvim/syntax/qf.vim create mode 100644 .config/nvim/syntax/zig.vim (limited to '.config') diff --git a/.config/nvim/colors/yaks.vim b/.config/nvim/colors/yaks.vim new file mode 100644 index 0000000..3d7ba89 --- /dev/null +++ b/.config/nvim/colors/yaks.vim @@ -0,0 +1,379 @@ +" Originally yoinked from +" https://github.com/thenewvu/vim-colors-blueprint/blob/master/colors/blueprint.vim + + +highlight clear + +set background=dark + +if exists("syntax_on") + syntax reset +endif + +let g:colors_name="yaks" + +" Primary colors stolen from +" https://github.com/ryanpcmcquen/sublime_witness/blob/master/Witness.sublime-color-scheme + +"---------------------------------------------------------------- +" General settings | +"---------------------------------------------------------------- + +" -------------------------------- +" Editor settings +" -------------------------------- +hi Normal guifg=#d3b58d guibg=none gui=none +hi Cursor guifg=#2c4e6c guibg=#90ee90 gui=none +hi vCursor guifg=#2c4e6c guibg=#90ee90 gui=none +hi iCursor guifg=#2c4e6c guibg=#90ee90 gui=none +hi CursorLine guifg=none guibg=#062625 gui=none +hi LineNr guifg=lightgreen guibg=none gui=none +hi CursorLineNR guifg=none guibg=none gui=none + +" ----------------- +" - Number column - +" ----------------- +hi CursorColumn guifg=none guibg=#305575 gui=none +hi FoldColumn guifg=#80a8cb guibg=none gui=none +hi SignColumn guifg=#80a8cb guibg=none gui=none +hi Folded guifg=none guibg=none gui=none + +" ------------------------- +" - Window/Tab delimiters - +" ------------------------- +hi VertSplit guifg=lightgreen guibg=none gui=none +hi ColorColumn guifg=none guibg=#305575 gui=none +hi TabLine guifg=none guibg=none gui=none +hi TabLineFill guifg=none guibg=none gui=none +hi TabLineSel guifg=none guibg=none gui=none +hi FloatBorder guifg=none guibg=none gui=none +hi NormalFloat guifg=none guibg=none gui=none + +" ------------------------------- +" - File Navigation / Searching - +" ------------------------------- +hi Directory guifg=none guibg=none gui=underline +hi Search guifg=#2c4e6c guibg=#ffffff gui=none +hi IncSearch guifg=#2c4e6c guibg=#ffffff gui=none + +" ----------------- +" - Prompt/Status - +" ----------------- +hi StatusLine guifg=none guibg=none gui=none +hi StatusLineNC guifg=none guibg=none gui=none +hi WinBar guifg=none guibg=none gui=none +hi WinBarNC guifg=none guibg=none gui=none +hi WildMenu guifg=none guibg=none gui=none +hi Question guifg=none guibg=none gui=none +hi Title guifg=none guibg=none gui=none +hi ModeMsg guifg=none guibg=none gui=none +hi MoreMsg guifg=none guibg=none gui=none +hi MsgArea guifg=none guibg=none gui=none + + +" -------------- +" - Visual aid - +" -------------- +hi MatchParen guifg=none guibg=none gui=underline +hi Visual guifg=#2c4e6c guibg=#ffffff gui=none +hi VisualNOS guifg=#2c4e6c guibg=#ffffff gui=none +hi NonText guifg=#2c4e6c guibg=none gui=none +hi Todo guifg=#ede0ab guibg=none gui=bold +hi Underlined guifg=none guibg=none gui=underline +hi Error guifg=#edabb8 guibg=none gui=none +hi ErrorMsg guifg=#edabb8 guibg=none gui=none +hi WarningMsg guifg=#ede0ab guibg=none gui=none +hi Ignore guifg=none guibg=none gui=none +hi Conceal guifg=#abede0 guibg=none gui=none +hi SpecialKey guifg=#abede0 guibg=none gui=none + +" -------------------------------- +" Variable types +" -------------------------------- +hi Constant guifg=#79ffcf guibg=none gui=none +hi String guifg=#0fdfaf guibg=none gui=none +hi StringDelimiter guifg=#80a8cb guibg=none gui=none +hi Character guifg=#0fdfaf guibg=none gui=none +hi Number guifg=lightblue guibg=none gui=none +hi Boolean guifg=lightblue guibg=none gui=none +hi Float guifg=none guibg=none gui=none + +hi Identifier guifg=none guibg=none gui=none +hi Function guifg=none guibg=none gui=none + +" -------------------------------- +" Language constructs +" -------------------------------- +hi Comment guifg=#3fdf1f guibg=none gui=italic + +hi Statement guifg=#b8edab guibg=none gui=none +hi Conditional guifg=#b8edab guibg=none gui=none +hi Repeat guifg=#b8edab guibg=none gui=none +hi Label guifg=#b8edab guibg=none gui=none +hi Operator guifg=#b8edab guibg=none gui=none +hi Keyword guifg=white guibg=none gui=none +hi Exception guifg=#b8edab guibg=none gui=none + +hi Special guifg=#abede0 guibg=none gui=none +hi SpecialChar guifg=#abede0 guibg=none gui=none +hi Tag guifg=#abede0 guibg=none gui=none +hi Delimiter guifg=##80a8cb guibg=none gui=none +hi Noise guifg=#80a8cb guibg=none gui=none +hi SpecialComment guifg=#ede0ab guibg=none gui=none +hi Debug guifg=#ede0ab guibg=none gui=none + +" ---------- +" - C like - +" ---------- +hi PreProc guifg=#d3b58d guibg=none gui=none +hi Include guifg=#d3b58d guibg=none gui=none +hi Define guifg=#d3b58d guibg=none gui=none +hi Macro guifg=#d3b58d guibg=none gui=none +hi PreCondit guifg=#d3b58d guibg=none gui=none + +hi Type guifg=lightgreen guibg=none gui=none +hi StorageClass guifg=#80a8cb guibg=none gui=none +hi Structure guifg=lightgreen guibg=none gui=none +hi Typedef guifg=lightgreen guibg=none gui=none + +" -------------------------------- +hi DiffAdd guifg=#b8edab guibg=#2c4e6c gui=none +hi DiffChange guifg=#ede0ab guibg=#2c4e6c gui=none +hi DiffDelete guifg=#edabb8 guibg=#2c4e6c gui=none +hi DiffText guifg=#ede0ab guibg=#7f7f43 gui=none +hi DiffFile guifg=none guibg=none gui=underline + + +" -------------------------------- +" Completion menu +" -------------------------------- +hi Pmenu guifg=#abede0 guibg=none gui=none +hi PmenuSel guifg=#abede0 guibg=none gui=standout +hi PmenuSbar guifg=#abede0 guibg=none gui=standout +hi PmenuThumb guifg=#abede0 guibg=none gui=none + +" -------------------------------- +" Spelling +" -------------------------------- +hi SpellBad guifg=#ede0ab guibg=#7f7f43 gui=underline +hi SpellCap guifg=#ede0ab guibg=#7f7f43 gui=underline +hi SpellLocal guifg=#ede0ab guibg=#7f7f43 gui=underline +hi SpellRare guifg=#ede0ab guibg=#7f7f43 gui=underline + + +" lol + +hi CmpGhostText guifg=lightblue guifg=none gui=italic + +hi link zigVarDecl Keyword +hi link zigExecution Keyword + + +"-------------------------------------------------------------------- +" Specific settings | +"-------------------------------------------------------------------- + +hi link diffAdded DiffAdd +hi link diffRemoved DiffDelete +hi link diffLine DiffFile +hi link diffIndexLine DiffFile +hi link diffSubName DiffFile + +hi! link gitDateHeader gitIdentityHeader +hi! link gitIdentityHeader gitIdentityKeyword +hi! link gitIdentityKeyword Label +hi! link gitNotesHeader gitKeyword +hi! link gitReflogHeader gitKeyword +hi! link gitKeyword Keyword +hi! link gitIdentity String +hi! link gitEmailDelimiter Delimiter +hi! link gitEmail Special +hi! link gitDate Number +hi! link gitMode Number +hi! link gitHashAbbrev gitHash +hi! link gitHash Identifier +hi! link gitReflogMiddle gitReference +hi! link gitReference Function +hi! link gitStage gitType +hi! link gitType Type +hi! link gitDiffAdded diffAdded +hi! link gitDiffRemoved diffRemoved +hi! link gitcommitDiscardedFile diffRemoved +hi! link gitcommitSelectedFile diffAdded +hi! link gitcommitUnmergedFile ErrorMsg +hi! link gitcommitDiscardedArrow gitcommitDiscardedFile +hi! link gitcommitSelectedArrow gitcommitSelectedFile +hi! link gitcommitUnmergedArrow gitcommitUnmergedFile + +" hi! GitGutterAdd guifg=#437f43 guibg=#437f43 +" hi! GitGutterChange guifg=#7f7f43 guibg=#7f7f43 +" hi! GitGutterDelete guifg=#a05454 guibg=#a05454 + +hi! link LspDiagnosticsVirtualTextError ErrorMsg +hi! link LspDiagnosticsVirtualTextWarning WarningMsg +hi! link LspDiagnosticsVirtualTextInformation WarningMsg +hi! link LspDiagnosticsVirtualTextHint WarningMsg + +hi! link DiagnosticError LspDiagnosticsVirtualTextError +hi! link DiagnosticWarn LspDiagnosticsVirtualTextWarning +hi! link DiagnosticInfo LspDiagnosticsVirtualTextInformation +hi! link DiagnosticHint LspDiagnosticsVirtualTextHint + +hi! link LspDiagnosticsUnderlineError ErrorMsg +hi! link LspDiagnosticsUnderlineWarning WarningMsg +hi! link LspDiagnosticsUnderlineInformation WarningMsg +hi! link LspDiagnosticsUnderlineHint WarningMsg + +hi! link DiagnosticUnderlineError LspDiagnosticsUnderlineError +hi! link DiagnosticUnderlineWarn LspDiagnosticsUnderlineWarning +hi! link DiagnosticUnderlineInfo LspDiagnosticsUnderlineInformation +hi! link DiagnosticUnderlineHint LspDiagnosticsUnderlineHint + +" zig + +hi! link zigMacro Keyword +hi! link zigDecNumber Number +hi! link zigBoolean Boolean + +hi! link @comment Comment " line and block comments +" hi! link @error Normal " syntax/parser errors +hi! link @none Normal " completely disable the highlight +hi! link @preproc PreProc " various preprocessor directives & shebangs +hi! link @define Define " preprocessor definition directives +hi! link @operator Operator " symbolic operators (e.g. `+` / `*`) + +" Punctuation + +hi! link @punctuation.delimiter Delimiter " delimiters (e.g. `;` / `.` / `,`) +hi! link @punctuation.bracket Delimiter " brackets (e.g. `()` / `{}` / `[]`) +hi! link @punctuation.special Delimiter " special symbols (e.g. `{}` in string interpolation) + +" Literals + +hi! link @string String " string literals +hi! link @string.regex String " regular expressions +hi! link @string.escape String " escape sequences +hi! link @string.special String " other special strings (e.g. dates) + +hi! link @character Character " character literals +hi! link @character.special Character " special characters (e.g. wildcards) + +hi! link @boolean Boolean " boolean literals +hi! link @number Number " numeric literals +hi! link @float Float " floating-point number literals + +" Functions + +hi! link @function Define " function definitions +hi! link @function.builtin Function " built-in functions +hi! link @function.call Function " function calls +hi! link @function.macro Define " preprocessor macros + +hi! link @method Define " method definitions +hi! link @method.call Function " method calls + +hi! link @constructor Normal " constructor calls and definitions +hi! link @parameter Identifier " parameters of a function + +" Keywords + +hi! link @keyword Keyword " various keywords +hi! link @keyword.function Keyword " keywords that define a function (e.g. `func` in Go, `def` in Python) +hi! link @keyword.operator Operator " operators that are English words (e.g. `and` / `or`) +hi! link @keyword.return Keyword " keywords like `return` and `yield` + +hi! link @conditional Conditional " keywords related to conditionals (e.g. `if` / `else`) +hi! link @repeat Repeat " keywords related to loops (e.g. `for` / `while`) +hi! link @debug Debug " keywords related to debugging +hi! link @label Label " GOTO and other labels (e.g. `label:` in C) +hi! link @include Include " keywords for including modules (e.g. `import` / `from` in Python) +hi! link @exception Exception " keywords related to exceptions (e.g. `throw` / `catch`) + +" Types + +hi! link @type Type " type or class definitions and annotations +hi! link @type.builtin Type " built-in types +hi! link @type.definition Type " type definitions (e.g. `typedef` in C) +hi! link @type.qualifier StorageClass " type qualifiers (e.g. `const`) + +hi! link @storageclass StorageClass " visibility/life-time modifiers +hi! link @attribute StorageClass " attribute annotations (e.g. Python decorators) +hi! link @field Identifier " object and struct fields +hi! link @property Identifier " similar to `@field` + +" Identifiers + +hi! link @variable Identifier " various variable names +hi! link @variable.builtin Identifier " built-in variable names (e.g. `this`) + +hi! link @constant Constant " constant identifiers +hi! link @constant.builtin Constant " built-in constant values +hi! link @constant.macro Define " constants defined by the preprocessor + +hi! link @namespace Define " modules or namespaces +hi! link @symbol Define " symbols or atoms + +" Text +" Mainly for markup languages. + +hi! link @text Normal " non-structured text +hi! link @text.strong Special " bold text +hi! link @text.emphasis Special " text with emphasis +hi! link @text.underline Underlined " underlined text +hi! link @text.strike Comment " strikethrough text +hi! link @text.title Title " text that is part of a title +hi! link @text.literal Special " literal or verbatim text +hi! link @text.uri Special " URIs (e.g. hyperlinks) +hi! link @text.math Special " math environments (e.g. `$ ... $` in LaTeX) +hi! link @text.environment Special " text environments of markup languages +hi! link @text.environment.name Special " text indicating the type of an environment +hi! link @text.reference Special " text references, footnotes, citations, etc. + +hi! link @text.todo Todo " todo notes +hi! link @text.@todo Todo " todo notes +hi! link @text.note Todo " info notes +hi! link @text.@note Todo " fixme notes +hi! link @text.fixme Todo " fixme notes +hi! link @text.@fixme Todo " fixme notes +hi! link @text.warning WarningMsg " warning notes +hi! link @text.danger ErrorMsg " danger/error notes + +hi! link @text.diff.add DiffAdd " added text (for diff files) +hi! link @text.diff.delete DiffDelete " deleted text (for diff files) + +" Tags +" Used for XML-like tags. + +hi! link @tag Tag " XML tag names +hi! link @tag.attribute Identifier " XML tag attributes +hi! link @tag.delimiter Delimiter " XML tag delimiters + +" Conceal + +hi! link @conceal Conceal " for captures that are only used for concealing +" @conceal must be followed by (#set! conceal ""). + +" Spell + +" hi! link @spell Normal " for defining regions to be spellchecked +" hi! link @nospell Normal " for defining regions that should NOT be spellchecked + +" Locals + +hi! link @definition Define " various definitions +hi! link @definition.constant Define " constants +hi! link @definition.function Define " functions +hi! link @definition.method Define " methods +hi! link @definition.var Define " variables +hi! link @definition.parameter Define " parameters +hi! link @definition.macro Define " preprocessor macros +hi! link @definition.type Define " types or classes +hi! link @definition.field Define " fields or properties +hi! link @definition.enum Define " enumerations +hi! link @definition.namespace Define " modules or namespaces +hi! link @definition.import Define " imported names +hi! link @definition.associated Define " the associated type of a variable + +hi! link @scope Define " scope block +hi! link @reference Define " identifier reference + diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index e69c430..4f83545 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -3,10 +3,16 @@ require('settings') require('mappings') require('fzf') require('lsp') -require('lspsaga_conf') require('treesitter') require('highlighting') require('autocomplete') require('powerline') require('git') -require('ls') +require('jabs_conf') +require('lspsaga_conf') +require('nerdcommenter_conf') +require('bqf_conf') + + +--- basic plugins setup +require('autoclose').setup() diff --git a/.config/nvim/lua/autocomplete.lua b/.config/nvim/lua/autocomplete.lua index eef1625..8531258 100644 --- a/.config/nvim/lua/autocomplete.lua +++ b/.config/nvim/lua/autocomplete.lua @@ -15,11 +15,13 @@ cmp.setup({ end, }, experimental = { - ghost_text = true, + ghost_text = { + hl_group = "CmpGhostText", + }, }, window = { - completion = cmp.config.window.bordered({border = 'none'}), - documentation = cmp.config.window.bordered({border = 'none'}), + completion = cmp.config.window.bordered({ border = 'none' }), + documentation = cmp.config.window.bordered({ border = 'none' }), }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), diff --git a/.config/nvim/lua/bqf_conf.lua b/.config/nvim/lua/bqf_conf.lua new file mode 100644 index 0000000..35b681e --- /dev/null +++ b/.config/nvim/lua/bqf_conf.lua @@ -0,0 +1,53 @@ +local fn = vim.fn + +function _G.qftf(info) + local items + local ret = {} + -- The name of item in list is based on the directory of quickfix window. + -- Change the directory for quickfix window make the name of item shorter. + -- It's a good opportunity to change current directory in quickfixtextfunc :) + -- + -- local alterBufnr = fn.bufname('#') -- alternative buffer is the buffer before enter qf window + -- local root = getRootByAlterBufnr(alterBufnr) + -- vim.cmd(('noa lcd %s'):format(fn.fnameescape(root))) + -- + if info.quickfix == 1 then + items = fn.getqflist({ id = info.id, items = 0 }).items + else + items = fn.getloclist(info.winid, { id = info.id, items = 0 }).items + end + local limit = 31 + local fnameFmt1, fnameFmt2 = '%-' .. limit .. 's', '…%.' .. (limit - 1) .. 's' + local validFmt = '%s │%5d:%-3d│%s %s' + for i = info.start_idx, info.end_idx do + local e = items[i] + local fname = '' + local str + if e.valid == 1 then + if e.bufnr > 0 then + fname = fn.bufname(e.bufnr) + if fname == '' then + fname = '[No Name]' + else + fname = fname:gsub('^' .. vim.env.HOME, '~') + end + -- char in fname may occur more than 1 width, ignore this issue in order to keep performance + if #fname <= limit then + fname = fnameFmt1:format(fname) + else + fname = fnameFmt2:format(fname:sub(1 - limit)) + end + end + local lnum = e.lnum > 99999 and -1 or e.lnum + local col = e.col > 999 and -1 or e.col + local qtype = e.type == '' and '' or ' ' .. e.type:sub(1, 1):upper() + str = validFmt:format(fname, lnum, col, qtype, e.text) + else + str = e.text + end + table.insert(ret, str) + end + return ret +end + +vim.o.qftf = '{info -> v:lua._G.qftf(info)}' diff --git a/.config/nvim/lua/jabs_conf.lua b/.config/nvim/lua/jabs_conf.lua new file mode 100644 index 0000000..2b2ffff --- /dev/null +++ b/.config/nvim/lua/jabs_conf.lua @@ -0,0 +1,69 @@ +require 'jabs'.setup { + -- Options for the main window + position = { 'right', 'bottom' }, -- position = {'', ''} | left, center, right, + -- top, center, bottom + -- Default {'right', 'bottom'} + + relative = 'win', -- win, editor, cursor. Default win + clip_popup_size = true, -- clips the popup size to the win (or editor) size. Default true + + width = 50, -- default 50 + height = 10, -- default 10 + border = 'single', -- none, single, double, rounded, solid, shadow, (or an array or chars). Default shadow + + offset = { -- window position offset + top = 2, -- default 0 + bottom = 2, -- default 0 + left = 2, -- default 0 + right = 2, -- default 0 + }, + + sort_mru = true, -- Sort buffers by most recently used (true or false). Default false + split_filename = false, -- Split filename into separate components for name and path. Default false + split_filename_path_width = 20, -- If split_filename is true, how wide the column for the path is supposed to be, Default 0 (don't show path) + + -- Options for preview window + preview_position = 'top', -- top, bottom, left, right. Default top + preview = { + width = 70, -- default 70 + height = 30, -- default 30 + border = 'double', -- none, single, double, rounded, solid, shadow, (or an array or chars). Default double + }, + + -- Default highlights (must be a valid :highlight) + highlight = { + current = "Title", -- default StatusLine + hidden = "StatusLineNC", -- default ModeMsg + split = "WarningMsg", -- default StatusLine + alternate = "StatusLine" -- default WarningMsg + }, + + -- Default symbols + symbols = { + current = "C", -- default ]] + split = "S", -- default ]] + alternate = "A", -- default ]] + hidden = "H", -- default ﬘]] + locked = "L", -- default ]] + ro = "R", -- default ]] + edited = "E", -- default ]] + terminal = "T", -- default ]] + default_file = "D", -- Filetype icon if not present in nvim-web-devicons. Default ]] + terminal_symbol = ">_" -- Filetype icon for a terminal split. Default ]] + }, + + -- Keymaps + keymap = { + close = "x", -- Close buffer. Default D + jump = "", -- Jump to buffer. Default + h_split = "h", -- Horizontally split buffer. Default s + v_split = "v", -- Vertically split buffer. Default v + preview = "p", -- Open buffer preview. Default P + }, + + -- Whether to use nvim-web-devicons next to filenames + use_devicons = true -- true or false. Default true +} + + +Nmap('', ':JABSOpen') diff --git a/.config/nvim/lua/ls.lua b/.config/nvim/lua/ls.lua deleted file mode 100644 index 2361fda..0000000 --- a/.config/nvim/lua/ls.lua +++ /dev/null @@ -1,69 +0,0 @@ -require 'jabs'.setup { - -- Options for the main window - position = { 'right', 'bottom' }, -- position = {'', ''} | left, center, right, - -- top, center, bottom - -- Default {'right', 'bottom'} - - relative = 'win', -- win, editor, cursor. Default win - clip_popup_size = true, -- clips the popup size to the win (or editor) size. Default true - - width = 50, -- default 50 - height = 10, -- default 10 - border = 'shadow', -- none, single, double, rounded, solid, shadow, (or an array or chars). Default shadow - - offset = { -- window position offset - top = 2, -- default 0 - bottom = 2, -- default 0 - left = 2, -- default 0 - right = 2, -- default 0 - }, - - sort_mru = true, -- Sort buffers by most recently used (true or false). Default false - split_filename = false, -- Split filename into separate components for name and path. Default false - split_filename_path_width = 20, -- If split_filename is true, how wide the column for the path is supposed to be, Default 0 (don't show path) - - -- Options for preview window - preview_position = 'top', -- top, bottom, left, right. Default top - preview = { - width = 70, -- default 70 - height = 30, -- default 30 - border = 'double', -- none, single, double, rounded, solid, shadow, (or an array or chars). Default double - }, - - -- Default highlights (must be a valid :highlight) - highlight = { - current = "Title", -- default StatusLine - hidden = "StatusLineNC", -- default ModeMsg - split = "WarningMsg", -- default StatusLine - alternate = "StatusLine" -- default WarningMsg - }, - - -- Default symbols - symbols = { - current = "C", -- default ]] - split = "S", -- default ]] - alternate = "A", -- default ]] - hidden = "H", -- default ﬘]] - locked = "L", -- default ]] - ro = "R", -- default ]] - edited = "E", -- default ]] - terminal = "T", -- default ]] - default_file = "D", -- Filetype icon if not present in nvim-web-devicons. Default ]] - terminal_symbol = ">_" -- Filetype icon for a terminal split. Default ]] - }, - - -- Keymaps - keymap = { - close = "x", -- Close buffer. Default D - jump = "", -- Jump to buffer. Default - h_split = "h", -- Horizontally split buffer. Default s - v_split = "v", -- Vertically split buffer. Default v - preview = "p", -- Open buffer preview. Default P - }, - - -- Whether to use nvim-web-devicons next to filenames - use_devicons = true -- true or false. Default true -} - - -Nmap('', ':JABSOpen') diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index aa156b5..0c6fcd2 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -1,11 +1,10 @@ --- See `:help vim.diagnostic.*` for documentation on any of the below functions -local opts = { noremap = true, silent = true } +-- See `:help vim.diagnostic.*` for documentation on any of the below functiolocal opts = { noremap = true, silent = true } vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) -vim.lsp.set_log_level("debug") +vim.lsp.set_log_level("info") -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer @@ -18,11 +17,8 @@ local on_attach = function(client, bufnr) -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) vim.keymap.set('n', 'gk', vim.lsp.buf.hover, bufopts) vim.keymap.set('n', '', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) vim.keymap.set('n', 'wl', function() @@ -30,11 +26,18 @@ local on_attach = function(client, bufnr) end, bufopts) vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('v', 'ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) - vim.keymap.set('v', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) + --- following functions are now managed under ./lspsaga_conf.lua + -- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + -- vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + -- vim.keymap.set('v', 'ca', vim.lsp.buf.code_action, bufopts) + -- vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) see ./lspsaga_conf.lua + -- vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + -- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + + -- vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) + -- vim.keymap.set('v', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) + -- disable lsp highlighting + -- client.server_capabilities.semanticTokensProvider = nil end -- Setup buffer-local keymaps / options for LSP buffers local capabilities = require("cmp_nvim_lsp").default_capabilities() @@ -65,6 +68,7 @@ local lspconfig = require('lspconfig') lspconfig.zls.setup({ on_attach = on_attach, capabilities = capabilities, + }) lspconfig.bashls.setup({ diff --git a/.config/nvim/lua/lspsaga_conf.lua b/.config/nvim/lua/lspsaga_conf.lua index c49c549..37dc583 100644 --- a/.config/nvim/lua/lspsaga_conf.lua +++ b/.config/nvim/lua/lspsaga_conf.lua @@ -2,7 +2,7 @@ vim.g.matchup_matchparen_offscreen = { method = {} } require('lspsaga').setup({ ui = { - border = 'none', + border = 'single', }, outline = { win_position = 'right', @@ -49,8 +49,50 @@ require('lspsaga').setup({ exec = '', }, }, + finder = { + max_height = 0.5, + left_width = 0.4, + methods = {}, + default = 'ref+imp', + layout = 'float', + silent = false, + filter = {}, + fname_sub = nil, + sp_inexist = false, + sp_global = false, + ly_botright = false, + keys = { + shuttle = '[w', + toggle_or_open = '', + vsplit = 's', + split = 'i', + tabe = 't', + tabnew = 'r', + quit = { 'q', '' }, + close = 'k', + }, + }, + definition = { + width = 0.6, + height = 0.5, + save_pos = false, + keys = { + edit = 'o', + vsplit = 'v', + split = 'i', + tabe = 't', + tabnew = 'n', + quit = { 'q', '' }, + close = 'k', + }, + }, }) Nmap('', ':Lspsaga outline') Nmap('', ':Lspsaga show_buf_diagnostics') Nmap('', ':Lspsaga code_action') +Nmap('ca', ':Lspsaga code_action') +Nmap('gr', ':Lspsaga finder ref') +Nmap('gi', ':Lspsaga finder imp') +Nmap('gd', ':Lspsaga goto_definition') +Nmap('gD', ':Lspsaga goto_type_definition') diff --git a/.config/nvim/lua/nerdcommenter_conf.lua b/.config/nvim/lua/nerdcommenter_conf.lua new file mode 100644 index 0000000..b5ac671 --- /dev/null +++ b/.config/nvim/lua/nerdcommenter_conf.lua @@ -0,0 +1,7 @@ +vim.g.NERDCreateDefaultMappings = 0 +vim.g.NERDSpaceDelims = 1 + +Nmap("cc", "NERDCommenterToggle"); +Vmap("cc", "NERDCommenterToggle"); +Nmap("cs", "NERDCommenterSexy"); +Nmap("cu", "NERDCommenterUncomment"); diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index c97cb15..4e10a81 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -3,7 +3,8 @@ return require('packer').startup(function() use 'wbthomason/packer.nvim' - use 'morhetz/gruvbox' + -- use 'morhetz/gruvbox' + -- use 'tjdevries/colorbuddy.nvim' use 'edkolev/tmuxline.vim' use 'romainl/vim-cool' @@ -19,13 +20,16 @@ return require('packer').startup(function() use 'RRethy/vim-illuminate' -- better quickfix buffer - use { 'kevinhwang91/nvim-bqf', - ft = 'qf', + use { 'kevinhwang91/nvim-bqf', ft = 'qf', config = function() - require('bqf').setup { - -- your configuration comes here - -- or leave it empty to use the default settings - } + -- Adapt fzf's delimiter in nvim-bqf + require('bqf').setup({ + filter = { + fzf = { + extra_opts = { '--bind', 'ctrl-o:toggle-all', '--delimiter', '│' } + } + } + }) end } use 'matbme/JABS.nvim' -- buffer switcher @@ -57,9 +61,9 @@ return require('packer').startup(function() use 'tpope/vim-eunuch' -- wrappers UNIX commands use 'tpope/vim-surround' -- surround characters shortcuts - use 'tpope/vim-vinegar' -- make explore better use 'tpope/vim-endwise' -- wisely add use 'tpope/vim-repeat' -- repeat for plugins + use 'tpope/vim-vinegar' -- make explore better use { 'prichrd/netrw.nvim', -- particles for ^ config = function() @@ -129,4 +133,6 @@ return require('packer').startup(function() } end } + -- auto close delimiters because lazy + use 'm4xshen/autoclose.nvim' end) diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index bfc771c..36bab36 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -88,8 +88,20 @@ vim.cmd([[ au BufRead,BufNewFile *.slimbars set syntax=slim ]]) +vim.cmd([[ +" for debugging colorscheme +function! SynStack() + if !exists("*synstack") + return + endif + echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') +endfunc + +command! Synstack call SynStack() +]]) -vim.cmd('colorscheme gruvbox') + +vim.cmd('colorscheme yaks') vim.cmd([[ " ### Transparency ### hi Normal guibg=none ctermbg=none @@ -107,6 +119,11 @@ vim.o.wildmenu = true -- on TAB, complete options for system command vim.o.wildignore = 'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc' +-- sometimes shift is held down for too long while zoomer quitting +vim.api.nvim_create_user_command('Q', 'q', {}) +vim.api.nvim_create_user_command('Qa', 'qa', {}) +vim.api.nvim_create_user_command('QA', 'qa', {}) + -- rust format on save -- https://sharksforarms.dev/posts/neovim-rust/ diff --git a/.config/nvim/syntax/qf.vim b/.config/nvim/syntax/qf.vim new file mode 100644 index 0000000..40d5dbb --- /dev/null +++ b/.config/nvim/syntax/qf.vim @@ -0,0 +1,23 @@ +if exists('b:current_syntax') + finish +endif + +syn match qfFileName /^[^│]*/ nextgroup=qfSeparatorLeft +syn match qfSeparatorLeft /│/ contained nextgroup=qfLineNr +syn match qfLineNr /[^│]*/ contained nextgroup=qfSeparatorRight +syn match qfSeparatorRight '│' contained nextgroup=qfError,qfWarning,qfInfo,qfNote +syn match qfError / E .*$/ contained +syn match qfWarning / W .*$/ contained +syn match qfInfo / I .*$/ contained +syn match qfNote / [NH] .*$/ contained + +hi def link qfFileName Directory +hi def link qfSeparatorLeft Delimiter +hi def link qfSeparatorRight Delimiter +hi def link qfLineNr LineNr +hi def link qfError DiagnosticError +hi def link qfWarning DiagnosticWarn +hi def link qfInfo DiagnosticInfo +hi def link qfNote DiagnosticHint + +let b:current_syntax = 'qf' diff --git a/.config/nvim/syntax/zig.vim b/.config/nvim/syntax/zig.vim new file mode 100644 index 0000000..9b5a3d0 --- /dev/null +++ b/.config/nvim/syntax/zig.vim @@ -0,0 +1,298 @@ +" Vim syntax file +" Language: Zig +" Maintainer: Andrew Kelley +" Latest Revision: 03 August 2016 + +if exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +let s:zig_syntax_keywords = { + \ 'zigBoolean': ["true" + \ , "false"] + \ , 'zigNull': ["null"] + \ , 'zigType': ["bool" + \ , "f16" + \ , "f32" + \ , "f64" + \ , "f80" + \ , "f128" + \ , "void" + \ , "type" + \ , "anytype" + \ , "anyerror" + \ , "anyframe" + \ , "volatile" + \ , "linksection" + \ , "noreturn" + \ , "allowzero" + \ , "i0" + \ , "u0" + \ , "isize" + \ , "usize" + \ , "comptime_int" + \ , "comptime_float" + \ , "c_char" + \ , "c_short" + \ , "c_ushort" + \ , "c_int" + \ , "c_uint" + \ , "c_long" + \ , "c_ulong" + \ , "c_longlong" + \ , "c_ulonglong" + \ , "c_longdouble" + \ , "anyopaque"] + \ , 'zigConstant': ["undefined" + \ , "unreachable"] + \ , 'zigConditional': ["if" + \ , "else" + \ , "switch"] + \ , 'zigRepeat': ["while" + \ , "for"] + \ , 'zigComparatorWord': ["and" + \ , "or" + \ , "orelse"] + \ , 'zigStructure': ["struct" + \ , "enum" + \ , "union" + \ , "error" + \ , "packed" + \ , "opaque"] + \ , 'zigException': ["error"] + \ , 'zigVarDecl': ["var" + \ , "const" + \ , "comptime" + \ , "threadlocal"] + \ , 'zigDummyVariable': ["_"] + \ , 'zigKeyword': ["fn" + \ , "try" + \ , "test" + \ , "pub" + \ , "usingnamespace"] + \ , 'zigExecution': ["return" + \ , "break" + \ , "continue"] + \ , 'zigMacro': ["defer" + \ , "errdefer" + \ , "async" + \ , "nosuspend" + \ , "await" + \ , "suspend" + \ , "resume" + \ , "export" + \ , "extern"] + \ , 'zigPreProc': ["catch" + \ , "inline" + \ , "noinline" + \ , "asm" + \ , "callconv" + \ , "noalias"] + \ , 'zigBuiltinFn': ["align" + \ , "@addWithOverflow" + \ , "@as" + \ , "@atomicLoad" + \ , "@atomicStore" + \ , "@bitCast" + \ , "@breakpoint" + \ , "@trap" + \ , "@alignCast" + \ , "@alignOf" + \ , "@cDefine" + \ , "@cImport" + \ , "@cInclude" + \ , "@cUndef" + \ , "@clz" + \ , "@cmpxchgWeak" + \ , "@cmpxchgStrong" + \ , "@compileError" + \ , "@compileLog" + \ , "@constCast" + \ , "@ctz" + \ , "@popCount" + \ , "@divExact" + \ , "@divFloor" + \ , "@divTrunc" + \ , "@embedFile" + \ , "@export" + \ , "@extern" + \ , "@tagName" + \ , "@TagType" + \ , "@errorName" + \ , "@call" + \ , "@errorReturnTrace" + \ , "@fence" + \ , "@fieldParentPtr" + \ , "@field" + \ , "@unionInit" + \ , "@frameAddress" + \ , "@import" + \ , "@inComptime" + \ , "@newStackCall" + \ , "@asyncCall" + \ , "@ptrFromInt" + \ , "@max" + \ , "@min" + \ , "@memcpy" + \ , "@memset" + \ , "@mod" + \ , "@mulAdd" + \ , "@mulWithOverflow" + \ , "@splat" + \ , "@src" + \ , "@bitOffsetOf" + \ , "@byteOffsetOf" + \ , "@offsetOf" + \ , "@OpaqueType" + \ , "@panic" + \ , "@prefetch" + \ , "@ptrCast" + \ , "@intFromPtr" + \ , "@rem" + \ , "@returnAddress" + \ , "@setCold" + \ , "@Type" + \ , "@shuffle" + \ , "@reduce" + \ , "@select" + \ , "@setRuntimeSafety" + \ , "@setEvalBranchQuota" + \ , "@setFloatMode" + \ , "@shlExact" + \ , "@This" + \ , "@hasDecl" + \ , "@hasField" + \ , "@shlWithOverflow" + \ , "@shrExact" + \ , "@sizeOf" + \ , "@bitSizeOf" + \ , "@sqrt" + \ , "@byteSwap" + \ , "@subWithOverflow" + \ , "@intCast" + \ , "@floatCast" + \ , "@floatFromInt" + \ , "@intFromFloat" + \ , "@intFromBool" + \ , "@errorCast" + \ , "@truncate" + \ , "@typeInfo" + \ , "@typeName" + \ , "@TypeOf" + \ , "@atomicRmw" + \ , "@errorFromInt" + \ , "@intFromError" + \ , "@enumFromInt" + \ , "@intFromEnum" + \ , "@setAlignStack" + \ , "@frame" + \ , "@Frame" + \ , "@frameSize" + \ , "@bitReverse" + \ , "@Vector" + \ , "@volatileCast" + \ , "@sin" + \ , "@cos" + \ , "@tan" + \ , "@exp" + \ , "@exp2" + \ , "@log" + \ , "@log2" + \ , "@log10" + \ , "@abs" + \ , "@floor" + \ , "@ceil" + \ , "@trunc" + \ , "@wasmMemorySize" + \ , "@wasmMemoryGrow" + \ , "@round"] + \ } + +function! s:syntax_keyword(dict) + for key in keys(a:dict) + execute 'syntax keyword' key join(a:dict[key], ' ') + endfor +endfunction + +call s:syntax_keyword(s:zig_syntax_keywords) + +syntax match zigType "\v<[iu][1-9]\d*>" +syntax match zigOperator display "\V\[-+/*=^&?|!><%~]" +syntax match zigArrowCharacter display "\V->" + +" 12_34 (. but not ..)? (12_34)? (exponent 12_34)? +syntax match zigDecNumber display "\v<\d%(_?\d)*%(\.\.@!)?%(\d%(_?\d)*)?%([eE][+-]?\d%(_?\d)*)?" +syntax match zigHexNumber display "\v<0x\x%(_?\x)*%(\.\.@!)?%(\x%(_?\x)*)?%([pP][+-]?\d%(_?\d)*)?" +syntax match zigOctNumber display "\v<0o\o%(_?\o)*" +syntax match zigBinNumber display "\v<0b[01]%(_?[01])*" + +syntax match zigCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/ +syntax match zigCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/ +syntax match zigCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=zigEscape,zigEscapeError,zigCharacterInvalid,zigCharacterInvalidUnicode +syntax match zigCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{6}\)\)'/ contains=zigEscape,zigEscapeUnicode,zigEscapeError,zigCharacterInvalid + +syntax region zigBlock start="{" end="}" transparent fold + +syntax region zigCommentLine start="//" end="$" contains=zigTodo,@Spell +syntax region zigCommentLineDoc start="//[/!]/\@!" end="$" contains=zigTodo,@Spell + +syntax match zigMultilineStringPrefix /c\?\\\\/ contained containedin=zigMultilineString +syntax region zigMultilineString matchgroup=zigMultilineStringDelimiter start="c\?\\\\" end="$" contains=zigMultilineStringPrefix display + +syntax keyword zigTodo contained TODO + +syntax region zigString matchgroup=zigStringDelimiter start=+c\?"+ skip=+\\\\\|\\"+ end=+"+ oneline contains=zigEscape,zigEscapeUnicode,zigEscapeError,@Spell +syntax match zigEscapeError display contained /\\./ +syntax match zigEscape display contained /\\\([nrt\\'"]\|x\x\{2}\)/ +syntax match zigEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{6}\)/ + +highlight default link zigDecNumber zigNumber +highlight default link zigHexNumber zigNumber +highlight default link zigOctNumber zigNumber +highlight default link zigBinNumber zigNumber + +highlight default link zigBuiltinFn Statement +highlight default link zigKeyword Keyword +highlight default link zigType Type +highlight default link zigCommentLine Comment +highlight default link zigCommentLineDoc Comment +highlight default link zigDummyVariable Comment +highlight default link zigTodo Todo +highlight default link zigString String +highlight default link zigStringDelimiter String +highlight default link zigMultilineString String +highlight default link zigMultilineStringContent String +highlight default link zigMultilineStringPrefix String +highlight default link zigMultilineStringDelimiter Delimiter +highlight default link zigCharacterInvalid Error +highlight default link zigCharacterInvalidUnicode zigCharacterInvalid +highlight default link zigCharacter Character +highlight default link zigEscape Special +highlight default link zigEscapeUnicode zigEscape +highlight default link zigEscapeError Error +highlight default link zigBoolean Boolean +highlight default link zigNull Boolean +highlight default link zigConstant Constant +highlight default link zigNumber Number +highlight default link zigArrowCharacter zigOperator +highlight default link zigOperator Operator +highlight default link zigStructure Structure +highlight default link zigExecution Special +highlight default link zigMacro Macro +highlight default link zigConditional Conditional +highlight default link zigComparatorWord Keyword +highlight default link zigRepeat Repeat +highlight default link zigSpecial Special +highlight default link zigVarDecl Function +highlight default link zigPreProc PreProc +highlight default link zigException Exception + +delfunction s:syntax_keyword + +let b:current_syntax = "zig" + +let &cpo = s:cpo_save +unlet! s:cpo_save diff --git a/.config/sway/config b/.config/sway/config index 1379257..947081a 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -219,7 +219,7 @@ bar { gaps inner 10 gaps outer 0 smart_gaps on -smart_borders on +smart_borders off for_window { [class="firefox"] border none -- cgit v1.2.3-70-g09d2