diff options
Diffstat (limited to '.config/nvim')
68 files changed, 2811 insertions, 1786 deletions
diff --git a/.config/nvim/colors/spacegray.vim b/.config/nvim/colors/spacegray.vim new file mode 100644 index 0000000..be065c2 --- /dev/null +++ b/.config/nvim/colors/spacegray.vim @@ -0,0 +1,259 @@ +"Theme built with Lush.nvim, exported at Sun 04 Jul 2021 02:47:35 PM EDT +highlight StatusLineLspDiagnosticsHint guifg=#4DC1FF guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight BufferInactive guifg=#858585 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight markdownCode guifg=#C67158 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link DiffviewStatusRenamed SignChange +highlight! link StorageClass Type +highlight! link SpecialChar Character +highlight FoldColumn guifg=#858585 guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight TabLine guifg=#C7C8D1 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight TelescopeSelection guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight NvimTreeGitDelete guifg=#93151B guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link TSMethod Function +highlight Identifier guifg=#C7C8D1 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight NvimTreeRootFolder guifg=#3B6AA0 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight GitSignsChange guifg=#0C7D9D guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link TSLabel Label +highlight! link TSComment Comment +highlight! link LspDiagnosticsWarning LspDiagnosticsSignWarning +highlight SignAdd guifg=#5A7D0C guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link IncSearch Search +highlight WhichKey guifg=#BF85C1 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link TSLiteral String +highlight BufferCurrent guifg=NONE guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight Todo guifg=#AF4B57 guibg=NONE guisp=NONE gui=bold blend=NONE +highlight! link TSParameterReference TSParameter +highlight NvimTreeOpenedFolderName guifg=#4E99BC guibg=NONE guisp=NONE gui=italic blend=NONE +highlight! link MsgSeparator Normal +highlight! link TermCursor Cursor +highlight LspDiagnosticsFloatingHint guifg=#4DC1FF guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link TSConstBuiltin Constant +highlight TSStrike guifg=NONE guibg=NONE guisp=NONE gui=strikethrough blend=NONE +highlight Number guifg=#AF4B57 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link WildMenu PmenuSel +highlight DiffText guifg=NONE guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight SignDelete guifg=#93151B guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Normal guifg=#C7C8D1 guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight LspDiagnosticsSignInformation guifg=#FFCC66 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Type guifg=#BF85C1 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Float guifg=#AF4B57 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight CompeDocumentation guifg=NONE guibg=#393E46 guisp=NONE gui=NONE blend=NONE +highlight Ignore guifg=#C7C8D1 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight GitSignsDelete guifg=#93151B guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link TSConstant Constant +highlight StatusLineSeparator guifg=NONE guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link TSConstructor Type +highlight! link Substitute Search +highlight StatusLineGitDelete guifg=#AF4B57 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight LspDiagnosticsSignError guifg=#F44848 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight StatusLineLspDiagnosticsError guifg=#F44848 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight WhichKeyFloat guifg=NONE guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight markdownItalic guifg=NONE guibg=NONE guisp=NONE gui=italic blend=NONE +highlight Pmenu guifg=#C7C8D1 guibg=#393E46 guisp=NONE gui=NONE blend=NONE +highlight! link TabLineWarning LspDiagnosticsSignWarning +highlight PmenuSel guifg=#262626 guibg=#67899E guisp=NONE gui=NONE blend=NONE +highlight! link Typedef Type +highlight! link Define PreProc +highlight TSError guifg=NONE guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Directory guifg=#5486C0 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight DashboardFooter guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight WhichKeyGroup guifg=#5486C0 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link TermCursorNC Cursor +highlight MatchParen guifg=NONE guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link TSOperator Operator +highlight TSVariableBuiltin guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight NvimTreeGitDirty guifg=#5A7D0C guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight BufferVisibleIndex guifg=NONE guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight LspDiagnosticsFloatingError guifg=#F44848 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight WarningMsg guifg=#AF4B57 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight DashboardCenter guifg=#BF85C1 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Conceal guifg=#5486C0 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight NvimTreeVertSplit guifg=#292929 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight LspDiagnosticsSignWarning guifg=#FF8800 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight LspDiagnosticsUnderlineHint guifg=NONE guibg=NONE guisp=#87B479 gui=underline blend=NONE +highlight Visual guifg=NONE guibg=#2C2F35 guisp=NONE gui=NONE blend=NONE +highlight Tag guifg=#7299EE guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight TelescopeMatching guifg=#AF4B57 guibg=NONE guisp=NONE gui=bold blend=NONE +highlight LspDiagnosticsDefaultInformation guifg=#FFCC66 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight WhichKeySeperator guifg=#87B479 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link htmlH1 Title +highlight! link TSParameter TSField +highlight! link LspDiagnosticsVirtualTextWarning LspDiagnosticsDefaultWarning +highlight! link TSTagDelimiter Delimiter +highlight BufferInactiveTarget guifg=#AF4B57 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link LspDiagnosticsVirtualTextInformation LspDiagnosticsDefaultInformation +highlight StatusLineLspDiagnosticsWarning guifg=#FF8800 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link CursorIM Cursor +highlight! link TSFloat Float +highlight! link markdownIdDelimiter Delimiter +highlight BufferCurrentMod guifg=#FFCC66 guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight Whitespace guifg=#575757 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link Repeat Keyword +highlight NvimTreeIndentMarker guifg=#858585 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Character guifg=#B1D67A guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight NvimTreeGitRenamed guifg=#0C7D9D guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight BufferInactiveMod guifg=#FFCC66 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link DiffviewFilePanelDeletion SignDelete +highlight StatusLineTreeSitter guifg=#87B479 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight SpecialKey guifg=#5486C0 guibg=NONE guisp=NONE gui=bold blend=NONE +highlight DiffAdd guifg=NONE guibg=#5A7D0C guisp=NONE gui=NONE blend=NONE +highlight CursorLine guifg=NONE guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link TSPunctSpecial Delimiter +highlight! link QuickFixLine CursorLine +highlight! link Label Keyword +highlight TSEmphasis guifg=NONE guibg=NONE guisp=NONE gui=italic blend=NONE +highlight Error guifg=#F44848 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link TSWarning Todo +highlight! link TSNumber Number +highlight BufferVisible guifg=NONE guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight SpellRare guifg=#C7C8D1 guibg=NONE guisp=#5486C0 gui=underline blend=NONE +highlight LspDiagnosticsDefaultError guifg=#F44848 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link Question MoreMsg +highlight Operator guifg=#67899E guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Cursor guifg=NONE guibg=NONE guisp=NONE gui=reverse blend=NONE +highlight BufferCurrentIndex guifg=#64A6C4 guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight! link CursorColumn CursorLine +highlight! link TSType Type +highlight StatusLine guifg=#C7C8D1 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight LspDiagnosticsUnderlineInformation guifg=NONE guibg=NONE guisp=#5486C0 gui=underline blend=NONE +highlight! link NormalNC Normal +highlight! link TSRepeat Repeat +highlight NvimTreeNormal guifg=#B1B3BE guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight ErrorMsg guifg=#F44848 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight NvimTreeGitMerge guifg=#0C7D9D guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight mkdLineBreak guifg=NONE guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight NvimTreeGitNew guifg=#5A7D0C guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link LspDiagnosticsHint LspDiagnosticsSignHint +highlight! link DiffviewNormal NvimTreeNormal +highlight! link PreCondit PreProc +highlight! link Macro PreProc +highlight NormalFloat guifg=NONE guibg=#292D32 guisp=NONE gui=NONE blend=NONE +highlight! link TSStringRegex TSString +highlight FlutterWidgetGuides guifg=#919191 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Debug guifg=#AF4B57 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight TSAttribute guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight BufferInactiveIndex guifg=#858585 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link TSKeyword Keyword +highlight mkdHeading guifg=#C7C8D1 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link LspDiagnosticsVirtualTextError LspDiagnosticsDefaultError +highlight Function guifg=#EEBA59 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight StatusLineNC guifg=#C7C8C0 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link DiffviewStatusAdded SignAdd +highlight! link TSString String +highlight TSText guifg=#C7C8D1 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link DiffviewFilePanelInsertion SignAdd +highlight! link TSTag Tag +highlight! link LspDiagnosticsInformation LspDiagnosticsSignInformation +highlight! link TSKeywordFunction Keyword +highlight LspDiagnosticsDefaultHint guifg=#4DC1FF guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link DiffviewStatusModified SignChange +highlight DiffviewVertSplit guifg=#858585 guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight NvimTreeGitStaged guifg=#5A7D0C guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link NonText EndOfBuffer +highlight NvimTreeSpecialFile guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight SpecialComment guifg=#858585 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link Exception Keyword +highlight PreProc guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link markdownUrl mkdLink +highlight LspDiagnosticsFloatingWarning guifg=#FF8800 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight TSNamespace guifg=#5486C0 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight VertSplit guifg=#393E46 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight BufferVisibleTarget guifg=#AF4B57 guibg=#212121 guisp=NONE gui=bold blend=NONE +highlight FloatBorder guifg=#858585 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link TabLineHint LspDiagnosticsSignHint +highlight BufferVisibleSign guifg=#FFCC66 guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight BufferVisibleMod guifg=#FFCC66 guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight TSUnderline guifg=NONE guibg=NONE guisp=NONE gui=underline blend=NONE +highlight LspTroubleIndent guifg=#919191 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight EndOfBuffer guifg=#212121 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link TabLineError LspDiagnosticsSignError +highlight! link LspDiagnosticsVirtualTextHint LspDiagnosticsDefaultHint +highlight! link Structure Type +highlight CodiVirtualText guifg=#4DC1FF guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link DiffviewStatusDeleted SignDelete +highlight! link TSFuncBuiltin Function +highlight! link lCursor Cursor +highlight DiffDelete guifg=NONE guibg=#93151B guisp=NONE gui=NONE blend=NONE +highlight markdownLinkText guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link TSTypeBuiltin Type +highlight! link TSFuncMacro Macro +highlight BufferCurrentTarget guifg=#AF4B57 guibg=#212121 guisp=NONE gui=bold blend=NONE +highlight! link TSPunctDelimiter Delimiter +highlight! link TSException Exception +highlight TSProperty guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight NvimTreeImageFile guifg=#BF85C1 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight TSVariable guifg=#C7C8D1 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight LspDiagnosticsUnderlineWarning guifg=NONE guibg=NONE guisp=#EEBA59 gui=underline blend=NONE +highlight DashboardHeader guifg=#5486C0 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight TabLineFill guifg=#C7C8D1 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight LspDiagnosticsSignHint guifg=#4DC1FF guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Bold guifg=NONE guibg=NONE guisp=NONE gui=bold blend=NONE +highlight String guifg=#87B479 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link TabLineInformation LspDiagnosticsSignInformation +highlight mkdLink guifg=#64A6C4 guibg=NONE guisp=NONE gui=underline blend=NONE +highlight! link TSFunction Function +highlight NvimTreeFolderIcon guifg=#5486C0 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Title guifg=#5486C0 guibg=NONE guisp=NONE gui=bold blend=NONE +highlight! link SignColumn Normal +highlight! link TSPunctBracket Delimiter +highlight! link TSCharacter Character +highlight luaTSConstructor guifg=#9092A2 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Keyword guifg=#5486C0 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link Statement Keyword +highlight MoreMsg guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight TSURI guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight SpellCap guifg=#C7C8D1 guibg=NONE guisp=#EEBA59 gui=underline blend=NONE +highlight GitSignsAdd guifg=#5A7D0C guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight LspDiagnosticsFloatingInformation guifg=#FFCC66 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Special guifg=#C67158 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Comment guifg=#858585 guibg=NONE guisp=NONE gui=italic blend=NONE +highlight Folded guifg=#858585 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link TSStringEscape Character +highlight! link markdownLinkDelimiter Delimiter +highlight LspDiagnosticsDefaultWarning guifg=#FF8800 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link Conditional Keyword +highlight Search guifg=#C7C8D1 guibg=#67899E guisp=NONE gui=NONE blend=NONE +highlight Italic guifg=NONE guibg=NONE guisp=NONE gui=italic blend=NONE +highlight CursorLineNr guifg=#C7C8C0 guibg=NONE guisp=NONE gui=bold blend=NONE +highlight! link VisualNOS Visual +highlight DiffChange guifg=NONE guibg=#0C7D9D guisp=NONE gui=NONE blend=NONE +highlight! link ColorColumn CursorLine +highlight! link TSBoolean Boolean +highlight! link markdownLinkTextDelimiter Delimiter +highlight SpellBad guifg=#C7C8D1 guibg=NONE guisp=#AF4B57 gui=underline blend=NONE +highlight StatusLineGitChange guifg=#5486C0 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link TSInclude Include +highlight! link Include Keyword +highlight SpellLocal guifg=#C7C8D1 guibg=NONE guisp=#87B479 gui=underline blend=NONE +highlight! link NvimTreeOpenedFile NvimTreeOpenedFolderName +highlight! link TSSymbol Identifier +highlight! link TSConstMacro Macro +highlight! link TSTitle Title +highlight PmenuThumb guifg=NONE guibg=#C7C8D1 guisp=NONE gui=NONE blend=NONE +highlight SignChange guifg=#0C7D9D guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Delimiter guifg=#9092A2 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight TelescopeBorder guifg=#858585 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight NvimTreeFolderName guifg=#5486C0 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Underlined guifg=NONE guibg=NONE guisp=NONE gui=underline blend=NONE +highlight! link ModeMsg Normal +highlight LspDiagnosticsUnderlineError guifg=NONE guibg=NONE guisp=#AF4B57 gui=underline blend=NONE +highlight NvimTreeExecFile guifg=#87B479 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight IndentBlanklineContextChar guifg=#6B6B6B guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link MsgArea Normal +highlight TabLineSel guifg=#292929 guibg=#5486C0 guisp=NONE gui=NONE blend=NONE +highlight! link TSConditional Conditional +highlight BufferCurrentSign guifg=#64A6C4 guibg=#212121 guisp=NONE gui=NONE blend=NONE +highlight TSField guifg=#C7C8D1 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight LineNr guifg=#858585 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight WhichKeyDesc guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight Constant guifg=#C67158 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight TSAnnotation guifg=#64A6C4 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight BufferInactiveSign guifg=#858585 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight! link mkdInlineURL mkdLink +highlight mkdUnderline guifg=#858585 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight! link LspDiagnosticsError LspDiagnosticsSignError +highlight Boolean guifg=#AF4B57 guibg=NONE guisp=NONE gui=NONE blend=NONE +highlight PmenuSbar guifg=NONE guibg=#535A65 guisp=NONE gui=NONE blend=NONE +highlight StatusLineGit guifg=#C67158 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight StatusLineGitAdd guifg=#87B479 guibg=#292929 guisp=NONE gui=NONE blend=NONE +highlight StatusLineLspDiagnosticsInformation guifg=#FFCC66 guibg=#292929 guisp=NONE gui=NONE blend=NONE diff --git a/.config/nvim/config.lua b/.config/nvim/config.lua new file mode 100644 index 0000000..ca83853 --- /dev/null +++ b/.config/nvim/config.lua @@ -0,0 +1,49 @@ +-- O is the global options object + +-- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT +-- general +O.auto_complete = true +O.relative_number = true +O.colorscheme = 'spacegray' +O.timeoutlen = 100 +O.leader_key = ' ' + +-- After changing plugin config it is recommended to run :PackerCompile +O.plugin.hop.active = true +O.plugin.colorizer.active = true +O.plugin.trouble.active = true +O.plugin.lazygit.active = true +O.plugin.zen.active = true +-- O.plugin.vim_rooter.active = true +-- O.plugin.markdown_preview.active = true + +-- if you don't want all the parsers change this to a table of the ones you want +O.treesitter.ensure_installed = "all" +O.treesitter.ignore_install = {"haskell"} +O.treesitter.highlight.enabled = true + +-- lua +O.lang.lua.autoformat = false +O.lang.lua.formatter = 'lua-format' + +-- python +O.lang.python.formatter = 'black' +O.lang.python.linter = 'flake8' +O.lang.python.isort = true +O.lang.python.autoformat = true +O.lang.python.diagnostics.virtual_text = true +O.lang.python.diagnostics.signs = true +O.lang.python.diagnostics.underline = true + +-- rust + +-- go +O.lang.go.autoformat = true + +-- json +O.lang.json.autoformat = true +O.lang.json.formatter = 'prettier' + +-- sh +O.lang.sh.linter = 'shellcheck' +O.lang.sh.formatter = 'shfmt' diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index a18b64a..e1acacd 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,55 +1,29 @@ -require('globals') -require('plugins') -vim.cmd('luafile '..CONFIG_PATH..'/language-settings.lua') -require('settings') -require('_utils') -require('mappings') - -require('_autopairs') -require('_autocommands') - -require('_gitblame') -require('_gitsigns') - -require('_nvimtree') -require('colorscheme') - -require('_galaxyline') - -require('_hop') - -require('_comment') -require('_colorizer') -require('_compe') - -require('_barbar') - -require('_dashboard') - -require('_telescope') -require('_treesitter') - -require('_rnvimr') -require('_quickscope') -require('_which-key') -require('_vim-rooter') - -require('_lsp-rooter') -require('_true-zen') - -vim.cmd('source ~/.config/nvim/vim-script/functions.vim') - --- LSP -require('lsp') -require('lsp.clangd') -require('lsp.lua-ls') -require('lsp.bash-ls') -require('lsp.go-ls') -require('lsp.python-ls') -require('lsp.rust-ls') -require('lsp.json-ls') -require('lsp.yaml-ls') -require('lsp.vim-ls') -require('lsp.docker-ls') -require('lsp.emmet-ls') -require('lsp.efm-general-ls') +require "default-config" +require "keymappings" +vim.cmd("luafile " .. CONFIG_PATH .. "/config.lua") +require "settings" +require "plugins" +require "cfg.utils" +require "cfg.galaxyline" +require "cfg.treesitter" +require "cfg.which-key" +require "cfg.lsp" +if O.lang.emmet.active then + require "cfg.lsp.emmet-ls" +end +if O.lang.tailwindcss.active then + require "cfg.lsp.tailwindcss-ls" +end + +-- autoformat +if O.format_on_save then + require("cfg.utils").define_augroups { + autoformat = { + { + "BufWritePre", + "*", + [[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]], + }, + }, + } +end diff --git a/.config/nvim/language-settings.lua b/.config/nvim/language-settings.lua deleted file mode 100644 index c768737..0000000 --- a/.config/nvim/language-settings.lua +++ /dev/null @@ -1,38 +0,0 @@ --- general -O.auto_complete = true -O.colorscheme = 'lunar' -O.auto_close_tree = 0 -O.wrap_lines = false - -O.clang.diagnostics.virtual_text = false -O.clang.diagnostics.signs = false -O.clang.diagnostics.underline = false - --- python -O.python.formatter = 'black' -O.python.linter = 'flake8' -O.python.isort = true -O.python.autoformat = true -O.python.diagnostics.virtual_text = true -O.python.diagnostics.signs = true -O.python.diagnostics.underline = true - --- go -O.go.autoformat = true - --- lua -O.lua.formatter = 'lua-format' -O.lua.autoformat = false - --- javascript -O.tsserver.formatter = 'prettier' -O.tsserver.linter = nil -O.tsserver.autoformat = true - --- json -O.json.autoformat = true -O.json.formatter = 'prettier' - --- sh -O.sh.linter = 'shellcheck' -O.sh.formatter = 'shfmt' diff --git a/.config/nvim/lua/_autocommands/init.lua b/.config/nvim/lua/_autocommands/init.lua deleted file mode 100644 index 0b69c0f..0000000 --- a/.config/nvim/lua/_autocommands/init.lua +++ /dev/null @@ -1,67 +0,0 @@ -local utils = require('_utils') - -local auto_formatters = { } - -local python_autoformat = {'BufWritePre', '*.py', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.python.autoformat then table.insert(auto_formatters, python_autoformat) end - -local javascript_autoformat = {'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -local javascriptreact_autoformat = {'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -local typescript_autoformat = {'BufWritePre', '*.ts', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -local typescriptreact_autoformat = {'BufWritePre', '*.tsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.tsserver.autoformat then - table.insert(auto_formatters, javascript_autoformat) - table.insert(auto_formatters, javascriptreact_autoformat) - table.insert(auto_formatters, typescript_autoformat) - table.insert(auto_formatters, typescriptreact_autoformat) -end - -local lua_format = {'BufWritePre', '*.lua', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.lua.autoformat then table.insert(auto_formatters, lua_format) end - -local json_format = {'BufWritePre', '*.json', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} -if O.json.autoformat then table.insert(auto_formatters, json_format) end - -local go_format = {'BufWritePre', '*.go', 'lua vim.lsp.buf.formatting_sync(nil,1000)'} -if O.go.autoformat then table.insert(auto_formatters, go_format) end - -utils.define_augroups({ - _general_settings = { - {'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'Search\', timeout = 200})'}, - {'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, - {'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, - {'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, - {'VimLeavePre', '*', 'set title set titleold='}, - {'FileType', 'qf', 'set nobuflisted'}, - - }, - _go = { - -- Go generally requires Tabs instead of spaces. - {'FileType', 'go', 'setlocal tabstop=4'}, - {'FileType', 'go', 'setlocal shiftwidth=4'}, - {'FileType', 'go', 'setlocal softtabstop=4'}, - {'FileType', 'go', 'setlocal noexpandtab'}, - }, - _dashboard = { - -- seems to be nobuflisted that makes my stuff disapear will do more testing - { - 'FileType', 'dashboard', - 'setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ' - }, {'FileType', 'dashboard', 'set showtabline=0 | autocmd BufLeave <buffer> set showtabline=2'} - }, - _markdown = {{'FileType', 'markdown', 'setlocal wrap'}, {'FileType', 'markdown', 'setlocal spell'}}, - _solidity = { - {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'}, - {'BufNewFile', '*.sol', 'setlocal filetype=solidity'} - }, - _gemini = { - {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'}, - {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'} - }, - _buffer_bindings = { - {'FileType', 'dashboard', 'nnoremap <silent> <buffer> q :q<CR>'}, - {'FileType', 'lspinfo', 'nnoremap <silent> <buffer> q :q<CR>'}, - {'FileType', 'floaterm', 'nnoremap <silent> <buffer> q :q<CR>'}, - }, - _auto_formatters = auto_formatters -}) diff --git a/.config/nvim/lua/_autopairs/init.lua b/.config/nvim/lua/_autopairs/init.lua deleted file mode 100644 index d9caf22..0000000 --- a/.config/nvim/lua/_autopairs/init.lua +++ /dev/null @@ -1,45 +0,0 @@ -local remap = vim.api.nvim_set_keymap -local npairs = require('nvim-autopairs') -local Rule = require('nvim-autopairs.rule') - --- skip it, if you use another global object -_G.MUtils= {} - -vim.g.completion_confirm_key = "" -MUtils.completion_confirm=function() - if vim.fn.pumvisible() ~= 0 then - if vim.fn.complete_info()["selected"] ~= -1 then - return vim.fn["compe#confirm"](npairs.esc("<cr>")) - else - return npairs.esc("<cr>") - end - else - return npairs.autopairs_cr() - end -end - - -remap('i' , '<CR>','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true}) - -npairs.setup({ - check_ts = true, - ts_config = { - lua = {'string'},-- it will not add pair on that treesitter node - javascript = {'template_string'}, - java = false,-- don't check treesitter on java - } -}) - -require('nvim-treesitter.configs').setup { - autopairs = {enable = true} -} - -local ts_conds = require('nvim-autopairs.ts-conds') - --- press % => %% is only inside comment or string -npairs.add_rules({ - Rule("%", "%", "lua") - :with_pair(ts_conds.is_ts_node({'string','comment'})), - Rule("$", "$", "lua") - :with_pair(ts_conds.is_not_ts_node({'function'})) -}) diff --git a/.config/nvim/lua/_barbar/init.lua b/.config/nvim/lua/_barbar/init.lua deleted file mode 100644 index 49c1206..0000000 --- a/.config/nvim/lua/_barbar/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.api.nvim_set_keymap('n', '<TAB>', ':BufferNext<CR>', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferPrevious<CR>', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '<S-x>', ':BufferClose<CR>', { noremap = true, silent = true }) diff --git a/.config/nvim/lua/_closetag/init.lua b/.config/nvim/lua/_closetag/init.lua deleted file mode 100644 index 8c11641..0000000 --- a/.config/nvim/lua/_closetag/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.g.closetag_filenames = '*.html,*.xhtml,*.phtml' -vim.g.closetag_xhtml_filenames = '*.xhtml,*.jsx,*.js' -vim.g.closetag_filetypes = 'html,xhtml,phtml,javascript,javascriptreact' diff --git a/.config/nvim/lua/_colorizer/init.lua b/.config/nvim/lua/_colorizer/init.lua deleted file mode 100644 index 52e1f8f..0000000 --- a/.config/nvim/lua/_colorizer/init.lua +++ /dev/null @@ -1,11 +0,0 @@ -require'colorizer'.setup( - {'*';}, - { - RGB = true; -- #RGB hex codes - RRGGBB = true; -- #RRGGBB hex codes - RRGGBBAA = true; -- #RRGGBBAA hex codes - rgb_fn = true; -- CSS rgb() and rgba() functions - hsl_fn = true; -- CSS hsl() and hsla() functions - css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn - }) diff --git a/.config/nvim/lua/_comment/init.lua b/.config/nvim/lua/_comment/init.lua deleted file mode 100644 index e1f1358..0000000 --- a/.config/nvim/lua/_comment/init.lua +++ /dev/null @@ -1 +0,0 @@ -require('nvim_comment').setup() diff --git a/.config/nvim/lua/_compe/init.lua b/.config/nvim/lua/_compe/init.lua deleted file mode 100644 index 10b3c54..0000000 --- a/.config/nvim/lua/_compe/init.lua +++ /dev/null @@ -1,97 +0,0 @@ -vim.o.completeopt = "menuone,noselect" - -require'compe'.setup { - enabled = O.auto_complete, - autocomplete = true, - debug = false, - min_length = 1, - preselect = 'enable', - throttle_time = 80, - source_timeout = 200, - incomplete_delay = 400, - max_abbr_width = 100, - max_kind_width = 100, - max_menu_width = 100, - documentation = true, - - source = { - path = {kind = " (Path)"}, - buffer = {kind = " (Buffer)"}, - calc = {kind = " (Calc)"}, - vsnip = {kind = " (Snippet)"}, - nvim_lsp = {kind = " (LSP)"}, - nvim_lua = false, - spell = {kind = " (Spell)"}, - tags = false, - vim_dadbod_completion = true, - emoji = {kind = " ﲃ (Emoji)", filetypes={"markdown", "text"}} - } -} - --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- m --- --- --- --- - -local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) -end - -local check_back_space = function() - local col = vim.fn.col('.') - 1 - if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then - return true - else - return false - end -end - --- Use (s-)tab to: ---- move to prev/next item in completion menuone ---- jump to prev/next snippet's placeholder -_G.tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "<C-n>" - elseif vim.fn.call("vsnip#available", {1}) == 1 then - return t "<Plug>(vsnip-expand-or-jump)" - elseif check_back_space() then - return t "<Tab>" - else - return vim.fn['compe#complete']() - end -end -_G.s_tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "<C-p>" - elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then - return t "<Plug>(vsnip-jump-prev)" - else - return t "<S-Tab>" - end -end - -vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) diff --git a/.config/nvim/lua/_dashboard/init.lua b/.config/nvim/lua/_dashboard/init.lua deleted file mode 100644 index faa50be..0000000 --- a/.config/nvim/lua/_dashboard/init.lua +++ /dev/null @@ -1,33 +0,0 @@ -vim.g.dashboard_custom_header = { - ' ##############..... ############## ', - ' ##############......############## ', - ' ##########..........########## ', - ' ##########........########## ', - ' ##########.......########## ', - ' ##########.....##########.. ', - ' ##########....##########..... ', - ' ..##########..##########......... ', - ' ....##########.#########............. ', - ' ..################JJJ............ ', - ' ################............. ', - ' ##############.JJJ.JJJJJJJJJJ ', - ' ############...JJ...JJ..JJ JJ ', - ' ##########....JJ...JJ..JJ JJ ', - ' ########......JJJ..JJJ JJJ JJJ ', - ' ###### ......... ', - ' ..... ', - ' . ', -} - - -vim.g.dashboard_default_executive = 'telescope' - -vim.g.dashboard_custom_section = { - a = {description = {' Find File '}, command = 'Telescope find_files'}, - b = {description = {' Recently Used Files'}, command = 'Telescope oldfiles'}, - c = {description = {' Load Last Session '}, command = 'SessionLoad'}, - d = {description = {' Find Word '}, command = 'Telescope live_grep'}, - e = {description = {' Settings '}, command = ':e ~/.config/nvim/language-settings.lua'} -} - -vim.g.dashboard_custom_footer = {''} diff --git a/.config/nvim/lua/_galaxyline/init.lua b/.config/nvim/lua/_galaxyline/init.lua deleted file mode 100644 index 7003575..0000000 --- a/.config/nvim/lua/_galaxyline/init.lua +++ /dev/null @@ -1,207 +0,0 @@ -local gl = require('galaxyline') --- get my theme in galaxyline repo -local colors = { - bg = '#080808', - yellow = '#DCDCAA', - dark_yellow = '#D7BA7D', - cyan = '#4EC9B0', - green = '#608B4E', - light_green = '#B5CEA8', - string_orange = '#CE9178', - orange = '#FF8800', - purple = '#C586C0', - magenta = '#D16D9E', - grey = '#858585', - blue = '#569CD6', - vivid_blue = '#4FC1FF', - light_blue = '#9CDCFE', - red = '#D16969', - error_red = '#F44747', - info_yellow = '#FFCC66' -} -local condition = require('galaxyline.condition') -local gls = gl.section -gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'} - -table.insert(gls.left, { - ViMode = { - provider = function() - -- auto change color according the vim mode - local mode_color = { - n = colors.blue, - i = colors.green, - v = colors.purple, - [''] = colors.purple, - V = colors.purple, - c = colors.magenta, - no = colors.blue, - s = colors.orange, - S = colors.orange, - [''] = colors.orange, - ic = colors.yellow, - R = colors.red, - Rv = colors.red, - cv = colors.blue, - ce = colors.blue, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.blue, - t = colors.blue - } - vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()]) - return '⏽ ' - end, - highlight = {colors.red, colors.bg} - } -}) - -print(vim.fn.getbufvar(0, 'ts')) -vim.fn.getbufvar(0, 'ts') - -gls.left[2] = { - GitIcon = { - provider = function() - return ' ' - end, - condition = condition.check_git_workspace, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.orange, colors.bg} - } -} - -gls.left[3] = { - GitBranch = { - provider = 'GitBranch', - condition = condition.check_git_workspace, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.left[4] = { - DiffAdd = { - provider = 'DiffAdd', - condition = condition.hide_in_width, - icon = ' ', - highlight = {colors.green, colors.bg} - } -} -gls.left[5] = { - DiffModified = { - provider = 'DiffModified', - condition = condition.hide_in_width, - icon = ' 柳', - highlight = {colors.blue, colors.bg} - } -} -gls.left[6] = { - DiffRemove = { - provider = 'DiffRemove', - condition = condition.hide_in_width, - icon = ' ', - highlight = {colors.red, colors.bg} - } -} - -gls.right[1] = { - DiagnosticError = {provider = 'DiagnosticError', icon = ' ', highlight = {colors.error_red, colors.bg}} -} -gls.right[2] = {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = ' ', highlight = {colors.orange, colors.bg}}} - -gls.right[3] = { - DiagnosticHint = {provider = 'DiagnosticHint', icon = ' ', highlight = {colors.vivid_blue, colors.bg}} -} - -gls.right[4] = {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = ' ', highlight = {colors.info_yellow, colors.bg}}} - -gls.right[5] = { - ShowLspClient = { - provider = 'GetLspClient', - condition = function() - local tbl = {['dashboard'] = true, [' '] = true} - if tbl[vim.bo.filetype] then return false end - return true - end, - icon = ' ', - highlight = {colors.grey, colors.bg} - } -} - -gls.right[6] = { - LineInfo = { - provider = 'LineColumn', - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.right[7] = { - PerCent = { - provider = 'LinePercent', - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.right[8] = { - Tabstop = { - provider = function() - return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " " - end, - condition = condition.hide_in_width, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.right[9] = { - BufferType = { - provider = 'FileTypeName', - condition = condition.hide_in_width, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.right[10] = { - FileEncode = { - provider = 'FileEncode', - condition = condition.hide_in_width, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.right[11] = { - Space = { - provider = function() - return ' ' - end, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.orange, colors.bg} - } -} - -gls.short_line_left[1] = { - BufferType = { - provider = 'FileTypeName', - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.grey, colors.bg} - } -} - -gls.short_line_left[2] = { - SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.grey, colors.bg}} -} - -gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}} diff --git a/.config/nvim/lua/_gitsigns/init.lua b/.config/nvim/lua/_gitsigns/init.lua deleted file mode 100644 index c19a5d0..0000000 --- a/.config/nvim/lua/_gitsigns/init.lua +++ /dev/null @@ -1,24 +0,0 @@ -require('gitsigns').setup { - signs = { - -- TODO add hl to colorscheme - add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - changedelete = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - }, - numhl = false, - linehl = false, - keymaps = { - -- Default keymap options - noremap = true, - buffer = true, - }, - watch_index = { - interval = 1000 - }, - sign_priority = 6, - update_debounce = 200, - status_formatter = nil, -- Use default - use_decoration_api = false -} diff --git a/.config/nvim/lua/_lsp-rooter/init.lua b/.config/nvim/lua/_lsp-rooter/init.lua deleted file mode 100644 index 7f84907..0000000 --- a/.config/nvim/lua/_lsp-rooter/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -require("lsp-rooter").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - } diff --git a/.config/nvim/lua/_lspinstall/init.lua b/.config/nvim/lua/_lspinstall/init.lua deleted file mode 100644 index 34a9fe6..0000000 --- a/.config/nvim/lua/_lspinstall/init.lua +++ /dev/null @@ -1,27 +0,0 @@ --- 1. get the config for this server from nvim-lspconfig and adjust the cmd path. --- relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us! -local config = require'lspconfig'.jdtls.document_config -require'lspconfig/configs'.jdtls = nil -- important, unset the loaded config again --- config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server" - --- 2. extend the config with an install_script and (optionally) uninstall_script -require'lspinstall/servers'.jdtls = vim.tbl_extend('error', config, { - -- lspinstall will automatically create/delete the install directory for every server - install_script = [[ - git clone https://github.com/eclipse/eclipse.jdt.ls.git - cd eclipse.jdt.ls - ./mvnw clean verify - ]], - uninstall_script = nil -- can be omitted -}) - -require'lspinstall/servers'.kotlin = vim.tbl_extend('error', config, { - install_script = [[ - git clone https://github.com/fwcd/kotlin-language-server.git language-server - cd language-server - ./gradlew :server:installDist - ]], - uninstall_script = nil -- can be omitted -}) - -require'lspinstall'.setup() diff --git a/.config/nvim/lua/_lspkind/init.lua b/.config/nvim/lua/_lspkind/init.lua deleted file mode 100644 index e3c590f..0000000 --- a/.config/nvim/lua/_lspkind/init.lua +++ /dev/null @@ -1,26 +0,0 @@ --- symbols for autocomplete -require('lspkind').init({ - with_text = false, - symbol_map = { - Text = ' ', - Method = ' ', - Function = ' ', - Constructor = ' ', - Variable = '[]', - Class = ' ', - Interface = ' 蘒', - Module = ' ', - Property = ' ', - Unit = ' 塞 ', - Value = ' ', - Enum = ' 練', - Keyword = ' ', - Snippet = ' ', - Color = '', - File = '', - Folder = ' ﱮ ', - EnumMember = ' ', - Constant = ' ', - Struct = ' ' - }, -}) diff --git a/.config/nvim/lua/_numb/init.lua b/.config/nvim/lua/_numb/init.lua deleted file mode 100644 index 415327f..0000000 --- a/.config/nvim/lua/_numb/init.lua +++ /dev/null @@ -1,4 +0,0 @@ -require('numb').setup{ - show_numbers = true, -- Enable 'number' for the window while peeking - show_cursorline = true -- Enable 'cursorline' for the window while peeking -} diff --git a/.config/nvim/lua/_nvimtree/init.lua b/.config/nvim/lua/_nvimtree/init.lua deleted file mode 100644 index 64dff6c..0000000 --- a/.config/nvim/lua/_nvimtree/init.lua +++ /dev/null @@ -1,64 +0,0 @@ ---[[ " ---let g:nvim_tree_auto_ignore_ft = 'startify' "empty by default, don't auto open tree on specific filetypes. -let g:nvim_tree_hide_dotfiles = 1 "0 by default, this option hides files and folders starting with a dot `.` -let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons). -" let g:nvim_tree_tab_open = 1 "0 by default, will open the tree when entering a new tab and the tree was previously open -" let g:nvim_tree_width_allow_resize = 1 "0 by default, will not resize the tree when opening a file -let g:nvim_tree_show_icons = { - \ 'git': 1, - \ 'folders': 1, - \ 'files': 1, - \ } -"If 0, do not show the icons for one of 'git' 'folder' and 'files' -"1 by default, notice that if 'files' is 1, it will only display -"if nvim-web-devicons is installed and on your runtimepath ]] -- vim.g.nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default --- vim.g.nvim_tree_disable_netrw = 0 -- moved to lv-globals --- vim.g.nvim_tree_hijack_netrw = 0 --"1 by default, prevents netrw from automatically opening when opening directories (but lets you keep its other utilities) -vim.g.nvim_tree_hide_dotfiles = 1 -- 0 by default, this option hides files and folders starting with a dot `.` -vim.g.nvim_tree_indent_markers = 1 -- "0 by default, this option shows indent markers when folders are open -vim.g.nvim_tree_follow = 1 -- "0 by default, this option allows the cursor to be updated when entering a buffer -vim.g.nvim_tree_auto_close = O.auto_close_tree -- 0 by default, closes the tree when it's the last window -vim.g.nvim_tree_auto_ignore_ft = 'startify' --empty by default, don't auto open tree on specific filetypes. -local tree_cb = require'nvim-tree.config'.nvim_tree_callback - vim.g.nvim_tree_bindings = { - -- ["<CR>"] = ":YourVimFunction()<cr>", - -- ["u"] = ":lua require'some_module'.some_function()<cr>", - - -- default mappings - ["<CR>"] = tree_cb("edit"), - ["o"] = tree_cb("edit"), - ["l"] = tree_cb("edit"), - ["<2-LeftMouse>"] = tree_cb("edit"), - ["<2-RightMouse>"] = tree_cb("cd"), - ["<C-]>"] = tree_cb("cd"), - ["v"] = tree_cb("vsplit"), - ["s"] = tree_cb("split"), - ["<C-t>"] = tree_cb("tabnew"), - ["<"] = tree_cb("prev_sibling"), - [">"] = tree_cb("next_sibling"), - ["<BS>"] = tree_cb("close_node"), - ["h"] = tree_cb("close_node"), - ["<S-CR>"] = tree_cb("close_node"), - ["<Tab>"] = tree_cb("preview"), - ["I"] = tree_cb("toggle_ignored"), - ["H"] = tree_cb("toggle_dotfiles"), - ["R"] = tree_cb("refresh"), - ["a"] = tree_cb("create"), - ["d"] = tree_cb("remove"), - ["r"] = tree_cb("rename"), - ["<C-r>"] = tree_cb("full_rename"), - ["x"] = tree_cb("cut"), - ["c"] = tree_cb("copy"), - ["p"] = tree_cb("paste"), - ["[c"] = tree_cb("prev_git_item"), - ["]c"] = tree_cb("next_git_item"), - ["-"] = tree_cb("dir_up"), - ["q"] = tree_cb("close"), - } --- vim.g.nvim_tree_show_icons = {git = 1, folders = 1, files = 1} -vim.g.nvim_tree_icons = { - default = '', - symlink = '', - git = {unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = ""}, - folder = {default = "", open = "", empty = "", empty_open = "", symlink = ""} -} diff --git a/.config/nvim/lua/_quickscope/init.lua b/.config/nvim/lua/_quickscope/init.lua deleted file mode 100644 index 817bc6d..0000000 --- a/.config/nvim/lua/_quickscope/init.lua +++ /dev/null @@ -1,4 +0,0 @@ --- Trigger a highlight in the appropriate direction when pressing these keys: --- vim.cmd('let g:qs_highlight_on_keys = [\'f\', \'F\', \'t\', \'T\']') -vim.g.qs_highlight_on_keys = {'f', 'F', 't', 'T'} -vim.g.qs_max_chars=150 diff --git a/.config/nvim/lua/_rnvimr/init.lua b/.config/nvim/lua/_rnvimr/init.lua deleted file mode 100644 index f84bde9..0000000 --- a/.config/nvim/lua/_rnvimr/init.lua +++ /dev/null @@ -1,6 +0,0 @@ --- Make Ranger replace netrw and be the file explorer -vim.g.rnvimr_ex_enable = 1 -vim.g.rnvimr_draw_border = 1 -vim.g.rnvimr_pick_enable = 1 -vim.g.rnvimr_bw_enable = 1 -vim.api.nvim_set_keymap('n', '-', ':RnvimrToggle<CR>', {noremap = true, silent = true}) diff --git a/.config/nvim/lua/_telescope/init.lua b/.config/nvim/lua/_telescope/init.lua deleted file mode 100644 index 497f74d..0000000 --- a/.config/nvim/lua/_telescope/init.lua +++ /dev/null @@ -1,69 +0,0 @@ -local actions = require('telescope.actions') -local trouble = require("trouble.providers.telescope") --- Global remapping ------------------------------- --- '--color=never', -require('telescope').setup { - defaults = { - vimgrep_arguments = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'}, - prompt_position = "top", - prompt_prefix = " ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "ascending", - layout_strategy = "horizontal", - layout_defaults = {horizontal = {mirror = false}, vertical = {mirror = false}}, - file_sorter = require'telescope.sorters'.get_fuzzy_file, - file_ignore_patterns = {}, - generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, - shorten_path = true, - winblend = 0, - width = 0.75, - preview_cutoff = 120, - results_height = 1, - results_width = 0.8, - border = {}, - borderchars = {"─", "│", "─", "│", "┌", "┐", "┘", "└"}, - color_devicons = true, - use_less = true, - set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil, - 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, - - -- Developer configurations: Not meant for general override - buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, - mappings = { - i = { - ["<C-c>"] = actions.close, - ["<C-j>"] = actions.move_selection_next, - ["<C-k>"] = actions.move_selection_previous, - ["<c-t>"] = trouble.open_with_trouble, - ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist, - -- To disable a keymap, put [map] = false - -- So, to not map "<C-n>", just put - -- ["<c-x>"] = false, - -- ["<esc>"] = actions.close, - - -- Otherwise, just set the mapping to the function that you want it to be. - -- ["<C-i>"] = actions.select_horizontal, - - -- Add up multiple actions - ["<CR>"] = actions.select_default + actions.center - - -- You can perform as many actions in a row as you like - -- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action, - }, - n = { - ["<C-j>"] = actions.move_selection_next, - ["<C-k>"] = actions.move_selection_previous, - ["<c-t>"] = trouble.open_with_trouble, - ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist - -- ["<C-i>"] = my_cool_custom_action, - } - } - }, - extensions = {fzy_native = {override_generic_sorter = false, override_file_sorter = true}} -} diff --git a/.config/nvim/lua/_treesitter/init.lua b/.config/nvim/lua/_treesitter/init.lua deleted file mode 100644 index 0cf6c56..0000000 --- a/.config/nvim/lua/_treesitter/init.lua +++ /dev/null @@ -1,21 +0,0 @@ -require'nvim-treesitter.configs'.setup { - ensure_installed = O.treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages - ignore_install = O.treesitter.ignore_install, - matchup = { - enable = true, -- mandatory, false will disable the whole extension - -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled - }, - highlight = { - enable = O.treesitter.highlight.enabled -- false will disable the whole extension - }, - context_commentstring = { - enable = true, - config = { - css = '// %s' - } - }, - -- indent = {enable = true, disable = {"python", "html", "javascript"}}, - -- TODO seems to be broken - indent = {enable = {"javascriptreact"}}, - autotag = {enable = true}, -} diff --git a/.config/nvim/lua/_true-zen/init.lua b/.config/nvim/lua/_true-zen/init.lua deleted file mode 100644 index 7608f41..0000000 --- a/.config/nvim/lua/_true-zen/init.lua +++ /dev/null @@ -1,52 +0,0 @@ --- setup for TrueZen.nvim -require("true-zen").setup({ - true_false_commands = false, - cursor_by_mode = false, - before_minimalist_mode_shown = false, - before_minimalist_mode_hidden = false, - after_minimalist_mode_shown = false, - after_minimalist_mode_hidden = false, - bottom = { - hidden_laststatus = 0, - hidden_ruler = false, - hidden_showmode = false, - hidden_showcmd = false, - hidden_cmdheight = 1, - - shown_laststatus = 2, - shown_ruler = true, - shown_showmode = false, - shown_showcmd = false, - shown_cmdheight = 1 - }, - top = { - hidden_showtabline = 0, - shown_showtabline = 2 - }, - left = { - hidden_number = false, - hidden_relativenumber = false, - hidden_signcolumn = "no", - - shown_number = true, - shown_relativenumber = true, - shown_signcolumn = "no" - }, - ataraxis = { - just_do_it_for_me = false, - left_padding = 64, - right_padding = 64, - top_padding = 0, - bottom_padding = 0 - }, - integrations = { - integration_galaxyline = true, - integration_vim_airline = false, - integration_vim_powerline = false, - integration_tmux = true, - integration_express_line = false, - integration_gitgutter = false, - integration_vim_signify = false, - integration_limelight = false - } -}) diff --git a/.config/nvim/lua/_utils/init.lua b/.config/nvim/lua/_utils/init.lua deleted file mode 100644 index 9e15c02..0000000 --- a/.config/nvim/lua/_utils/init.lua +++ /dev/null @@ -1,189 +0,0 @@ -local lv_utils = {} - -function lv_utils.define_augroups(definitions) -- {{{1 - -- Create autocommand groups based on the passed definitions - -- - -- The key will be the name of the group, and each definition - -- within the group should have: - -- 1. Trigger - -- 2. Pattern - -- 3. Text - -- just like how they would normally be defined from Vim itself - for group_name, definition in pairs(definitions) do - vim.cmd('augroup ' .. group_name) - vim.cmd('autocmd!') - - for _, def in pairs(definition) do - local command = table.concat(vim.tbl_flatten {'autocmd', def}, ' ') - vim.cmd(command) - end - - vim.cmd('augroup END') - end -end - --- lsp - -function lv_utils.add_to_workspace_folder() - vim.lsp.buf.add_workspace_folder() -end - -function lv_utils.clear_references() - vim.lsp.buf.clear_references() -end - -function lv_utils.code_action() - vim.lsp.buf.code_action() -end - -function lv_utils.declaration() - vim.lsp.buf.declaration() - vim.lsp.buf.clear_references() -end - -function lv_utils.definition() - vim.lsp.buf.definition() - vim.lsp.buf.clear_references() -end - -function lv_utils.document_highlight() - vim.lsp.buf.document_highlight() -end - -function lv_utils.document_symbol() - vim.lsp.buf.document_symbol() -end - -function lv_utils.formatting() - vim.lsp.buf.formatting() -end - -function lv_utils.formatting_sync() - vim.lsp.buf.formatting_sync() -end - -function lv_utils.hover() - vim.lsp.buf.hover() -end - -function lv_utils.implementation() - vim.lsp.buf.implementation() -end - -function lv_utils.incoming_calls() - vim.lsp.buf.incoming_calls() -end - -function lv_utils.list_workspace_folders() - vim.lsp.buf.list_workspace_folders() -end - -function lv_utils.outgoing_calls() - vim.lsp.buf.outgoing_calls() -end - -function lv_utils.range_code_action() - vim.lsp.buf.range_code_action() -end - -function lv_utils.range_formatting() - vim.lsp.buf.range_formatting() -end - -function lv_utils.references() - vim.lsp.buf.references() - vim.lsp.buf.clear_references() -end - -function lv_utils.remove_workspace_folder() - vim.lsp.buf.remove_workspace_folder() -end - -function lv_utils.rename() - vim.lsp.buf.rename() -end - -function lv_utils.signature_help() - vim.lsp.buf.signature_help() -end - -function lv_utils.type_definition() - vim.lsp.buf.type_definition() -end - -function lv_utils.workspace_symbol() - vim.lsp.buf.workspace_symbol() -end - --- diagnostic - -function lv_utils.get_all() - vim.lsp.diagnostic.get_all() -end - -function lv_utils.get_next() - vim.lsp.diagnostic.get_next() -end - -function lv_utils.get_prev() - vim.lsp.diagnostic.get_prev() -end - -function lv_utils.goto_next() - vim.lsp.diagnostic.goto_next() -end - -function lv_utils.goto_prev() - vim.lsp.diagnostic.goto_prev() -end - -function lv_utils.show_line_diagnostics() - vim.lsp.diagnostic.show_line_diagnostics() -end - --- git signs - -function lv_utils.next_hunk() - require('gitsigns').next_hunk() -end - -function lv_utils.prev_hunk() - require('gitsigns').prev_hunk() -end - -function lv_utils.stage_hunk() - require('gitsigns').stage_hunk() -end - -function lv_utils.undo_stage_hunk() - require('gitsigns').undo_stage_hunk() -end - -function lv_utils.reset_hunk() - require('gitsigns').reset_hunk() -end - -function lv_utils.reset_buffer() - require('gitsigns').reset_buffer() -end - -function lv_utils.preview_hunk() - require('gitsigns').preview_hunk() -end - -function lv_utils.blame_line() - require('gitsigns').blame_line() -end - --- misc -function lv_utils.file_exists(name) - local f = io.open(name, "r") - if f ~= nil then - io.close(f) - return true - else - return false - end -end - -return lv_utils diff --git a/.config/nvim/lua/_which-key/init.lua b/.config/nvim/lua/_which-key/init.lua deleted file mode 100644 index 1e78a77..0000000 --- a/.config/nvim/lua/_which-key/init.lua +++ /dev/null @@ -1,162 +0,0 @@ -require("which-key").setup { - plugins = { - marks = true, -- shows a list of your marks on ' and ` - registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode - -- the presets plugin, adds help for a bunch of default keybindings in Neovim - -- No actual key bindings are created - presets = { - operators = false, -- adds help for operators like d, y, ... - motions = false, -- adds help for motions - text_objects = false, -- help for text objects triggered after entering an operator - windows = true, -- default bindings on <c-w> - nav = true, -- misc bindings to work with windows - z = true, -- bindings for folds, spelling and others prefixed with z - g = true -- bindings for prefixed with g - } - }, - icons = { - breadcrumb = "»", -- symbol used in the command line area that shows your active key combo - separator = "➜", -- symbol used between a key and it's label - group = "+" -- symbol prepended to a group - }, - window = { - border = "single", -- none, single, double, shadow - position = "bottom", -- bottom, top - margin = {1, 0, 1, 0}, -- extra window margin [top, right, bottom, left] - padding = {2, 2, 2, 2} -- extra window padding [top, right, bottom, left] - }, - layout = { - height = {min = 4, max = 25}, -- min and max height of the columns - width = {min = 20, max = 50}, -- min and max width of the columns - spacing = 3 -- spacing between columns - }, - hidden = {"<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate - show_help = true -- show help message on the command line when the popup is visible -} - -local opts = { - mode = "n", -- NORMAL mode - prefix = "<leader>", - buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings - silent = true, -- use `silent` when creating keymaps - noremap = true, -- use `noremap` when creating keymaps - nowait = false -- use `nowait` when creating keymaps -} - --- Set leader -vim.api.nvim_set_keymap('n', '<Space>', '<NOP>', {noremap = true, silent = true}) -vim.g.mapleader = ' ' - --- no hl - vim.api.nvim_set_keymap('n', '<Leader>n', ':set hlsearch!<CR>', {noremap = true, silent = true}) - --- explorer -vim.api.nvim_set_keymap('n', '<Leader>e', ':NvimTreeToggle<CR>', {noremap = true, silent = true}) - --- telescope -vim.api.nvim_set_keymap('n', '<Leader>f', ':Telescope find_files<CR>', {noremap = true, silent = true}) - --- dashboard -vim.api.nvim_set_keymap('n', '<Leader>;', ':Dashboard<CR>', {noremap = true, silent = true}) - --- Comments -vim.api.nvim_set_keymap("n", "<leader>k", ":CommentToggle<CR>", {noremap = true, silent = true}) -vim.api.nvim_set_keymap("v", "<leader>k", ":CommentToggle<CR>", {noremap = true, silent = true}) - --- close buffer -vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", {noremap = true, silent = true}) - --- split window -vim.api.nvim_set_keymap("n", "<leader>v", ":vsplit<CR>", {noremap = true, silent = true}) -vim.api.nvim_set_keymap("n", "<leader>h", ":split<CR>", {noremap = true, silent = true}) - --- open projects -vim.api.nvim_set_keymap('n', '<leader>p', ":lua require'telescope'.extensions.project.project{}<CR>", - {noremap = true, silent = true}) --- TODO create entire treesitter section - -local mappings = { - ["k"] = "Comment", - ["c"] = "Close Buffer", - ["e"] = "Explorer", - ["f"] = "Find File", - ["p"] = "Projects", - ["n"] = "No Highlight", - ["v"] = "Vertical Split", - ["h"] = "Horizontal Split", - d = { - name = "+Diagnostics", - t = {"<cmd>TroubleToggle<cr>", "trouble"}, - w = {"<cmd>TroubleToggle lsp_workspace_diagnostics<cr>", "workspace"}, - d = {"<cmd>TroubleToggle lsp_document_diagnostics<cr>", "document"}, - q = {"<cmd>TroubleToggle quickfix<cr>", "quickfix"}, - l = {"<cmd>TroubleToggle loclist<cr>", "loclist"}, - r = {"<cmd>TroubleToggle lsp_references<cr>", "references"}, - }, - D = { - name = "+Debug", - b = {"<cmd>DebugToggleBreakpoint<cr>", "Toggle Breakpoint"}, - c = {"<cmd>DebugContinue<cr>", "Continue"}, - i = {"<cmd>DebugStepInto<cr>", "Step Into"}, - o = {"<cmd>DebugStepOver<cr>", "Step Over"}, - r = {"<cmd>DebugToggleRepl<cr>", "Toggle Repl"}, - s = {"<cmd>DebugStart<cr>", "Start"} - }, - g = { - name = "+Git", - j = {"<cmd>NextHunk<cr>", "Next Hunk"}, - k = {"<cmd>PrevHunk<cr>", "Prev Hunk"}, - p = {"<cmd>PreviewHunk<cr>", "Preview Hunk"}, - r = {"<cmd>ResetHunk<cr>", "Reset Hunk"}, - R = {"<cmd>ResetBuffer<cr>", "Reset Buffer"}, - s = {"<cmd>StageHunk<cr>", "Stage Hunk"}, - u = {"<cmd>UndoStageHunk<cr>", "Undo Stage Hunk"}, - o = {"<cmd>Telescope git_status<cr>", "Open changed file"}, - b = {"<cmd>Telescope git_branches<cr>", "Checkout branch"}, - c = {"<cmd>Telescope git_commits<cr>", "Checkout commit"}, - C = {"<cmd>Telescope git_bcommits<cr>", "Checkout commit(for current file)"}, - }, - l = { - name = "+LSP", - a = {"<cmd>Lspsaga code_action<cr>", "Code Action"}, - A = {"<cmd>Lspsaga range_code_action<cr>", "Selected Action"}, - d = {"<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics"}, - D = {"<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics"}, - f = {"<cmd>LspFormatting<cr>", "Format"}, - i = {"<cmd>LspInfo<cr>", "Info"}, - l = {"<cmd>Lspsaga lsp_finder<cr>", "LSP Finder"}, - L = {"<cmd>Lspsaga show_line_diagnostics<cr>", "Line Diagnostics"}, - p = {"<cmd>Lspsaga preview_definition<cr>", "Preview Definition"}, - q = {"<cmd>Telescope quickfix<cr>", "Quickfix"}, - r = {"<cmd>Lspsaga rename<cr>", "Rename"}, - t = {"<cmd>LspTypeDefinition<cr>", "Type Definition"}, - x = {"<cmd>cclose<cr>", "Close Quickfix"}, - s = {"<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols"}, - S = {"<cmd>Telescope lsp_workspace_symbols<cr>", "Workspace Symbols"} - }, - s = { - name = "+Search", - b = {"<cmd>Telescope git_branches<cr>", "Checkout branch"}, - c = {"<cmd>Telescope colorscheme<cr>", "Colorscheme"}, - d = {"<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics"}, - D = {"<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics"}, - f = {"<cmd>Telescope find_files<cr>", "Find File"}, - m = {"<cmd>Telescope marks<cr>", "Marks"}, - M = {"<cmd>Telescope man_pages<cr>", "Man Pages"}, - r = {"<cmd>Telescope oldfiles<cr>", "Open Recent File"}, - R = {"<cmd>Telescope registers<cr>", "Registers"}, - t = {"<cmd>Telescope live_grep<cr>", "Text"} - }, - S = {name = "+Session", s = {"<cmd>SessionSave<cr>", "Save Session"}, l = {"<cmd>SessionLoad<cr>", "Load Session"}}, - - -- extras - z = { - name = "+Zen", - s = {"<cmd>TZBottom<cr>", "toggle status line"}, - t = {"<cmd>TZTop<cr>", "toggle tab bar"}, - z = {"<cmd>TZAtaraxis<cr>", "toggle zen"}, - } -} - -local wk = require("which-key") -wk.register(mappings, opts) diff --git a/.config/nvim/lua/cfg/autopairs/init.lua b/.config/nvim/lua/cfg/autopairs/init.lua new file mode 100644 index 0000000..6a9e428 --- /dev/null +++ b/.config/nvim/lua/cfg/autopairs/init.lua @@ -0,0 +1,47 @@ +-- if not package.loaded['nvim-autopairs'] then +-- return +-- end +local npairs = require "nvim-autopairs" +local Rule = require "nvim-autopairs.rule" + +-- skip it, if you use another global object +_G.MUtils = {} + +vim.g.completion_confirm_key = "" +MUtils.completion_confirm = function() + if vim.fn.pumvisible() ~= 0 then + if vim.fn.complete_info()["selected"] ~= -1 then + return vim.fn["compe#confirm"](npairs.esc "<cr>") + else + return npairs.esc "<cr>" + end + else + return npairs.autopairs_cr() + end +end + +if package.loaded["compe"] then + require("nvim-autopairs.completion.compe").setup { + map_cr = true, -- map <CR> on insert mode + map_complete = true, -- it will auto insert `(` after select function or method item + } +end + +npairs.setup { + check_ts = true, + ts_config = { + lua = { "string" }, -- it will not add pair on that treesitter node + javascript = { "template_string" }, + java = false, -- don't check treesitter on java + }, +} + +require("nvim-treesitter.configs").setup { autopairs = { enable = true } } + +local ts_conds = require "nvim-autopairs.ts-conds" + +-- press % => %% is only inside comment or string +npairs.add_rules { + Rule("%", "%", "lua"):with_pair(ts_conds.is_ts_node { "string", "comment" }), + Rule("$", "$", "lua"):with_pair(ts_conds.is_not_ts_node { "function" }), +} diff --git a/.config/nvim/lua/cfg/colorizer/init.lua b/.config/nvim/lua/cfg/colorizer/init.lua new file mode 100644 index 0000000..ac5f135 --- /dev/null +++ b/.config/nvim/lua/cfg/colorizer/init.lua @@ -0,0 +1,10 @@ +require("colorizer").setup({ "*" }, { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + RRGGBBAA = true, -- #RRGGBBAA hex codes + rgb_fn = true, -- CSS rgb() and rgba() functions + hsl_fn = true, -- CSS hsl() and hsla() functions + css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn +}) +-- names = true; -- "Name" codes like Blue diff --git a/.config/nvim/lua/cfg/compe/init.lua b/.config/nvim/lua/cfg/compe/init.lua new file mode 100644 index 0000000..5b86f27 --- /dev/null +++ b/.config/nvim/lua/cfg/compe/init.lua @@ -0,0 +1,95 @@ +--if not package.loaded['compe'] then +-- return +-- end + +local M = {} + +vim.g.vsnip_snippet_dir = O.vnsip_dir + +M.config = function() + opt = { + enabled = O.auto_complete, + autocomplete = true, + debug = false, + min_length = 1, + preselect = "enable", + throttle_time = 80, + source_timeout = 200, + incomplete_delay = 400, + max_abbr_width = 100, + max_kind_width = 100, + max_menu_width = 100, + documentation = true, + + source = { + path = { kind = " (Path)" }, + buffer = { kind = " (Buffer)" }, + calc = { kind = " (Calc)" }, + vsnip = { kind = " (Snippet)" }, + nvim_lsp = { kind = " (LSP)" }, + -- nvim_lua = {kind = " "}, + nvim_lua = false, + spell = { kind = " (Spell)" }, + tags = false, + -- vim_dadbod_completion = true, + -- snippets_nvim = {kind = " "}, + -- ultisnips = {kind = " "}, + -- treesitter = {kind = " "}, + emoji = { kind = " ﲃ (Emoji)", filetypes = { "markdown", "text" } }, + -- for emoji press : (idk if that in compe tho) + }, + } + + require("compe").setup(opt) + + local t = function(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) + end + + local check_back_space = function() + local col = vim.fn.col "." - 1 + if col == 0 or vim.fn.getline("."):sub(col, col):match "%s" then + return true + else + return false + end + end + + -- Use (s-)tab to: + --- move to prev/next item in completion menuone + --- jump to prev/next snippet's placeholder + _G.tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "<C-n>" + elseif vim.fn.call("vsnip#available", { 1 }) == 1 then + return t "<Plug>(vsnip-expand-or-jump)" + elseif check_back_space() then + return t "<Tab>" + else + return vim.fn["compe#complete"]() + end + end + + _G.s_tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "<C-p>" + elseif vim.fn.call("vsnip#jumpable", { -1 }) == 1 then + return t "<Plug>(vsnip-jump-prev)" + else + return t "<S-Tab>" + end + end + + vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", { expr = true }) + vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", { expr = true }) + vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true }) + vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true }) + + vim.api.nvim_set_keymap("i", "<C-Space>", "compe#complete()", { noremap = true, silent = true, expr = true }) + -- vim.api.nvim_set_keymap("i", "<CR>", "compe#confirm('<CR>')", { noremap = true, silent = true, expr = true }) + vim.api.nvim_set_keymap("i", "<C-e>", "compe#close('<C-e>')", { noremap = true, silent = true, expr = true }) + vim.api.nvim_set_keymap("i", "<C-f>", "compe#scroll({ 'delta': +4 })", { noremap = true, silent = true, expr = true }) + vim.api.nvim_set_keymap("i", "<C-d>", "compe#scroll({ 'delta': -4 })", { noremap = true, silent = true, expr = true }) +end + +return M diff --git a/.config/nvim/lua/cfg/dashboard/init.lua b/.config/nvim/lua/cfg/dashboard/init.lua new file mode 100644 index 0000000..0d6dcb1 --- /dev/null +++ b/.config/nvim/lua/cfg/dashboard/init.lua @@ -0,0 +1,70 @@ +local M = {} + +M.config = function() + vim.g.dashboard_disable_at_vimenter = 0 + + vim.g.dashboard_custom_header = O.dashboard.custom_header + + vim.g.dashboard_default_executive = "telescope" + + vim.g.dashboard_custom_section = { + a = { + description = { " Find File " }, + command = "Telescope find_files", + }, + b = { + description = { " Recently Used Files" }, + command = "Telescope oldfiles", + }, + c = { + description = { " Load Last Session " }, + command = "SessionLoad", + }, + d = { + description = { " Find Word " }, + command = "Telescope live_grep", + }, + e = { + description = { " Settings " }, + command = ":e " .. CONFIG_PATH .. "/config.lua", + }, + f = { + description = { " Neovim Config Files" }, + command = "Telescope find_files cwd=" .. CONFIG_PATH, + }, + -- e = {description = {' Marks '}, command = 'Telescope marks'} + } + vim.cmd "let g:dashboard_session_directory = $HOME..'/.config/nvim/.sessions'" + vim.cmd "let packages = len(globpath('~/.local/share/nvim/site/pack/packer/start', '*', 0, 1))" + + vim.api.nvim_exec( + [[ + let g:dashboard_custom_footer = ['LuaJIT loaded '..packages..' plugins'] +]], + false + ) + + -- file_browser = {description = {' File Browser'}, command = 'Telescope find_files'}, + + -- vim.g.dashboard_session_directory = CACHE_PATH..'/session' + -- vim.g.dashboard_custom_footer = O.dashboard.footer +end + +require("_utils").define_augroups { + _dashboard = { + -- seems to be nobuflisted that makes my stuff disapear will do more testing + { + "FileType", + "dashboard", + "setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ", + }, + { + "FileType", + "dashboard", + "set showtabline=0 | autocmd BufLeave <buffer> set showtabline=2", + }, + { "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" }, + }, +} + +return M diff --git a/.config/nvim/lua/cfg/galaxyline/init.lua b/.config/nvim/lua/cfg/galaxyline/init.lua new file mode 100644 index 0000000..058846a --- /dev/null +++ b/.config/nvim/lua/cfg/galaxyline/init.lua @@ -0,0 +1,279 @@ +local gl = require('galaxyline') +-- get my theme in galaxyline repo +local colors = { + bg = '#080808', + yellow = '#DCDCAA', + dark_yellow = '#D7BA7D', + cyan = '#4EC9B0', + green = '#608B4E', + light_green = '#B5CEA8', + string_orange = '#CE9178', + orange = '#FF8800', + purple = '#C586C0', + magenta = '#D16D9E', + grey = '#858585', + blue = '#569CD6', + vivid_blue = '#4FC1FF', + light_blue = '#9CDCFE', + red = '#D16969', + error_red = '#F44747', + info_yellow = '#FFCC66' +} + +local condition = require "galaxyline.condition" +local gls = gl.section +gl.short_line_list = { "NvimTree", "vista", "dbui", "packer" } + +table.insert(gls.left, { + ViMode = { + provider = function() + -- auto change color according the vim mode + local mode_color = { + n = colors.blue, + i = colors.green, + v = colors.purple, + [""] = colors.purple, + V = colors.purple, + c = colors.magenta, + no = colors.blue, + s = colors.orange, + S = colors.orange, + [""] = colors.orange, + ic = colors.yellow, + R = colors.red, + Rv = colors.red, + cv = colors.blue, + ce = colors.blue, + r = colors.cyan, + rm = colors.cyan, + ["r?"] = colors.cyan, + ["!"] = colors.blue, + t = colors.blue, + } + vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()]) + return "▊" + end, + highlight = "StatusLineNC", + }, +}) +-- print(vim.fn.getbufvar(0, 'ts')) +vim.fn.getbufvar(0, "ts") + +table.insert(gls.left, { + GitIcon = { + provider = function() + return " " + end, + condition = condition.check_git_workspace, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineGit", + }, +}) + +table.insert(gls.left, { + GitBranch = { + provider = "GitBranch", + condition = condition.check_git_workspace, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, +}) + +table.insert(gls.left, { + DiffAdd = { + provider = "DiffAdd", + condition = condition.hide_in_width, + icon = " ", + highlight = "StatusLineGitAdd", + }, +}) + +table.insert(gls.left, { + DiffModified = { + provider = "DiffModified", + condition = condition.hide_in_width, + icon = " 柳", + highlight = "StatusLineGitChange", + }, +}) + +table.insert(gls.left, { + DiffRemove = { + provider = "DiffRemove", + condition = condition.hide_in_width, + icon = " ", + highlight = "StatusLineGitDelete", + }, +}) + +table.insert(gls.right, { + DiagnosticError = { + provider = "DiagnosticError", + icon = " ", + highlight = "StatusLineLspDiagnosticsError", + }, +}) +table.insert(gls.right, { + DiagnosticWarn = { + provider = "DiagnosticWarn", + icon = " ", + + highlight = "StatusLineLspDiagnosticsWarning", + }, +}) + +table.insert(gls.right, { + DiagnosticInfo = { + provider = "DiagnosticInfo", + icon = " ", + + highlight = "StatusLineLspDiagnosticsInformation", + }, +}) + +table.insert(gls.right, { + DiagnosticHint = { + provider = "DiagnosticHint", + icon = " ", + + highlight = "StatusLineLspDiagnosticsHint", + }, +}) + +table.insert(gls.right, { + TreesitterIcon = { + provider = function() + if next(vim.treesitter.highlighter.active) ~= nil then + return " " + end + return "" + end, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineTreeSitter", + }, +}) + +local get_lsp_client = function(msg) + msg = msg or "No Active LSP Client" + local buf_ft = vim.api.nvim_buf_get_option(0, "filetype") + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return msg + end + local lsps = "" + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= 1 then + -- print(client.name) + if lsps == "" then + -- print("first", lsps) + lsps = client.name + else + lsps = lsps .. ", " .. client.name + -- print("more", lsps) + end + end + end + if lsps == "" then + return msg + else + return lsps + end +end + +table.insert(gls.right, { + ShowLspClient = { + provider = get_lsp_client, + condition = function() + local tbl = { ["dashboard"] = true, [" "] = true } + if tbl[vim.bo.filetype] then + return false + end + return true + end, + icon = " ", + highlight = "StatusLineNC", + }, +}) + +table.insert(gls.right, { + LineInfo = { + provider = "LineColumn", + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, +}) + +table.insert(gls.right, { + PerCent = { + provider = "LinePercent", + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, +}) + +table.insert(gls.right, { + Tabstop = { + provider = function() + return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " " + end, + condition = condition.hide_in_width, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, +}) + +table.insert(gls.right, { + BufferType = { + provider = "FileTypeName", + condition = condition.hide_in_width, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, +}) + +table.insert(gls.right, { + FileEncode = { + provider = "FileEncode", + condition = condition.hide_in_width, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, +}) + +table.insert(gls.right, { + Space = { + provider = function() + return " " + end, + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, +}) + +table.insert(gls.short_line_left, { + BufferType = { + provider = "FileTypeName", + separator = " ", + separator_highlight = "StatusLineSeparator", + highlight = "StatusLineNC", + }, +}) + +table.insert(gls.short_line_left, { + SFileName = { + provider = "SFileName", + condition = condition.buffer_not_empty, + + highlight = "StatusLineNC", + }, +}) diff --git a/.config/nvim/lua/_gitblame/init.lua b/.config/nvim/lua/cfg/gitblame/init.lua index 12645a7..12645a7 100644 --- a/.config/nvim/lua/_gitblame/init.lua +++ b/.config/nvim/lua/cfg/gitblame/init.lua diff --git a/.config/nvim/lua/cfg/gitsigns/init.lua b/.config/nvim/lua/cfg/gitsigns/init.lua new file mode 100644 index 0000000..7f1fbff --- /dev/null +++ b/.config/nvim/lua/cfg/gitsigns/init.lua @@ -0,0 +1,53 @@ +local M = {} + +M.config = function() + require("gitsigns").setup { + signs = { + -- TODO add hl to colorscheme + add = { + hl = "GitSignsAdd", + text = "▎", + numhl = "GitSignsAddNr", + linehl = "GitSignsAddLn", + }, + change = { + hl = "GitSignsChange", + text = "▎", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + delete = { + hl = "GitSignsDelete", + text = "契", + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + topdelete = { + hl = "GitSignsDelete", + text = "契", + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + changedelete = { + hl = "GitSignsChange", + text = "▎", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + }, + numhl = false, + linehl = false, + keymaps = { + -- Default keymap options + noremap = true, + buffer = true, + }, + watch_index = { interval = 1000 }, + sign_priority = 6, + update_debounce = 200, + status_formatter = nil, -- Use default + use_decoration_api = false, + } +end + +return M diff --git a/.config/nvim/lua/_hop/init.lua b/.config/nvim/lua/cfg/hop/init.lua index acd4cd7..acd4cd7 100644 --- a/.config/nvim/lua/_hop/init.lua +++ b/.config/nvim/lua/cfg/hop/init.lua diff --git a/.config/nvim/lua/lsp/emmet-ls.lua b/.config/nvim/lua/cfg/lsp/emmet-ls.lua index 6531ccf..fcb7f62 100644 --- a/.config/nvim/lua/lsp/emmet-ls.lua +++ b/.config/nvim/lua/cfg/lsp/emmet-ls.lua @@ -1,3 +1,7 @@ +-- if not package.loaded['lspconfig'] then +-- return +-- end + local nvim_lsp = require'lspconfig' local configs = require'lspconfig/configs' local capabilities = vim.lsp.protocol.make_client_capabilities() @@ -6,7 +10,7 @@ capabilities.textDocument.completion.completionItem.snippetSupport = true configs.emmet_ls = { default_config = { cmd = {'emmet-ls', '--stdio'}; - filetypes = {'html', 'css'}; + filetypes = {'html', 'css', 'javascript', 'typescript'}; root_dir = function() return vim.loop.cwd() end; diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/cfg/lsp/init.lua index ef2e2f9..547f9e7 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/cfg/lsp/init.lua @@ -20,15 +20,12 @@ vim.cmd("nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>") vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>") vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>") vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>") -vim.cmd("nnoremap <silent> ca :Lspsaga code_action<CR>") -vim.cmd("nnoremap <silent> K :Lspsaga hover_doc<CR>") +vim.cmd("nnoremap <silent> K :lua vim.lsp.buf.hover()<CR>") -- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>') -vim.cmd("nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>") -vim.cmd("nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>") +vim.cmd("nnoremap <silent> <C-p> :lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<CR>") +vim.cmd("nnoremap <silent> <C-n> :lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<CR>") -- scroll down hover doc or scroll in definition preview -vim.cmd("nnoremap <silent> <C-f> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>") -- scroll up hover doc -vim.cmd("nnoremap <silent> <C-b> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>") vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') -- Set Default Prefix. @@ -44,6 +41,18 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( } ) +vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( + vim.lsp.handlers.hover, { + border = O.lsp.popup_border + } +) + +vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( + vim.lsp.handlers.signature_help, { + border = O.lsp.popup_border + } +) + -- symbols for autocomplete vim.lsp.protocol.CompletionItemKind = { " (Text) ", @@ -107,10 +116,57 @@ if O.document_highlight then end function lsp_config.tsserver_on_attach(client, bufnr) - lsp_config.common_on_attach(client, bufnr) + -- lsp_config.common_on_attach(client, bufnr) client.resolved_capabilities.document_formatting = false + + local ts_utils = require("nvim-lsp-ts-utils") + + -- defaults + ts_utils.setup { + debug = false, + disable_commands = false, + enable_import_on_completion = false, + import_all_timeout = 5000, -- ms + + -- eslint + eslint_enable_code_actions = true, + eslint_enable_disable_comments = true, + eslint_bin = O.lang.tsserver.linter, + eslint_config_fallback = nil, + eslint_enable_diagnostics = true, + + -- formatting + enable_formatting = O.lang.tsserver.autoformat, + formatter = O.lang.tsserver.formatter, + formatter_config_fallback = nil, + + -- parentheses completion + complete_parens = false, + signature_help_in_parens = false, + + -- update imports on file move + update_imports_on_move = false, + require_confirmation_on_move = false, + watch_dir = nil, + } + + -- required to fix code action ranges + ts_utils.setup_client(client) + + -- TODO: keymap these? + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize<CR>", {silent = true}) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "qq", ":TSLspFixCurrent<CR>", {silent = true}) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", ":TSLspRenameFile<CR>", {silent = true}) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", ":TSLspImportAll<CR>", {silent = true}) end + +require('cfg.utils').define_augroups({ + _general_lsp = { + {'FileType', 'lspinfo', 'nnoremap <silent> <buffer> q :q<CR>'}, + } +}) + -- Use a loop to conveniently both setup defined servers -- and map buffer local keybindings when the language server attaches -- local servers = {"pyright", "tsserver"} diff --git a/.config/nvim/lua/cfg/lsp/ts-fmt-lint.lua b/.config/nvim/lua/cfg/lsp/ts-fmt-lint.lua new file mode 100644 index 0000000..36d4ca8 --- /dev/null +++ b/.config/nvim/lua/cfg/lsp/ts-fmt-lint.lua @@ -0,0 +1,37 @@ +-- Example configuations here: https://github.com/mattn/efm-langserver +-- You can look for project scope Prettier and Eslint with e.g. vim.fn.glob("node_modules/.bin/prettier") etc. If it is not found revert to global Prettier where needed. +local M = {} + +M.setup = function() + local tsserver_args = {} + + local prettier = { + formatCommand = "prettier --stdin-filepath ${INPUT}", + formatStdin = true + } + + if vim.fn.glob("node_modules/.bin/prettier") ~= "" then + prettier = { + formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}", + formatStdin = true + } + end + + require"lspconfig".efm.setup { + -- init_options = {initializationOptions}, + cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, + init_options = {documentFormatting = true, codeAction = false}, + filetypes = {"html", "css", "yaml", "vue", "javascript", "javascriptreact", "typescript", "typescriptreact"}, + settings = { + rootMarkers = {".git/", "package.json"}, + languages = { + html = {prettier}, + css = {prettier}, + json = {prettier}, + yaml = {prettier} + } + } + } +end + +return M diff --git a/.config/nvim/lua/cfg/lspinstall/init.lua b/.config/nvim/lua/cfg/lspinstall/init.lua new file mode 100644 index 0000000..68fcfa2 --- /dev/null +++ b/.config/nvim/lua/cfg/lspinstall/init.lua @@ -0,0 +1,27 @@ +-- 1. get the config for this server from nvim-lspconfig and adjust the cmd path. +-- relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us! +local config = require("lspconfig").jdtls.document_config +require("lspconfig/configs").jdtls = nil -- important, unset the loaded config again +-- config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server" + +-- 2. extend the config with an install_script and (optionally) uninstall_script +-- require'lspinstall/servers'.jdtls = vim.tbl_extend('error', config, { +-- -- lspinstall will automatically create/delete the install directory for every server +-- install_script = [[ +-- git clone https://github.com/eclipse/eclipse.jdt.ls.git +-- cd eclipse.jdt.ls +-- ./mvnw clean verify +-- ]], +-- uninstall_script = nil -- can be omitted +-- }) + +-- require'lspinstall/servers'.kotlin = vim.tbl_extend('error', config, { +-- install_script = [[ +-- git clone https://github.com/fwcd/kotlin-language-server.git language-server +-- cd language-server +-- ./gradlew :server:installDist +-- ]], +-- uninstall_script = nil -- can be omitted +-- }) + +require("lspinstall").setup() diff --git a/.config/nvim/lua/cfg/nvimtree/init.lua b/.config/nvim/lua/cfg/nvimtree/init.lua new file mode 100644 index 0000000..37a931e --- /dev/null +++ b/.config/nvim/lua/cfg/nvimtree/init.lua @@ -0,0 +1,81 @@ +--if not package.loaded['nvim-tree.view'] then +-- return +--end + +local M = {} + +M.config = function() + local g = vim.g + + vim.o.termguicolors = true + + g.nvim_tree_side = "left" + g.nvim_tree_width = 30 + g.nvim_tree_ignore = { ".git", "node_modules", ".cache" } + g.nvim_tree_auto_open = 1 + g.nvim_tree_auto_close = 0 + g.nvim_tree_quit_on_open = 0 + g.nvim_tree_follow = 1 + g.nvim_tree_indent_markers = 1 + g.nvim_tree_hide_dotfiles = 1 + g.nvim_tree_git_hl = 1 + g.nvim_tree_root_folder_modifier = ":t" + g.nvim_tree_tab_open = 0 + g.nvim_tree_allow_resize = 1 + g.nvim_tree_lsp_diagnostics = 1 + g.nvim_tree_auto_ignore_ft = { "startify", "dashboard" } + + g.nvim_tree_show_icons = { + git = 1, + folders = 1, + files = 1, + folder_arrows = 1, + } + + vim.g.nvim_tree_icons = { + default = "", + symlink = "", + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + deleted = "", + untracked = "U", + ignored = "◌", + }, + folder = { + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + }, + } + local tree_cb = require("nvim-tree.config").nvim_tree_callback + + vim.g.nvim_tree_bindings = { + { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" }, + { key = "h", cb = tree_cb "close_node" }, + { key = "v", cb = tree_cb "vsplit" }, + } +end + +local view = require "nvim-tree.view" + +M.toggle_tree = function() + if view.win_open() then + require("nvim-tree").close() + if package.loaded["bufferline.state"] then + require("bufferline.state").set_offset(0) + end + else + if package.loaded["bufferline.state"] then + -- require'bufferline.state'.set_offset(31, 'File Explorer') + require("bufferline.state").set_offset(31, "") + end + require("nvim-tree").find_file(true) + end +end + +return M diff --git a/.config/nvim/lua/cfg/symbols-outline/init.lua b/.config/nvim/lua/cfg/symbols-outline/init.lua new file mode 100644 index 0000000..f15b5df --- /dev/null +++ b/.config/nvim/lua/cfg/symbols-outline/init.lua @@ -0,0 +1,15 @@ +vim.g.symbols_outline = { + highlight_hovered_item = true, + show_guides = true, + auto_preview = true, + position = "right", + keymaps = { + close = "<Esc>", + goto_location = "<Cr>", + focus_location = "o", + hover_symbol = "<C-space>", + rename_symbol = "r", + code_actions = "a", + }, + lsp_blacklist = {}, +} diff --git a/.config/nvim/lua/cfg/telescope/init.lua b/.config/nvim/lua/cfg/telescope/init.lua new file mode 100644 index 0000000..6bbce29 --- /dev/null +++ b/.config/nvim/lua/cfg/telescope/init.lua @@ -0,0 +1,86 @@ +local actions = require "telescope.actions" +-- if O.plugin.trouble.active then +-- local trouble = require("trouble.providers.telescope") +-- end +-- Global remapping +------------------------------ +-- '--color=never', +require("telescope").setup { + defaults = { + find_command = { + "rg", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + }, + prompt_prefix = " ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "descending", + layout_strategy = "horizontal", + layout_config = { + width = 0.75, + prompt_position = "bottom", + preview_cutoff = 120, + horizontal = { mirror = false }, + vertical = { mirror = false }, + }, + file_sorter = require("telescope.sorters").get_fzy_sorter, + file_ignore_patterns = {}, + generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + shorten_path = true, + winblend = 0, + border = {}, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + color_devicons = true, + use_less = true, + set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, + 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, + + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, + mappings = { + i = { + ["<C-c>"] = actions.close, + ["<C-j>"] = actions.move_selection_next, + ["<C-k>"] = actions.move_selection_previous, + -- ["<c-t>"] = trouble.open_with_trouble, + ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist, + -- To disable a keymap, put [map] = false + -- So, to not map "<C-n>", just put + -- ["<c-x>"] = false, + -- ["<esc>"] = actions.close, + + -- Otherwise, just set the mapping to the function that you want it to be. + -- ["<C-i>"] = actions.select_horizontal, + + -- Add up multiple actions + ["<CR>"] = actions.select_default + actions.center, + + -- You can perform as many actions in a row as you like + -- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action, + }, + n = { + ["<C-j>"] = actions.move_selection_next, + ["<C-k>"] = actions.move_selection_previous, + -- ["<c-t>"] = trouble.open_with_trouble, + ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist, + -- ["<C-i>"] = my_cool_custom_action, + }, + }, + }, + extensions = { + fzy_native = { + override_generic_sorter = false, + override_file_sorter = true, + }, + }, +} + +-- require'telescope'.load_extension('project') diff --git a/.config/nvim/lua/cfg/themes/spacegray.lua b/.config/nvim/lua/cfg/themes/spacegray.lua new file mode 100644 index 0000000..0bb695c --- /dev/null +++ b/.config/nvim/lua/cfg/themes/spacegray.lua @@ -0,0 +1,373 @@ +local lush = require "lush" +local hsl = lush.hsl + +local theme = lush(function() + local c = { + bg = hsl "#212121", + bg1 = hsl "#2a2a2a", + -- bg2 = hsl("#3a3a3a"), + bg2 = hsl "#383d45", + + white = hsl "#c8c9d1", + + gray = hsl "#858585", + light_gray = hsl "#c8c9c1", + + error_red = hsl "#F44747", + warning_orange = hsl "#ff8800", + info_yellow = hsl "#ffcc66", + hint_blue = hsl "#4fc1ff", + + red = hsl "#b04b57", + + blue = hsl "#5486c0", + gray_blue = hsl "#66899d", + + -- yellow = hsl("#ffcb6b"), + yellow = hsl "#eeba5a", + + -- orange = hsl("#c98a75"), + orange = hsl "#c6735a", + + green = hsl "#87b379", + light_green = hsl "#b2d77c", + + -- aqua = hsl("#46b1d0"), + aqua = hsl "#65a7c5", + + purple = hsl "#bf83c1", + pale_purple = hsl "#7199ee", + + sign_add = hsl "#587C0C", + sign_change = hsl "#0C7D9D", + sign_delete = hsl "#94151B", + + test = hsl "#ff00ff", + } + return { + Normal { bg = c.bg, fg = c.white, gui = "NONE" }, -- used for the columns set with 'colorcolumn' + SignColumn { Normal }, + ModeMsg { Normal }, + MsgArea { Normal }, + MsgSeparator { Normal }, + SpellBad { bg = "NONE", fg = c.white, gui = "underline", sp = c.red }, + SpellCap { bg = "NONE", fg = c.white, gui = "underline", sp = c.yellow }, + SpellLocal { bg = "NONE", fg = c.white, gui = "underline", sp = c.green }, + SpellRare { bg = "NONE", fg = c.white, gui = "underline", sp = c.blue }, + NormalNC { Normal }, + Pmenu { bg = c.bg2, fg = c.white, gui = "NONE" }, + PmenuSel { bg = c.gray_blue, fg = c.bg1.da(5), gui = "NONE" }, + WildMenu { PmenuSel }, -- Non Defaults + CursorLineNr { bg = "NONE", fg = c.light_gray, gui = "bold" }, + Comment { bg = "NONE", fg = c.gray, gui = "italic" }, -- any comment + Folded { bg = c.bg1, fg = c.gray, gui = "NONE" }, + FoldColumn { Normal, fg = c.gray, gui = "NONE" }, + LineNr { bg = "NONE", fg = c.gray, gui = "NONE" }, + FloatBorder { bg = c.bg1, fg = c.gray, gui = "NONE" }, + Whitespace { bg = "NONE", fg = c.gray.da(35), gui = "NONE" }, + VertSplit { bg = "NONE", fg = c.bg2, gui = "NONE" }, + CursorLine { bg = c.bg1, fg = "NONE", gui = "NONE" }, + CursorColumn { CursorLine }, + ColorColumn { CursorLine }, + NormalFloat { bg = c.bg2.da(30), fg = "NONE", gui = "NONE" }, + Visual { bg = c.bg2.da(25), fg = "NONE", gui = "NONE" }, + VisualNOS { Visual }, + WarningMsg { bg = "NONE", fg = c.red, gui = "NONE" }, + DiffText { bg = "NONE", fg = "NONE", gui = "NONE" }, + DiffAdd { bg = c.sign_add, fg = "NONE", gui = "NONE" }, + DiffChange { bg = c.sign_change, fg = "NONE", gui = "NONE" }, + DiffDelete { bg = c.sign_delete, fg = "NONE", gui = "NONE" }, + QuickFixLine { CursorLine }, + PmenuSbar { bg = c.bg2.li(15), fg = "NONE", gui = "NONE" }, + PmenuThumb { bg = c.white, fg = "NONE", gui = "NONE" }, + MatchParen { CursorLine, fg = "NONE", gui = "NONE" }, + Cursor { fg = "NONE", bg = "NONE", gui = "reverse" }, + lCursor { Cursor }, + CursorIM { Cursor }, + TermCursor { Cursor }, + TermCursorNC { Cursor }, + Conceal { bg = "NONE", fg = c.blue, gui = "NONE" }, + Directory { bg = "NONE", fg = c.blue, gui = "NONE" }, + SpecialKey { bg = "NONE", fg = c.blue, gui = "bold" }, + Title { bg = "NONE", fg = c.blue, gui = "bold" }, + ErrorMsg { bg = "NONE", fg = c.error_red, gui = "NONE" }, + Search { bg = c.gray_blue, fg = c.white }, + IncSearch { Search }, + Substitute { Search }, + MoreMsg { bg = "NONE", fg = c.aqua, gui = "NONE" }, + Question { MoreMsg }, + EndOfBuffer { bg = "NONE", fg = c.bg, gui = "NONE" }, + NonText { EndOfBuffer }, + + String { fg = c.green }, + Character { fg = c.light_green }, + Constant { fg = c.orange }, + Number { fg = c.red }, + Boolean { fg = c.red }, + Float { fg = c.red }, + + Identifier { fg = c.white }, + Function { fg = c.yellow }, + Operator { fg = c.gray_blue }, + + Type { fg = c.purple }, + StorageClass { Type }, + Structure { Type }, + Typedef { Type }, + + Keyword { fg = c.blue }, + Statement { Keyword }, + Conditional { Keyword }, + Repeat { Keyword }, + Label { Keyword }, + Exception { Keyword }, + + Include { Keyword }, + PreProc { fg = c.aqua }, + Define { PreProc }, + Macro { PreProc }, + PreCondit { PreProc }, + + Special { fg = c.orange }, + SpecialChar { Character }, + Tag { fg = c.pale_purple }, + Debug { fg = c.red }, + Delimiter { fg = c.white.da(25) }, + SpecialComment { fg = c.gray }, + Underlined { fg = "NONE", gui = "underline" }, + Bold { fg = "NONE", gui = "bold" }, + Italic { fg = "NONE", gui = "italic" }, + + -- Todo + -- ("Ignore", below, may be invisible...) + Ignore { fg = c.white }, + Todo { bg = "NONE", fg = c.red, gui = "bold" }, + Error { fg = c.error_red }, + + -- Treesitter + TSComment { Comment }, -- comment blocks. + luaTSConstructor { bg = "NONE", fg = c.white.da(25) }, -- override Lua curly braces + TSAnnotation { bg = "NONE", fg = c.aqua }, -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. + TSAttribute { bg = "NONE", fg = c.aqua }, -- (unstable) TODO: docs + TSConstructor { Type }, -- For constructor calls and definitions: `{ }` in Lua, and Java constructors. + TSType { Type }, -- types. + TSTypeBuiltin { Type }, -- builtin types. + TSConditional { Conditional }, -- keywords related to conditionnals. + TSException { Exception }, -- exception related keywords. + TSInclude { Include }, -- includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua. + TSKeyword { Keyword }, -- keywords that don't fall in previous categories. + TSKeywordFunction { Keyword }, -- keywords used to define a fuction. + TSLabel { Label }, -- labels: `label:` in C and `:label:` in Lua. + TSNamespace { bg = "NONE", fg = c.blue }, -- For identifiers referring to modules and namespaces. + TSRepeat { Repeat }, -- keywords related to loops. + TSConstant { Constant }, -- constants + TSConstBuiltin { Constant }, -- constant that are built in the language: `nil` in Lua. + TSFloat { Float }, -- floats. + TSNumber { Number }, -- all numbers + TSBoolean { Boolean }, -- booleans. + TSCharacter { Character }, -- characters. + TSError { bg = "NONE", fg = "NONE" }, -- For syntax/parser errors. + TSFunction { Function }, -- function (calls and definitions). + TSFuncBuiltin { Function }, -- builtin functions: `table.insert` in Lua. + TSMethod { Function }, -- method calls and definitions. + TSConstMacro { Macro }, -- constants that are defined by macros: `NULL` in C. + TSFuncMacro { Macro }, -- macro defined fuctions (calls and definitions): each `macro_rules` in Rust. + TSVariableBuiltin { bg = "NONE", fg = c.aqua }, -- Variable names that are defined by the languages, like `this` or `self`. + TSProperty { fg = c.aqua }, + TSOperator { Operator }, -- any operator: `+`, but also `->` and `*` in C. + TSVariable { bg = "NONE", fg = c.white }, -- Any variable name that does not have another highlight. + TSField { bg = "NONE", fg = c.white }, -- For fields. + TSParameter { TSField }, -- parameters of a function. + TSParameterReference { TSParameter }, -- references to parameters of a function. + TSSymbol { Identifier }, -- identifiers referring to symbols or atoms. + TSText { fg = c.white }, -- strings considered text in a markup language. + TSPunctDelimiter { Delimiter }, -- delimiters ie: `.` + TSTagDelimiter { Delimiter }, -- Tag delimiter like `<` `>` `/` + TSPunctBracket { Delimiter }, -- brackets and parens. + TSPunctSpecial { Delimiter }, -- special punctutation that does not fall in the catagories before. + TSString { String }, -- strings. + TSStringRegex { TSString }, -- regexes. + TSStringEscape { Character }, -- escape characters within a string. + TSWarning { Todo }, -- Variable names that are defined by the languages, like `this` or `self`. + TSTag { Tag }, -- Tags like html tag names. + TSEmphasis { gui = "italic" }, -- text to be represented with emphasis. + TSUnderline { gui = "underline" }, -- text to be represented with an underline. + TSStrike { gui = "strikethrough" }, -- strikethrough text. + TSTitle { Title }, -- Text that is part of a title. + TSLiteral { String }, -- Literal text. + TSURI { fg = c.aqua }, -- Any URI like a link or email. + -- TSNone { }, -- TODO: docs + + -- These groups are for the native LSP client. Some other LSP clients may + -- use these groups, or use their own. Consult your LSP client's + -- documentation. + + LspDiagnosticsDefaultError { bg = "NONE", fg = c.error_red, gui = "NONE" }, + LspDiagnosticsDefaultWarning { bg = "NONE", fg = c.warning_orange, gui = "NONE" }, + LspDiagnosticsDefaultInformation { bg = "NONE", fg = c.info_yellow, gui = "NONE" }, + LspDiagnosticsDefaultHint { bg = "NONE", fg = c.hint_blue, gui = "NONE" }, + + LspDiagnosticsVirtualTextError { LspDiagnosticsDefaultError }, + LspDiagnosticsVirtualTextWarning { LspDiagnosticsDefaultWarning }, + LspDiagnosticsVirtualTextInformation { LspDiagnosticsDefaultInformation }, + LspDiagnosticsVirtualTextHint { LspDiagnosticsDefaultHint }, + + LspDiagnosticsFloatingError { fg = c.error_red, gui = "NONE" }, + LspDiagnosticsFloatingWarning { fg = c.warning_orange, gui = "NONE" }, + LspDiagnosticsFloatingInformation { fg = c.info_yellow, gui = "NONE" }, + LspDiagnosticsFloatingHint { fg = c.hint_blue, gui = "NONE" }, + + LspDiagnosticsSignError { fg = c.error_red, gui = "NONE" }, + LspDiagnosticsSignWarning { fg = c.warning_orange, gui = "NONE" }, + LspDiagnosticsSignInformation { fg = c.info_yellow, gui = "NONE" }, + LspDiagnosticsSignHint { fg = c.hint_blue, gui = "NONE" }, -- Tree-Sitter + + LspDiagnosticsError { LspDiagnosticsSignError }, + LspDiagnosticsWarning { LspDiagnosticsSignWarning }, + LspDiagnosticsInformation { LspDiagnosticsSignInformation }, + LspDiagnosticsHint { LspDiagnosticsSignHint }, + + -- LspReferenceText {bg = c.bg1, fg = "NONE", gui = "underline"}, + -- LspReferenceRead {bg = c.bg1, fg = "NONE", gui = "underline"}, + -- LspReferenceWrite {bg = c.bg1, fg = "NONE", gui = "underline"}, + + LspDiagnosticsUnderlineError { fg = "NONE", gui = "underline", sp = c.red }, + LspDiagnosticsUnderlineWarning { fg = "NONE", gui = "underline", sp = c.yellow }, + LspDiagnosticsUnderlineInformation { fg = "NONE", gui = "underline", sp = c.blue }, + LspDiagnosticsUnderlineHint { fg = "NONE", gui = "underline", sp = c.green }, + + -- gitsigns.nvim + SignAdd { fg = c.sign_add }, + SignChange { fg = c.sign_change }, + SignDelete { fg = c.sign_delete }, -- Any URI like a link or email. + GitSignsAdd { fg = c.sign_add }, + GitSignsChange { fg = c.sign_change }, + GitSignsDelete { fg = c.sign_delete }, + + -- telescope.nvim + TelescopeSelection { bg = "NONE", fg = c.aqua }, + TelescopeMatching { bg = "NONE", fg = c.red, gui = "bold" }, + TelescopeBorder { bg = c.bg1, fg = c.gray }, -- nvim-tree.lua + + -- Nvimtree + NvimTreeFolderIcon { fg = c.blue }, + NvimTreeIndentMarker { fg = c.gray }, + NvimTreeNormal { fg = c.white.da(10), bg = c.bg1 }, + NvimTreeFolderName { fg = c.blue }, + NvimTreeOpenedFolderName { fg = c.aqua.da(10), gui = "italic" }, + NvimTreeOpenedFile { NvimTreeOpenedFolderName }, + NvimTreeRootFolder { fg = c.blue.da(20) }, + NvimTreeExecFile { fg = c.green }, + NvimTreeImageFile { fg = c.purple }, + NvimTreeSpecialFile { fg = c.aqua }, + + NvimTreeGitStaged { fg = c.sign_add }, + NvimTreeGitNew { fg = c.sign_add }, + NvimTreeGitDirty { fg = c.sign_add }, + NvimTreeGitRenamed { fg = c.sign_change }, + NvimTreeGitMerge { fg = c.sign_change }, + NvimTreeGitDelete { fg = c.sign_delete }, + NvimTreeVertSplit { fg = c.bg1, bg = c.bg1 }, + + -- BarBar + TabLine { bg = c.bg1, fg = c.white, gui = "NONE" }, + TabLineFill { bg = c.bg1, fg = c.white, gui = "NONE" }, + TabLineSel { bg = c.blue, fg = c.bg1, gui = "NONE" }, + + BufferCurrent { fg = c.fg, bg = c.bg }, + BufferCurrentIndex { fg = c.aqua, bg = c.bg }, + BufferCurrentMod { fg = c.info_yellow, bg = c.bg }, + BufferCurrentSign { fg = c.aqua, bg = c.bg }, + BufferCurrentTarget { fg = c.red, bg = c.bg, gui = "bold" }, + + BufferVisible { fg = c.fg, bg = c.bg }, + BufferVisibleIndex { fg = c.fg, bg = c.bg }, + BufferVisibleMod { fg = c.info_yellow, bg = c.bg }, + BufferVisibleSign { fg = c.info_yellow, bg = c.bg }, + BufferVisibleTarget { fg = c.red, bg = c.bg, gui = "bold" }, + + BufferInactive { fg = c.gray, bg = c.bg1 }, + BufferInactiveIndex { fg = c.gray, bg = c.bg1 }, + BufferInactiveMod { fg = c.info_yellow, bg = c.bg1 }, + BufferInactiveSign { fg = c.gray, bg = c.bg1 }, + BufferInactiveTarget { fg = c.red, bg = c.bg1 }, + + -- some fix for html related stuff + htmlH1 { Title }, -- markdown stuff + mkdLink { fg = c.aqua, gui = "underline" }, + mkdLineBreak { bg = "NONE", fg = "NONE", gui = "NONE" }, + mkdHeading { fg = c.white }, + mkdInlineURL { mkdLink }, + mkdUnderline { fg = c.gray }, + markdownUrl { mkdLink }, + markdownCode { fg = c.orange, bg = "NONE" }, + markdownLinkTextDelimiter { Delimiter }, + markdownLinkDelimiter { Delimiter }, + markdownIdDelimiter { Delimiter }, + markdownLinkText { fg = c.aqua }, + markdownItalic { fg = "NONE", gui = "italic" }, -- flutter-tools.nvim + FlutterWidgetGuides { fg = c.gray.li(10) }, -- statusline + + StatusLine { bg = c.bg1, fg = c.white }, -- status line of current window + StatusLineNC { bg = c.bg1, fg = c.light_gray }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + StatusLineSeparator { bg = c.bg1, fg = "NONE" }, + StatusLineGit { bg = c.bg1, fg = c.orange }, + StatusLineGitAdd { bg = c.bg1, fg = c.green }, + StatusLineGitChange { bg = c.bg1, fg = c.blue }, + StatusLineGitDelete { bg = c.bg1, fg = c.red }, + StatusLineLspDiagnosticsError { bg = c.bg1, fg = c.error_red, gui = "NONE" }, + StatusLineLspDiagnosticsWarning { bg = c.bg1, fg = c.warning_orange, gui = "NONE" }, + StatusLineLspDiagnosticsInformation { bg = c.bg1, fg = c.info_yellow, gui = "NONE" }, + StatusLineLspDiagnosticsHint { bg = c.bg1, fg = c.hint_blue, gui = "NONE" }, + StatusLineTreeSitter { bg = c.bg1, fg = c.green }, + + -- StatusLineMode {bg = c.gray, fg = c.bg, gui = "bold"}, + -- StatusLineDeco {bg = c.bg2, fg = c.yellow}, + -- StatusLineLCol {bg = c.bg2, fg = c.white}, + -- StatusLineLColAlt {bg = c.bg1, fg = c.white}, + -- StatusLineFT {bg = c.bg2, fg = c.white}, + -- StatusLineFTAlt {bg = c.bg2, fg = c.white}, + -- StatusLineGitAlt {bg = c.gray, fg = c.bg}, + -- StatusLineLSP {bg = c.bg1, fg = c.gray.li(25)}, + -- StatusLineFileName {bg = c.bg1, fg = c.white, gui = "bold"}, + + -- lsp-trouble.nvim + LspTroubleIndent { fg = c.gray.li(10) }, -- tabline stuff + + -- tabline diagnostic + TabLineError { LspDiagnosticsSignError }, + TabLineWarning { LspDiagnosticsSignWarning }, + TabLineHint { LspDiagnosticsSignHint }, + TabLineInformation { LspDiagnosticsSignInformation }, -- which-key.nvim + + WhichKey { fg = c.purple }, -- nvim-compe + WhichKeySeperator { fg = c.green }, -- nvim-compe + WhichKeyGroup { fg = c.blue }, -- nvim-compe + WhichKeyDesc { fg = c.aqua }, -- nvim-compe + WhichKeyFloat { bg = c.bg1 }, -- nvim-compe + + CompeDocumentation { Pmenu, fg = "NONE" }, -- diffview + + DiffviewNormal { NvimTreeNormal }, + DiffviewStatusAdded { SignAdd }, + DiffviewStatusModified { SignChange }, + DiffviewStatusRenamed { SignChange }, + DiffviewStatusDeleted { SignDelete }, + DiffviewFilePanelInsertion { SignAdd }, + DiffviewFilePanelDeletion { SignDelete }, + DiffviewVertSplit { fg = c.gray, bg = c.bg }, + + DashboardHeader { fg = c.blue }, + DashboardCenter { fg = c.purple }, + DashboardFooter { fg = c.aqua }, + + IndentBlanklineContextChar { fg = c.gray.da(20) }, + + CodiVirtualText { fg = c.hint_blue }, + } +end) + +-- return our parsed theme for extension or use else where. +return theme + +-- vi:nowrap diff --git a/.config/nvim/lua/cfg/treesitter/init.lua b/.config/nvim/lua/cfg/treesitter/init.lua new file mode 100644 index 0000000..27877f0 --- /dev/null +++ b/.config/nvim/lua/cfg/treesitter/init.lua @@ -0,0 +1,142 @@ +-- TODO refacor this whole file and treesitter in general +-- if not package.loaded['nvim-treesitter'] then return end +-- +-- Custom parsers +-- local parser_config = require("nvim-treesitter.parsers").get_parser_configs() +-- parser_config.make = { +-- install_info = { +-- url = "https://github.com/alemuller/tree-sitter-make", -- local path or git repo +-- files = {"src/parser.c"}, +-- requires_generate_from_grammar = true +-- } +-- } +-- parser_config.just = { +-- install_info = { +-- url = "~/dev/tree-sitter-just", -- local path or git repo +-- files = {"src/parser.c"} +-- } +-- -- filetype = "just", -- if filetype does not agrees with parser name +-- -- used_by = {"bar", "baz"} -- additional filetypes that use this parser +-- } +-- Custom text objects +local textobj_prefixes = O.treesitter.textobj_prefixes +local textobj_suffixes = O.treesitter.textobj_suffixes +local textobj_sel_keymaps = {} +local textobj_swap_keymaps = {} +local textobj_move_keymaps = { + enable = O.plugin.ts_textobjects, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = {}, + goto_next_end = {}, + goto_previous_start = {}, + goto_previous_end = {}, +} +for obj, suffix in pairs(textobj_suffixes) do + if textobj_prefixes["goto_next"] ~= nil then + textobj_move_keymaps["goto_next_start"][textobj_prefixes["goto_next"] .. suffix[1]] = "@" .. obj .. ".outer" + textobj_move_keymaps["goto_next_end"][textobj_prefixes["goto_next"] .. suffix[2]] = "@" .. obj .. ".outer" + end + if textobj_prefixes["goto_prev"] ~= nil then + textobj_move_keymaps["goto_previous_start"][textobj_prefixes["goto_previous"] .. suffix[2]] = "@" .. obj .. ".outer" + textobj_move_keymaps["goto_previous_end"][textobj_prefixes["goto_previous"] .. suffix[1]] = "@" .. obj .. ".outer" + end + + if textobj_prefixes["inner"] ~= nil then + textobj_sel_keymaps[textobj_prefixes["inner"] .. suffix[1]] = "@" .. obj .. ".inner" + end + if textobj_prefixes["outer"] ~= nil then + textobj_sel_keymaps[textobj_prefixes["outer"] .. suffix[1]] = "@" .. obj .. ".outer" + end + + if textobj_prefixes["swap"] ~= nil then + textobj_swap_keymaps[textobj_prefixes["swap"] .. suffix[1]] = "@" .. obj .. ".outer" + end +end +vim.g.ts_hint_textobject_keys = O.treesitter.hint_labels -- Requires https://github.com/mfussenegger/nvim-ts-hint-textobject/pull/2 + +-- Add which key menu entries +local status, wk = pcall(require, "which-key") +if status then + local normal = { + mode = "n", -- Normal mode + } + local operators = { + mode = "o", -- Operator mode + } + wk.register(textobj_sel_keymaps, operators) + wk.register({ + ["m"] = "Hint Objects", + ["."] = "Textsubject", + [";"] = "Textsubject-big", + }, operators) + wk.register(textobj_swap_keymaps, normal) + wk.register({ + [textobj_prefixes["swap"]] = "Swap", + -- [textobj_prefixes["goto_next"]] = "Jump [", + -- [textobj_prefixes["goto_previous"]] = "Jump ]" + }, normal) + wk.register(textobj_move_keymaps["goto_next_start"], normal) + wk.register(textobj_move_keymaps["goto_next_end"], normal) + wk.register(textobj_move_keymaps["goto_previous_start"], normal) + wk.register(textobj_move_keymaps["goto_previous_end"], normal) +end + +require("nvim-treesitter.configs").setup { + ensure_installed = O.treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages + ignore_install = O.treesitter.ignore_install, + matchup = { + enable = true, -- mandatory, false will disable the whole extension + -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled + }, + highlight = { + enable = O.treesitter.highlight.enabled, -- false will disable the whole extension + additional_vim_regex_highlighting = true, + disable = { "latex" }, + }, + context_commentstring = { + enable = O.plugin.ts_context_commentstring.active, + config = { css = "// %s" }, + }, + -- indent = {enable = true, disable = {"python", "html", "javascript"}}, + -- TODO seems to be broken + indent = { enable = { "javascriptreact" } }, + autotag = { enable = O.plugin.ts_autotag.active }, + textobjects = { + swap = { + enable = O.plugin.ts_textobjects, + swap_next = textobj_swap_keymaps, + }, + move = textobj_move_keymaps, + select = { + enable = O.plugin.ts_textobjects, + keymaps = textobj_sel_keymaps, + }, + }, + textsubjects = { + enable = O.plugin.ts_textsubjects, + keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" }, + }, + playground = { + enable = O.plugin.ts_playground.active, + disable = {}, + updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code + persist_queries = false, -- Whether the query persists across vim sessions + keybindings = { + toggle_query_editor = "o", + toggle_hl_groups = "i", + toggle_injected_languages = "t", + toggle_anonymous_nodes = "a", + toggle_language_display = "I", + focus_language = "f", + unfocus_language = "F", + update = "R", + goto_node = "<cr>", + show_help = "?", + }, + }, + rainbow = { + enable = O.plugin.ts_rainbow.active, + extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean + max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int + }, +} diff --git a/.config/nvim/lua/cfg/utils/init.lua b/.config/nvim/lua/cfg/utils/init.lua new file mode 100644 index 0000000..e879831 --- /dev/null +++ b/.config/nvim/lua/cfg/utils/init.lua @@ -0,0 +1,81 @@ +local utils = {} + +function utils.define_augroups(definitions) -- {{{1 + -- Create autocommand groups based on the passed definitions + -- + -- The key will be the name of the group, and each definition + -- within the group should have: + -- 1. Trigger + -- 2. Pattern + -- 3. Text + -- just like how they would normally be defined from Vim itself + for group_name, definition in pairs(definitions) do + vim.cmd("augroup " .. group_name) + vim.cmd "autocmd!" + + for _, def in pairs(definition) do + local command = table.concat(vim.tbl_flatten { "autocmd", def }, " ") + vim.cmd(command) + end + + vim.cmd "augroup END" + end +end + +utils.define_augroups { + + _user_autocommands = O.user_autocommands, + _general_settings = { + { + "TextYankPost", + "*", + "lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})", + }, + { + "BufWinEnter", + "*", + "setlocal formatoptions-=c formatoptions-=r formatoptions-=o", + }, + { + "BufRead", + "*", + "setlocal formatoptions-=c formatoptions-=r formatoptions-=o", + }, + { + "BufNewFile", + "*", + "setlocal formatoptions-=c formatoptions-=r formatoptions-=o", + }, + { "VimLeavePre", "*", "set title set titleold=" }, + }, + -- _solidity = { + -- {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'}, + -- {'BufNewFile', '*.sol', 'setlocal filetype=solidity'} + -- }, + -- _gemini = { + -- {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'}, + -- {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'} + -- }, + _markdown = { + { "FileType", "markdown", "setlocal wrap" }, + { "FileType", "markdown", "setlocal spell" }, + }, + _buffer_bindings = { + { "FileType", "floaterm", "nnoremap <silent> <buffer> q :q<CR>" }, + }, + _auto_resize = { + -- will cause split windows to be resized evenly if main window is resized + {'VimResized ', '*', 'wincmd ='}, + }, + -- _mode_switching = { + -- -- will switch between absolute and relative line numbers depending on mode + -- {'InsertEnter', '*', 'if &relativenumber | let g:ms_relativenumberoff = 1 | setlocal number norelativenumber | endif'}, + -- {'InsertLeave', '*', 'if exists("g:ms_relativenumberoff") | setlocal relativenumber | endif'}, + -- {'InsertEnter', '*', 'if &cursorline | let g:ms_cursorlineoff = 1 | setlocal nocursorline | endif'}, + -- {'InsertLeave', '*', 'if exists("g:ms_cursorlineoff") | setlocal cursorline | endif'}, + -- }, +} + +return utils + +-- TODO find a new home for these autocommands diff --git a/.config/nvim/lua/_vim-rooter/init.lua b/.config/nvim/lua/cfg/vim-rooter/init.lua index a873194..a873194 100644 --- a/.config/nvim/lua/_vim-rooter/init.lua +++ b/.config/nvim/lua/cfg/vim-rooter/init.lua diff --git a/.config/nvim/lua/cfg/vimtex/init.lua b/.config/nvim/lua/cfg/vimtex/init.lua new file mode 100644 index 0000000..11ed68b --- /dev/null +++ b/.config/nvim/lua/cfg/vimtex/init.lua @@ -0,0 +1,15 @@ +vim.g.vimtex_compiler_method = "latexmk" +vim.g.vimtex_view_method = "zathura" +vim.g.vimtex_fold_enabled = 0 + +-- Compile on initialization, cleanup on quit +vim.api.nvim_exec( + [[ + augroup vimtex_event_1 + au! + au User VimtexEventQuit call vimtex#compiler#clean(0) + au User VimtexEventInitPost call vimtex#compiler#compile() + augroup END + ]], + false +) diff --git a/.config/nvim/lua/cfg/which-key/init.lua b/.config/nvim/lua/cfg/which-key/init.lua new file mode 100644 index 0000000..1558a50 --- /dev/null +++ b/.config/nvim/lua/cfg/which-key/init.lua @@ -0,0 +1,313 @@ +-- if not package.loaded['which-key'] then +-- return +-- end + +require("which-key").setup { + plugins = { + marks = true, -- shows a list of your marks on ' and ` + registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode + -- the presets plugin, adds help for a bunch of default keybindings in Neovim + -- No actual key bindings are created + presets = { + operators = false, -- adds help for operators like d, y, ... + motions = false, -- adds help for motions + text_objects = false, -- help for text objects triggered after entering an operator + windows = true, -- default bindings on <c-w> + nav = true, -- misc bindings to work with windows + z = true, -- bindings for folds, spelling and others prefixed with z + g = true, -- bindings for prefixed with g + }, + }, + icons = { + breadcrumb = "»", -- symbol used in the command line area that shows your active key combo + separator = "➜", -- symbol used between a key and it's label + group = "+", -- symbol prepended to a group + }, + window = { + border = "single", -- none, single, double, shadow + position = "bottom", -- bottom, top + margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] + padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] + }, + layout = { + height = { min = 4, max = 25 }, -- min and max height of the columns + width = { min = 20, max = 50 }, -- min and max width of the columns + spacing = 3, -- spacing between columns + }, + hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate + show_help = true, -- show help message on the command line when the popup is visible +} + +-- Set leader +if O.leader_key == " " or O.leader_key == "space" then + vim.api.nvim_set_keymap("n", "<Space>", "<NOP>", { noremap = true, silent = true }) + vim.g.mapleader = " " +else + vim.api.nvim_set_keymap("n", O.leader_key, "<NOP>", { noremap = true, silent = true }) + vim.g.mapleader = O.leader_key +end + +local opts = { + mode = "n", -- NORMAL mode + prefix = "<leader>", + buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings + silent = true, -- use `silent` when creating keymaps + noremap = true, -- use `noremap` when creating keymaps + nowait = false, -- use `nowait` when creating keymaps +} + +-- no hl +vim.api.nvim_set_keymap("n", "<Leader>n", ':let @/=""<CR>', { noremap = true, silent = true }) + +-- explorer + +-- TODO this introduces some bugs unfortunately +vim.api.nvim_set_keymap( + "n", + "<Leader>e", + ":lua require'cfg.nvimtree'.toggle_tree()<CR>", + { noremap = true, silent = true } +) +-- vim.api.nvim_set_keymap('n', '<Leader>e', +-- ":NvimTreeToggle<CR>", +-- {noremap = true, silent = true}) + +vim.api.nvim_set_keymap("n", "<Leader>f", ":Telescope find_files<CR>", { noremap = true, silent = true }) + +-- dashboard +vim.api.nvim_set_keymap("n", "<Leader>;", ":Dashboard<CR>", { noremap = true, silent = true }) + +-- Comments +vim.api.nvim_set_keymap("n", "<leader>k", ":CommentToggle<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("v", "<leader>k", ":CommentToggle<CR>", { noremap = true, silent = true }) + + +-- split window +vim.api.nvim_set_keymap("n", "<leader>v", ":vsplit<CR>", {noremap = true, silent = true}) +vim.api.nvim_set_keymap("n", "<leader>h", ":split<CR>", {noremap = true, silent = true}) + +-- close buffer +vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", { noremap = true, silent = true }) + +-- TODO create entire treesitter section + +local mappings = { + + ["k"] = "Comment", + ["c"] = "Close Buffer", + ["e"] = "Explorer", + ["f"] = "Find File", + ["n"] = "No Highlight", + ["v"] = "Vertical Split", + ["h"] = "Horizontal Split", + b = { + name = "Buffers", + j = { "<cmd>BufferPick<cr>", "jump to buffer" }, + f = { "<cmd>Telescope buffers<cr>", "Find buffer" }, + w = { "<cmd>BufferWipeout<cr>", "wipeout buffer" }, + e = { + "<cmd>BufferCloseAllButCurrent<cr>", + "close all but current buffer", + }, + h = { "<cmd>BufferCloseBuffersLeft<cr>", "close all buffers to the left" }, + l = { + "<cmd>BufferCloseBuffersRight<cr>", + "close all BufferLines to the right", + }, + D = { + "<cmd>BufferOrderByDirectory<cr>", + "sort BufferLines automatically by directory", + }, + L = { + "<cmd>BufferOrderByLanguage<cr>", + "sort BufferLines automatically by language", + }, + }, + p = { + name = "Packer", + c = { "<cmd>PackerCompile<cr>", "Compile" }, + i = { "<cmd>PackerInstall<cr>", "Install" }, + r = { ":luafile %<cr>", "Reload" }, + s = { "<cmd>PackerSync<cr>", "Sync" }, + u = { "<cmd>PackerUpdate<cr>", "Update" }, + }, + -- diagnostics vanilla nvim + -- -- diagnostic + -- function lv_utils.get_all() + -- vim.lsp.diagnostic.get_all() + -- end + -- function lv_utils.get_next() + -- vim.lsp.diagnostic.get_next() + -- end + -- function lv_utils.get_prev() + -- vim.lsp.diagnostic.get_prev() + -- end + -- function lv_utils.goto_next() + -- vim.lsp.diagnostic.goto_next() + -- end + -- function lv_utils.goto_prev() + -- vim.lsp.diagnostic.goto_prev() + -- end + -- function lv_utils.show_line_diagnostics() + -- vim.lsp.diagnostic.show_line_diagnostics() + -- end + + -- " Available Debug Adapters: + -- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/ + -- " Adapter configuration and installation instructions: + -- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation + -- " Debug Adapter protocol: + -- " https://microsoft.github.io/debug-adapter-protocol/ + -- " Debugging + d = { + name = "Debug", + t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" }, + b = { "<cmd>lua require'dap'.step_back()<cr>", "Step Back" }, + c = { "<cmd>lua require'dap'.continue()<cr>", "Continue" }, + C = { "<cmd>lua require'dap'.run_to_cursor()<cr>", "Run To Cursor" }, + d = { "<cmd>lua require'dap'.disconnect()<cr>", "Disconnect" }, + g = { "<cmd>lua require'dap'.session()<cr>", "Get Session" }, + i = { "<cmd>lua require'dap'.step_into()<cr>", "Step Into" }, + o = { "<cmd>lua require'dap'.step_over()<cr>", "Step Over" }, + u = { "<cmd>lua require'dap'.step_out()<cr>", "Step Out" }, + p = { "<cmd>lua require'dap'.pause.toggle()<cr>", "Pause" }, + r = { "<cmd>lua require'dap'.repl.toggle()<cr>", "Toggle Repl" }, + s = { "<cmd>lua require'dap'.continue()<cr>", "Start" }, + q = { "<cmd>lua require'dap'.stop()<cr>", "Quit" }, + }, + g = { + name = "Git", + j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" }, + k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" }, + l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" }, + p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" }, + r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" }, + R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" }, + s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" }, + u = { + "<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>", + "Undo Stage Hunk", + }, + o = { "<cmd>Telescope git_status<cr>", "Open changed file" }, + b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" }, + c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" }, + C = { + "<cmd>Telescope git_bcommits<cr>", + "Checkout commit(for current file)", + }, + }, + l = { + name = "LSP", + a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" }, + d = { + "<cmd>Telescope lsp_document_diagnostics<cr>", + "Document Diagnostics", + }, + w = { + "<cmd>Telescope lsp_workspace_diagnostics<cr>", + "Workspace Diagnostics", + }, + f = { "<cmd>lua vim.lsp.buf.formatting()<cr>", "Format" }, + i = { "<cmd>LspInfo<cr>", "Info" }, + j = { "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<cr>", "Next Diagnostic" }, + k = { "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<cr>", "Prev Diagnostic" }, + q = { "<cmd>Telescope quickfix<cr>", "Quickfix" }, + r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" }, + s = { + O.plugin.symbol_outline.active and "<cmd>SymbolsOutline<cr>" or "<cmd> Telescope lsp_document_symbols<cr>", + "Document Symbols", + }, + S = { + "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", + "Workspace Symbols", + }, + }, + s = { + name = "Search", + b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" }, + c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" }, + f = { "<cmd>Telescope find_files<cr>", "Find File" }, + h = { "<cmd>Telescope help_tags<cr>", "Find Help" }, + M = { "<cmd>Telescope man_pages<cr>", "Man Pages" }, + r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" }, + R = { "<cmd>Telescope registers<cr>", "Registers" }, + t = { "<cmd>Telescope live_grep<cr>", "Text" }, + }, + S = { + name = "Session", + s = { "<cmd>SessionSave<cr>", "Save Session" }, + l = { "<cmd>SessionLoad<cr>", "Load Session" }, + }, + T = { + name = "Treesitter", + i = { ":TSConfigInfo<cr>", "Info" }, + }, +} + +-- if O.plugin.trouble.active then +-- mappings["d"] = { +-- name = "Diagnostics", +-- t = { "<cmd>TroubleToggle<cr>", "trouble" }, +-- w = { "<cmd>TroubleToggle lsp_workspace_diagnostics<cr>", "workspace" }, +-- d = { "<cmd>TroubleToggle lsp_document_diagnostics<cr>", "document" }, +-- q = { "<cmd>TroubleToggle quickfix<cr>", "quickfix" }, +-- l = { "<cmd>TroubleToggle loclist<cr>", "loclist" }, +-- r = { "<cmd>TroubleToggle lsp_references<cr>", "references" }, +-- } +-- end + +if O.plugin.symbol_outline.active then + vim.api.nvim_set_keymap("n", "<leader>o", ":SymbolsOutline<CR>", { noremap = true, silent = true }) + mappings["o"] = "Symbols outline" +end + +if O.plugin.ts_playground.active then + vim.api.nvim_set_keymap("n", "<leader>Th", ":TSHighlightCapturesUnderCursor<CR>", { noremap = true, silent = true }) + mappings[""] = "Highlight Capture" +end + +if O.plugin.zen.active then + vim.api.nvim_set_keymap("n", "<leader>z", ":ZenMode<CR>", { noremap = true, silent = true }) + mappings["z"] = "Zen" +end +if O.plugin.lazygit.active then + vim.api.nvim_set_keymap("n", "<leader>gg", ":LazyGit<CR>", { noremap = true, silent = true }) + mappings["gg"] = "LazyGit" +end +if O.plugin.telescope_project.active then + -- open projects + vim.api.nvim_set_keymap( + "n", + "<leader>P", + ":lua require'telescope'.extensions.project.project{}<CR>", + { noremap = true, silent = true } + ) + mappings["P"] = "Projects" +end + +-- [";"] = "Dashboard", + +if O.lang.latex.active then + mappings["L"] = { + name = "+Latex", + c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" }, + f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" }, + i = { "<cmd>VimtexInfo<cr>", "Project Information" }, + s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" }, + t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" }, + v = { "<cmd>VimtexView<cr>", "View PDF" }, + } +end + +if O.lushmode then + mappings["L"] = { + name = "+Lush", + l = { ":Lushify<cr>", "Lushify" }, + x = { ":lua require('lush').export_to_buffer(require('lush_theme.cool_name'))", "Lush Export" }, + t = { ":LushRunTutorial<cr>", "Lush Tutorial" }, + q = { ":LushRunQuickstart<cr>", "Lush Quickstart" }, + } +end + +local wk = require "which-key" +wk.register(mappings, opts) diff --git a/.config/nvim/lua/cfg/zen/init.lua b/.config/nvim/lua/cfg/zen/init.lua new file mode 100644 index 0000000..0d6bfca --- /dev/null +++ b/.config/nvim/lua/cfg/zen/init.lua @@ -0,0 +1,26 @@ +local M = {} + +M.config = function() + require("zen-mode").setup { + window = { + backdrop = 1, + height = 0.85, -- height of the Zen window + options = { + signcolumn = "no", -- disable signcolumn + number = false, -- disable number column + relativenumber = false, -- disable relative numbers + -- cursorline = false, -- disable cursorline + -- cursorcolumn = false, -- disable cursor column + -- foldcolumn = "0", -- disable fold column + -- list = false, -- disable whitespace characters + }, + }, + plugins = { + gitsigns = { enabled = false }, -- disables git signs + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + } +end +return M diff --git a/.config/nvim/lua/colorscheme.lua b/.config/nvim/lua/colorscheme.lua deleted file mode 100644 index bfd467f..0000000 --- a/.config/nvim/lua/colorscheme.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.cmd('let g:nvcode_termcolors=256') - -vim.cmd('colorscheme ' .. O.colorscheme) diff --git a/.config/nvim/lua/default-config.lua b/.config/nvim/lua/default-config.lua new file mode 100644 index 0000000..ed28b79 --- /dev/null +++ b/.config/nvim/lua/default-config.lua @@ -0,0 +1,244 @@ +CONFIG_PATH = vim.fn.stdpath "config" +DATA_PATH = vim.fn.stdpath "data" +CACHE_PATH = vim.fn.stdpath "cache" +TERMINAL = vim.fn.expand "$TERMINAL" + +O = { + format_on_save = true, + auto_close_tree = 0, + auto_complete = true, + colorscheme = "lunar", + hidden_files = true, + wrap_lines = false, + number = true, + relative_number = true, + cursorline = true, + shell = "bash", + timeoutlen = 100, + nvim_tree_disable_netrw = 0, + ignore_case = true, + smart_case = true, + lushmode = false, + hl_search = false, + transparent_window = false, + leader_key = "space", + vnsip_dir = vim.fn.stdpath "config" .. "/snippets", + + -- @usage pass a table with your desired languages + treesitter = { + ensure_installed = "all", + ignore_install = { "haskell" }, + highlight = { enabled = true }, + -- The below are for treesitter-textobjects plugin + textobj_prefixes = { + goto_next = "]", -- Go to next + goto_previous = "[", -- Go to previous + inner = "i", -- Select inside + outer = "a", -- Selct around + swap = "<leader>a", -- Swap with next + }, + textobj_suffixes = { + -- Start and End respectively for the goto keys + -- for other keys it only uses the first + ["function"] = { "f", "F" }, + ["class"] = { "m", "M" }, + ["parameter"] = { "a", "A" }, + ["block"] = { "k", "K" }, + ["conditional"] = { "i", "I" }, + ["call"] = { "c", "C" }, + ["loop"] = { "l", "L" }, + ["statement"] = { "s", "S" }, + ["comment"] = { "/", "?" }, + }, + -- The below is for treesitter hint textobjects plugin + hint_labels = { "h", "j", "f", "d", "n", "v", "s", "l", "a" }, + }, + + lsp = { + popup_border = "single", + }, + + database = { save_location = "~/.config/nvcode_db", auto_execute = 1 }, + + plugin = { + -- Builtins + dashboard = { active = false }, + colorizer = { active = false }, + zen = { active = false }, + hop = { active = false }, + vim_rooter = { active = false }, + ts_context_commentstring = { active = false }, + ts_hintobjects = { active = false }, + ts_autotag = { active = false }, + ts_textobjects = { active = false }, + ts_playground = { active = false }, + ts_rainbow = { active = false }, + ts_textsubjects = { active = false }, + telescope_fzy = { active = false }, + telescope_project = { active = false }, + indent_line = { active = false }, + symbol_outline = { active = false }, + debug = { active = false }, + lazygit = { active = false }, + lush = { active = false }, + diffview = { active = false }, + floatterm = { active = false }, + trouble = { active = false }, + sanegx = { active = false }, + }, + + custom_plugins = { + -- use config.lua for this not put here + }, + + user_autocommands = { + { "FileType", "qf", "set nobuflisted" }, + }, + + lang = { + python = { + linter = "", + isort = false, + diagnostics = { + virtual_text = { spacing = 0, prefix = "" }, + signs = true, + underline = true, + }, + analysis = { + type_checking = "basic", + auto_search_paths = true, + use_library_code_types = true, + }, + }, + dart = { + sdk_path = "/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot", + }, + lua = { + diagnostics = { + virtual_text = { spacing = 0, prefix = "" }, + signs = true, + underline = true, + }, + }, + sh = { + -- @usage can be 'shellcheck' + linter = "", + -- @usage can be 'shfmt' + diagnostics = { + virtual_text = { spacing = 0, prefix = "" }, + signs = true, + underline = true, + }, + }, + tsserver = { + -- @usage can be 'eslint' + linter = "", + diagnostics = { + virtual_text = { spacing = 0, prefix = "" }, + signs = true, + underline = true, + }, + }, + json = { + diagnostics = { + virtual_text = { spacing = 0, prefix = "" }, + signs = true, + underline = true, + }, + }, + tailwindcss = { + filetypes = { + "html", + "css", + "scss", + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + }, + }, + clang = { + diagnostics = { + virtual_text = { spacing = 0, prefix = "" }, + signs = true, + underline = true, + }, + cross_file_rename = true, + header_insertion = "never", + }, + ruby = { + diagnostics = { + virtualtext = { spacing = 0, prefix = "" }, + signs = true, + underline = true, + }, + filetypes = { "rb", "erb", "rakefile", "ruby" }, + }, + go = {}, + elixir = {}, + vim = {}, + yaml = {}, + terraform = {}, + rust = { + rust_tools = { + active = false, + }, + linter = "", + diagnostics = { + virtual_text = { spacing = 0, prefix = "" }, + signs = true, + underline = true, + }, + }, + svelte = {}, + php = { + environment = { + php_version = "7.4", + }, + diagnostics = { + virtual_text = { spacing = 0, prefix = "" }, + signs = true, + underline = true, + }, + filetypes = { "php", "phtml" }, + }, + latex = {}, + kotlin = {}, + html = {}, + elm = {}, + emmet = { active = true }, + graphql = {}, + efm = {}, + docker = {}, + cmake = {}, + java = {}, + css = { + virtual_text = true, + }, + }, + + dashboard = { + + custom_header = { + ' ##############..... ############## ', + ' ##############......############## ', + ' ##########..........########## ', + ' ##########........########## ', + ' ##########.......########## ', + ' ##########.....##########.. ', + ' ##########....##########..... ', + ' ..##########..##########......... ', + ' ....##########.#########............. ', + ' ..################JJJ............ ', + ' ################............. ', + ' ##############.JJJ.JJJJJJJJJJ ', + ' ############...JJ...JJ..JJ JJ ', + ' ##########....JJ...JJ..JJ JJ ', + ' ########......JJJ..JJJ JJJ JJJ ', + ' ###### ......... ', + ' ..... ', + ' . ', + }, + footer = { "chrisatmachine.com" }, + }, +} diff --git a/.config/nvim/lua/globals.lua b/.config/nvim/lua/globals.lua deleted file mode 100644 index 9115c2e..0000000 --- a/.config/nvim/lua/globals.lua +++ /dev/null @@ -1,64 +0,0 @@ -CONFIG_PATH = vim.fn.stdpath('config') -DATA_PATH = vim.fn.stdpath('data') -CACHE_PATH = vim.fn.stdpath('cache') -O = { - auto_close_tree = 0, - auto_complete = true, - colorscheme = 'lunar', - hidden_files = true, - wrap_lines = false, - number = true, - relative_number = true, - shell = 'bash', - timeoutlen = 100, - nvim_tree_disable_netrw = 0, - extras = false, - - -- @usage pass a table with your desired languages - treesitter = { - ensure_installed = "all", - ignore_install = {"haskell"}, - highlight = {enabled = true}, - playground = {enabled = true}, - rainbow = {enabled = false} - }, - database = {save_location = '~/.config/nvim_db', auto_execute = 1}, - python = { - linter = '', - formatter = '', - autoformat = false, - isort = false, - diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true}, - analysis = {type_checking = "basic", auto_search_paths = true, use_library_code_types = true} - }, - lua = { - -- @usage can be 'lua-format' - formatter = '', - autoformat = false, - diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true} - }, - sh = { - -- @usage can be 'shellcheck' - linter = '', - -- @usage can be 'shfmt' - formatter = '', - autoformat = false, - diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true} - }, - tsserver = { - -- @usage can be 'eslint' - linter = '', - -- @usage can be 'prettier' - formatter = '', - autoformat = false, - diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true} - }, - json = { - -- @usage can be 'prettier' - formatter = '', - autoformat = false, - diagnostics = {virtual_text = true, signs = true, underline = true} - }, - go = {}, - clang = {diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true}}, -} diff --git a/.config/nvim/lua/keymappings.lua b/.config/nvim/lua/keymappings.lua new file mode 100644 index 0000000..3b6a95a --- /dev/null +++ b/.config/nvim/lua/keymappings.lua @@ -0,0 +1,78 @@ +-- better window movement +vim.api.nvim_set_keymap("n", "<C-h>", "<C-w>h", { silent = true }) +vim.api.nvim_set_keymap("n", "<C-j>", "<C-w>j", { silent = true }) +vim.api.nvim_set_keymap("n", "<C-k>", "<C-w>k", { silent = true }) +vim.api.nvim_set_keymap("n", "<C-l>", "<C-w>l", { silent = true }) + +-- TODO fix this +-- Terminal window navigation +vim.cmd [[ + tnoremap <C-h> <C-\><C-N><C-w>h + tnoremap <C-j> <C-\><C-N><C-w>j + tnoremap <C-k> <C-\><C-N><C-w>k + tnoremap <C-l> <C-\><C-N><C-w>l + inoremap <C-h> <C-\><C-N><C-w>h + inoremap <C-j> <C-\><C-N><C-w>j + inoremap <C-k> <C-\><C-N><C-w>k + inoremap <C-l> <C-\><C-N><C-w>l + tnoremap <Esc> <C-\><C-n> +]] + +-- TODO fix this +-- resize with arrows +if vim.fn.has("mac") == 1 then + vim.api.nvim_set_keymap("n", "<A-Up>", ":resize -2<CR>", { silent = true }) + vim.api.nvim_set_keymap("n", "<A-Down>", ":resize +2<CR>", { silent = true }) + vim.api.nvim_set_keymap("n", "<A-Left>", ":vertical resize -2<CR>", { silent = true }) + vim.api.nvim_set_keymap("n", "<A-Right>", ":vertical resize +2<CR>", { silent = true }) +else + vim.api.nvim_set_keymap("n", "<C-Up>", ":resize -2<CR>", { silent = true }) + vim.api.nvim_set_keymap("n", "<C-Down>", ":resize +2<CR>", { silent = true }) + vim.api.nvim_set_keymap("n", "<C-Left>", ":vertical resize -2<CR>", { silent = true }) + vim.api.nvim_set_keymap("n", "<C-Right>", ":vertical resize +2<CR>", { silent = true }) +end + +-- better indenting +vim.api.nvim_set_keymap("v", "<", "<gv", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("v", ">", ">gv", { noremap = true, silent = true }) + +-- I hate escape +vim.api.nvim_set_keymap("i", "jk", "<ESC>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("i", "kj", "<ESC>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("i", "jj", "<ESC>", { noremap = true, silent = true }) + +-- Tab switch buffer +vim.api.nvim_set_keymap("n", "<TAB>", ":bnext<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "<S-TAB>", ":bprevious<CR>", { noremap = true, silent = true }) + +-- Move selected line / block of text in visual mode +vim.api.nvim_set_keymap("x", "K", ":move '<-2<CR>gv-gv", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("x", "J", ":move '>+1<CR>gv-gv", { noremap = true, silent = true }) + +-- Move current line / block with Alt-j/k ala vscode. +vim.api.nvim_set_keymap("n", "<A-j>", ":m .+1<CR>==", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "<A-k>", ":m .-2<CR>==", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("i", "<A-j>", "<Esc>:m .+1<CR>==gi", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("i", "<A-k>", "<Esc>:m .-2<CR>==gi", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("x", "<A-j>", ":m '>+1<CR>gv-gv", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("x", "<A-k>", ":m '<-2<CR>gv-gv", { noremap = true, silent = true }) + +-- QuickFix +vim.api.nvim_set_keymap("n", "]q", ":cnext<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "[q", ":cprev<CR>", { noremap = true, silent = true }) + +-- Better nav for omnicomplete +vim.cmd 'inoremap <expr> <c-j> ("\\<C-n>")' +vim.cmd 'inoremap <expr> <c-k> ("\\<C-p>")' + +vim.cmd 'vnoremap p "0p' +vim.cmd 'vnoremap P "0P' + +-- Toggle the QuickFix window +vim.api.nvim_set_keymap("", "<C-q>", ":call QuickFixToggle()<CR>", { noremap = true, silent = true }) + +-- Telescope stuff +-- vim.api.nvim_set_keymap("n", "<Leader>fb", "<cmd>lua require'telescope.builtin'.buffers{}<CR>", { noremap = true, silent = true }) -- search open buffers +-- vim.api.nvim_set_keymap("n", "<Leader>fl", "<cmd>lua require'telescope.builtin'.current_buffer_fuzzy_find{}<CR>", { noremap = true, silent = true }) -- search lines in current buffer +-- vim.api.nvim_set_keymap("n", "<Leader>gg", "<cmd>lua require'telescope.builtin'.live_grep{}<CR>", { noremap = true, silent = true }) -- search all lines in project +-- vim.api.nvim_set_keymap("n", "<Leader>fr", "<cmd>lua require'telescope.builtin'.lsp_references{}<CR>", { noremap = true, silent = true }) -- search references to symbol under cursor diff --git a/.config/nvim/lua/lsp/bash-ls.lua b/.config/nvim/lua/lsp/bash-ls.lua deleted file mode 100644 index 7b430a6..0000000 --- a/.config/nvim/lua/lsp/bash-ls.lua +++ /dev/null @@ -1,6 +0,0 @@ --- npm i -g bash-language-server -require'lspconfig'.bashls.setup { - cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"}, - on_attach = require'lsp'.common_on_attach, - filetypes = { "sh", "zsh" } -} diff --git a/.config/nvim/lua/lsp/clangd.lua b/.config/nvim/lua/lsp/clangd.lua deleted file mode 100644 index dbbda08..0000000 --- a/.config/nvim/lua/lsp/clangd.lua +++ /dev/null @@ -1,13 +0,0 @@ -require'lspconfig'.clangd.setup { - cmd = {DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd"}, - on_attach = require'lsp'.common_on_attach, - handlers = { - ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { - virtual_text = O.clang.diagnostics.virtual_text, - signs = O.clang.diagnostics.signs, - underline = O.clang.diagnostics.underline, - update_in_insert = true - - }) - } -} diff --git a/.config/nvim/lua/lsp/docker-ls.lua b/.config/nvim/lua/lsp/docker-ls.lua deleted file mode 100644 index b477a23..0000000 --- a/.config/nvim/lua/lsp/docker-ls.lua +++ /dev/null @@ -1,6 +0,0 @@ --- npm install -g dockerfile-language-server-nodejs -require'lspconfig'.dockerls.setup { - cmd = {DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio"}, - on_attach = require'lsp'.common_on_attach, - root_dir = vim.loop.cwd -} diff --git a/.config/nvim/lua/lsp/efm-general-ls.lua b/.config/nvim/lua/lsp/efm-general-ls.lua deleted file mode 100644 index 01bc3ee..0000000 --- a/.config/nvim/lua/lsp/efm-general-ls.lua +++ /dev/null @@ -1,119 +0,0 @@ --- Example configuations here: https://github.com/mattn/efm-langserver --- TODO this file needs to be refactored eache lang should be it's own file --- python -local python_arguments = {} - --- TODO replace with path argument -local flake8 = { - LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -", - lintStdin = true, - lintFormats = {"%f:%l:%c: %m"} -} - -local isort = {formatCommand = "isort --quiet -", formatStdin = true} - -local yapf = {formatCommand = "yapf --quiet", formatStdin = true} -local black = {formatCommand = "black --quiet -", formatStdin = true} - -if O.python.linter == 'flake8' then table.insert(python_arguments, flake8) end - -if O.python.isort then table.insert(python_arguments, isort) end - -if O.python.formatter == 'yapf' then - table.insert(python_arguments, yapf) -elseif O.python.formatter == 'black' then - table.insert(python_arguments, black) -end - --- lua -local lua_arguments = {} - -local luaFormat = { - formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=120", - formatStdin = true -} - -local lua_fmt = { - formatCommand = "luafmt --indent-count 2 --line-width 120 --stdin", - formatStdin = true -} - -if O.lua.formatter == 'lua-format' then - table.insert(lua_arguments, luaFormat) -elseif O.lua.formatter == 'lua-fmt' then - table.insert(lua_arguments, lua_fmt) -end - --- sh -local sh_arguments = {} - -local shfmt = {formatCommand = 'shfmt -ci -s -bn', formatStdin = true} - -local shellcheck = { - LintCommand = 'shellcheck -f gcc -x', - lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'} -} - -if O.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end - -if O.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end - --- tsserver/web javascript react, vue, json, html, css, yaml -local prettier = {formatCommand = "prettier --stdin-filepath ${INPUT}", formatStdin = true} --- You can look for project scope Prettier and Eslint with e.g. vim.fn.glob("node_modules/.bin/prettier") etc. If it is not found revert to global Prettier where needed. --- local prettier = {formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}", formatStdin = true} - -local eslint = { - lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}", - lintIgnoreExitCode = true, - lintStdin = true, - lintFormats = {"%f:%l:%c: %m"}, - formatCommand = "./node_modules/.bin/eslint --fix-to-stdout --stdin --stdin-filename=${INPUT}", - formatStdin = true -} - -local tsserver_args = {} - -if O.tsserver.formatter == 'prettier' then table.insert(tsserver_args, prettier) end - -if O.tsserver.linter == 'eslint' then table.insert(tsserver_args, eslint) end - --- local markdownlint = { --- -- TODO default to global lintrc --- -- lintcommand = 'markdownlint -s -c ./markdownlintrc', --- lintCommand = 'markdownlint -s', --- lintStdin = true, --- lintFormats = {'%f:%l %m', '%f:%l:%c %m', '%f: %l: %m'} --- } - -local markdownPandocFormat = {formatCommand = 'pandoc -f markdown -t gfm -sp --tab-stop=2', formatStdin = true} - -require"lspconfig".efm.setup { - -- init_options = {initializationOptions}, - cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, - init_options = {documentFormatting = true, codeAction = false}, - filetypes = {"lua", "python", "javascriptreact", "javascript", "typescript","typescriptreact","sh", "html", "css", "json", "yaml", "markdown", "vue"}, - settings = { - rootMarkers = {".git/"}, - languages = { - python = python_arguments, - lua = lua_arguments, - sh = sh_arguments, - javascript = tsserver_args, - javascriptreact = tsserver_args, - typescript = tsserver_args, - typescriptreact = tsserver_args, - html = {prettier}, - css = {prettier}, - json = {prettier}, - yaml = {prettier}, - markdown = {markdownPandocFormat} - -- javascriptreact = {prettier, eslint}, - -- javascript = {prettier, eslint}, - -- markdown = {markdownPandocFormat, markdownlint}, - } - } -} - --- Also find way to toggle format on save --- maybe this will help: https://superuser.com/questions/439078/how-to-disable-autocmd-or-augroup-in-vim diff --git a/.config/nvim/lua/lsp/go-ls.lua b/.config/nvim/lua/lsp/go-ls.lua deleted file mode 100644 index 1311247..0000000 --- a/.config/nvim/lua/lsp/go-ls.lua +++ /dev/null @@ -1,7 +0,0 @@ -require'lspconfig'.gopls.setup{ - cmd = {DATA_PATH .. "/lspinstall/go/gopls"}, - settings = {gopls = {analyses = {unusedparams = true}, staticcheck = true}}, - root_dir = require'lspconfig'.util.root_pattern(".git","go.mod","."), - init_options = {usePlaceholders = true, completeUnimported = true}, - on_attach = require'lsp'.common_on_attach -} diff --git a/.config/nvim/lua/lsp/json-ls.lua b/.config/nvim/lua/lsp/json-ls.lua deleted file mode 100644 index 952673a..0000000 --- a/.config/nvim/lua/lsp/json-ls.lua +++ /dev/null @@ -1,16 +0,0 @@ --- npm install -g vscode-json-languageserver -require'lspconfig'.jsonls.setup { - cmd = { - "node", DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js", - "--stdio" - }, - on_attach = require'lsp'.common_on_attach, - - commands = { - Format = { - function() - vim.lsp.buf.range_formatting({}, {0, 0}, {vim.fn.line("$"), 0}) - end - } - } -} diff --git a/.config/nvim/lua/lsp/latex-ls.lua b/.config/nvim/lua/lsp/latex-ls.lua deleted file mode 100644 index 179c143..0000000 --- a/.config/nvim/lua/lsp/latex-ls.lua +++ /dev/null @@ -1,4 +0,0 @@ -require'lspconfig'.texlab.setup{ - cmd = {DATA_PATH .. "/lspinstall/latex/texlab"}, - on_attach = require'lsp'.common_on_attach -} diff --git a/.config/nvim/lua/lsp/lua-ls.lua b/.config/nvim/lua/lsp/lua-ls.lua deleted file mode 100644 index 775eb92..0000000 --- a/.config/nvim/lua/lsp/lua-ls.lua +++ /dev/null @@ -1,27 +0,0 @@ --- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone) -local sumneko_root_path = DATA_PATH .. "/lspinstall/lua" -local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server" - -require'lspconfig'.sumneko_lua.setup { - cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}, - on_attach = require'lsp'.common_on_attach, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT', - -- Setup your lua path - path = vim.split(package.path, ';') - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = {'vim'} - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true}, - maxPreload = 10000 - } - } - } -} diff --git a/.config/nvim/lua/lsp/python-ls.lua b/.config/nvim/lua/lsp/python-ls.lua deleted file mode 100644 index d4dfac5..0000000 --- a/.config/nvim/lua/lsp/python-ls.lua +++ /dev/null @@ -1,23 +0,0 @@ - --- npm i -g pyright -require'lspconfig'.pyright.setup { - cmd = {DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", "--stdio"}, - on_attach = require'lsp'.common_on_attach, - handlers = { - ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { - virtual_text = O.python.diagnostics.virtual_text, - signs = O.python.diagnostics.signs, - underline = O.python.diagnostics.underline, - update_in_insert = true - }) - }, - settings = { - python = { - analysis = { - typeCheckingMode = O.python.analysis.type_checking, - autoSearchPaths = O.python.analysis.auto_search_paths, - useLibraryCodeForTypes = O.python.analysis.use_library_code_types - } - } - } -} diff --git a/.config/nvim/lua/lsp/rust-ls.lua b/.config/nvim/lua/lsp/rust-ls.lua deleted file mode 100644 index 896c693..0000000 --- a/.config/nvim/lua/lsp/rust-ls.lua +++ /dev/null @@ -1,4 +0,0 @@ -require'lspconfig'.rust_analyzer.setup{ - cmd = {DATA_PATH .. "/lspinstall/rust/rust-analyzer"}, - on_attach = require'lsp'.common_on_attach -} diff --git a/.config/nvim/lua/lsp/vim-ls.lua b/.config/nvim/lua/lsp/vim-ls.lua deleted file mode 100644 index 39beb11..0000000 --- a/.config/nvim/lua/lsp/vim-ls.lua +++ /dev/null @@ -1,5 +0,0 @@ --- npm install -g vim-language-server -require'lspconfig'.vimls.setup { - cmd = {DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio"}, - on_attach = require'lsp'.common_on_attach -} diff --git a/.config/nvim/lua/lsp/yaml-ls.lua b/.config/nvim/lua/lsp/yaml-ls.lua deleted file mode 100644 index 3fbc41e..0000000 --- a/.config/nvim/lua/lsp/yaml-ls.lua +++ /dev/null @@ -1,5 +0,0 @@ --- npm install -g yaml-language-server -require'lspconfig'.yamlls.setup{ - cmd = {DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio"}, - on_attach = require'lsp'.common_on_attach, -} diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua deleted file mode 100644 index bc7f380..0000000 --- a/.config/nvim/lua/mappings.lua +++ /dev/null @@ -1,58 +0,0 @@ -vim.api.nvim_set_keymap('n', '-', ':RnvimrToggle<CR>', {noremap = true, silent = true}) - --- better window movement -vim.api.nvim_set_keymap('n', '<C-h>', '<C-w>h', {silent = true}) -vim.api.nvim_set_keymap('n', '<C-j>', '<C-w>j', {silent = true}) -vim.api.nvim_set_keymap('n', '<C-k>', '<C-w>k', {silent = true}) -vim.api.nvim_set_keymap('n', '<C-l>', '<C-w>l', {silent = true}) - --- TODO fix this --- Terminal window navigation -vim.cmd([[ - tnoremap <C-h> <C-\><C-N><C-w>h - tnoremap <C-j> <C-\><C-N><C-w>j - tnoremap <C-k> <C-\><C-N><C-w>k - tnoremap <C-l> <C-\><C-N><C-w>l - inoremap <C-h> <C-\><C-N><C-w>h - inoremap <C-j> <C-\><C-N><C-w>j - inoremap <C-k> <C-\><C-N><C-w>k - inoremap <C-l> <C-\><C-N><C-w>l - tnoremap <Esc> <C-\><C-n> -]]) - --- TODO fix this --- resize with arrows -vim.api.nvim_set_keymap('n', '<C-Up>', ':resize -2<CR>', {silent = true}) -vim.api.nvim_set_keymap('n', '<C-Down>', ':resize +2<CR>', {silent = true}) -vim.api.nvim_set_keymap('n', '<C-Left>', ':vertical resize -2<CR>', {silent = true}) -vim.api.nvim_set_keymap('n', '<C-Right>', ':vertical resize +2<CR>', {silent = true}) - --- better indenting -vim.api.nvim_set_keymap('v', '<', '<gv', {noremap = true, silent = true}) -vim.api.nvim_set_keymap('v', '>', '>gv', {noremap = true, silent = true}) - --- I hate escape -vim.api.nvim_set_keymap('i', 'jk', '<ESC>', {noremap = true, silent = true}) -vim.api.nvim_set_keymap('i', 'kj', '<ESC>', {noremap = true, silent = true}) -vim.api.nvim_set_keymap('i', 'jj', '<ESC>', {noremap = true, silent = true}) - --- Tab switch buffer -vim.api.nvim_set_keymap('n', '<TAB>', ':bnext<CR>', {noremap = true, silent = true}) -vim.api.nvim_set_keymap('n', '<S-TAB>', ':bprevious<CR>', {noremap = true, silent = true}) - --- Move selected line / block of text in visual mode -vim.api.nvim_set_keymap('x', 'K', ':move \'<-2<CR>gv-gv', {noremap = true, silent = true}) -vim.api.nvim_set_keymap('x', 'J', ':move \'>+1<CR>gv-gv', {noremap = true, silent = true}) - --- Better nav for omnicomplete -vim.cmd('inoremap <expr> <c-j> (\"\\<C-n>\")') -vim.cmd('inoremap <expr> <c-k> (\"\\<C-p>\")') - --- fix to get netrw's gx command to work correctly -vim.api.nvim_set_keymap('n', 'gx', ":call netrw#BrowseX(expand((exists('g:netrw_gx')? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())<cr>", {noremap = true, silent = true}) - -vim.cmd('vnoremap p "0p') -vim.cmd('vnoremap P "0P') - --- Toggle the QuickFix window -vim.api.nvim_set_keymap('', '<C-q>', ':call QuickFixToggle()<CR>', {noremap = true, silent = true}) diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 66ca22c..4fc780d 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -1,139 +1,284 @@ local execute = vim.api.nvim_command local fn = vim.fn -local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" +local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim" if fn.empty(fn.glob(install_path)) > 0 then - execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path) - execute "packadd packer.nvim" + execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path) + execute "packadd packer.nvim" end ---- Check if a file or directory exists in this path -local function require_plugin(plugin) - local plugin_prefix = fn.stdpath("data") .. "/site/pack/packer/opt/" - - local plugin_path = plugin_prefix .. plugin .. "/" - -- print('test '..plugin_path) - local ok, err, code = os.rename(plugin_path, plugin_path) - if not ok then - if code == 13 then - -- Permission denied, but it exists - return true - end - end - -- print(ok, err, code) - if ok then vim.cmd("packadd " .. plugin) end - return ok, err, code +local packer_ok, packer = pcall(require, "packer") +if not packer_ok then + return end -vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua - -return require("packer").startup( - function(use)-- Packer can manage itself as an optional plugin - -- Packer can manage itself as an optional plugin - use "wbthomason/packer.nvim" - - -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function) - use {"neovim/nvim-lspconfig", opt = true} - use {"glepnir/lspsaga.nvim", opt = true} - use {"kabouzeid/nvim-lspinstall", opt = true} - use {"folke/trouble.nvim", opt = true} - - -- Telescope - use {"nvim-lua/popup.nvim", opt = true} - use {"nvim-lua/plenary.nvim", opt = true} - use {"nvim-telescope/telescope.nvim", opt = true} - use {"nvim-telescope/telescope-fzy-native.nvim", opt = true} - use {"nvim-telescope/telescope-project.nvim", opt = true} - - -- Autocomplete - use {"hrsh7th/nvim-compe", opt = true} - use {"hrsh7th/vim-vsnip", opt = true} - use {"rafamadriz/friendly-snippets", opt = true} - - -- Treesitter - use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"} - use {"windwp/nvim-ts-autotag", opt = true} - use {'andymass/vim-matchup', opt = true} - - -- Explorer - use {"kyazdani42/nvim-tree.lua", opt = true} - use {"ahmedkhalf/lsp-rooter.nvim", opt = true} -- with this nvim-tree will follow you - - -- TODO remove when open on dir is supported by nvimtree - use "kevinhwang91/rnvimr" - - -- git - use {"lewis6991/gitsigns.nvim", opt = true} - use {'f-person/git-blame.nvim', opt = true} - - use {"ChristianChiarulli/dashboard-nvim", opt = true} - use {"windwp/nvim-autopairs", opt = true} - use {"kevinhwang91/nvim-bqf", opt = true} - - -- Comments - use {"terrortylor/nvim-comment", opt = true} - - -- Icons - use {"kyazdani42/nvim-web-devicons", opt = true} - - -- Status Line and Bufferline - use 'glepnir/galaxyline.nvim' - use {'akinsho/nvim-bufferline.lua', requires = 'kyazdani42/nvim-web-devicons'} - use {"romgrk/barbar.nvim", opt = true} - - -- Which key - use {"folke/which-key.nvim", opt = true} - - -- Colorschemes - use 'aktersnurra/githubsy.vim' - use {"aktersnurra/nvcode-color-schemes.vim", opt = true} - use 'RRethy/nvim-base16' - - -- General Plugins [my own additions] - use 'unblevable/quick-scope' - use {"Pocco81/TrueZen.nvim", opt = true} - - -- Extras - use {'nacro90/numb.nvim', opt = true} - use {'phaazon/hop.nvim', opt = true} - use {'norcalli/nvim-colorizer.lua', opt = true} - use 'airblade/vim-rooter' - - require_plugin("nvim-lspconfig") - require_plugin("lspsaga.nvim") - require_plugin("nvim-lspinstall") - require_plugin('trouble.nvim') - require_plugin("friendly-snippets") - require_plugin("popup.nvim") - require_plugin("plenary.nvim") - require_plugin("telescope.nvim") - require_plugin('telescope-project.nvim') - require_plugin("nvim-compe") - require_plugin("vim-vsnip") - require_plugin("nvim-treesitter") - require_plugin('vim-matchup') - require_plugin("nvim-tree.lua") - require_plugin("gitsigns.nvim") - require_plugin("git-blame.nvim") - require_plugin("vim-which-key") - require_plugin("dashboard-nvim") - require_plugin("nvim-autopairs") - require_plugin("nvim-comment") - require_plugin("nvim-bqf") - require_plugin("nvcode-color-schemes.vim") - require_plugin("nvim-web-devicons") - require_plugin("galaxyline.nvim") - require_plugin("barbar.nvim") - require_plugin('lsp-rooter.nvim') - require_plugin("which-key.nvim") - - require_plugin("vim-rooter") - require_plugin('numb.nvim') - require_plugin('hop.nvim') - require_plugin('nvim-colorizer.lua') - - require_plugin("quick-scope") - require_plugin("TrueZen.nvim") +packer.init { + git = { clone_timeout = 300 }, + display = { + open_fn = function() + return require("packer.util").float { border = "single" } + end, + }, +} + +vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" + +return require("packer").startup(function(use) + -- Packer can manage itself as an optional plugin + use "wbthomason/packer.nvim" + + -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function) + use { "neovim/nvim-lspconfig" } + use { "kabouzeid/nvim-lspinstall", event = "BufRead" } + -- Telescope + use { "nvim-lua/popup.nvim" } + use { "nvim-lua/plenary.nvim" } + use { "tjdevries/astronauta.nvim" } + use { + "nvim-telescope/telescope.nvim", + config = [[require('cfg.telescope')]], + event = "BufEnter", + } + + -- Autocomplete + use { + "hrsh7th/nvim-compe", + event = "InsertEnter", + config = function() + require("cfg.compe").config() + end, + } + + use { "hrsh7th/vim-vsnip", event = "InsertEnter" } + use { "rafamadriz/friendly-snippets", event = "InsertEnter" } + + -- Treesitter + use { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" } + + -- Neoformat + use { "sbdchd/neoformat" } + + use { + "kyazdani42/nvim-tree.lua", + -- cmd = "NvimTreeToggle", + config = function() + require("cfg.nvimtree").config() + end, + } + + use { + "lewis6991/gitsigns.nvim", + + config = function() + require("cfg.gitsigns").config() + end, + event = "BufRead", + } + + -- whichkey + use { "folke/which-key.nvim" } + + -- Autopairs + use { + "windwp/nvim-autopairs", + event = "InsertEnter", + after = { "telescope.nvim" }, + config = function() + require "cfg.autopairs" + end, + } + + -- Comments + use { + "terrortylor/nvim-comment", + cmd = "CommentToggle", + config = function() + require("nvim_comment").setup() + end, + } + + -- Color + use { "christianchiarulli/nvcode-color-schemes.vim", opt = true } + + -- Icons + use { "kyazdani42/nvim-web-devicons" } + + -- Status Line and Bufferline + use { "glepnir/galaxyline.nvim" } + + use { + "romgrk/barbar.nvim", + config = function() + vim.api.nvim_set_keymap("n", "<TAB>", ":BufferNext<CR>", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "<S-TAB>", ":BufferPrevious<CR>", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "<S-x>", ":BufferClose<CR>", { noremap = true, silent = true }) + end, + -- event = "BufRead", + } + + -- Builtins, these do not load by default + + -- Dashboard + use { + "ChristianChiarulli/dashboard-nvim", + event = "BufWinEnter", + cmd = { "Dashboard", "DashboardNewFile", "DashboardJumpMarks" }, + config = function() + require("cfg.dashboard").config() + end, + disable = not O.plugin.dashboard.active, + opt = true, + } + -- Zen Mode + use { + "folke/zen-mode.nvim", + cmd = "ZenMode", + -- event = "BufRead", + config = function() + require("cfg.zen").config() + end, + disable = not O.plugin.zen.active, + } + + use { + "norcalli/nvim-colorizer.lua", + event = "BufRead", + config = function() + require("colorizer").setup() + vim.cmd "ColorizerReloadAllBuffers" + end, + disable = not O.plugin.colorizer.active, + } + + -- comments in context + use { + "JoosepAlviste/nvim-ts-context-commentstring", + event = "BufRead", + disable = not O.plugin.ts_context_commentstring.active, + } + + -- Symbol Outline + use { + "simrat39/symbols-outline.nvim", + cmd = "SymbolsOutline", + disable = not O.plugin.symbol_outline.active, + } + -- diagnostics + use { + "folke/trouble.nvim", + cmd = "TroubleToggle", + disable = not O.plugin.trouble.active, + } + + -- Use fzy for telescope + use { + "nvim-telescope/telescope-fzy-native.nvim", + event = "BufRead", + disable = not O.plugin.telescope_fzy.active, + } + + -- Use project for telescope + use { + "nvim-telescope/telescope-project.nvim", + event = "BufRead", + setup = function () vim.cmd[[packadd telescope.nvim]] end, + disable = not O.plugin.telescope_project.active, + } + + -- Sane gx for netrw_gx bug + use { + "felipec/vim-sanegx", + event = "BufRead", + disable = not O.plugin.sanegx.active, + } + + -- Diffview + use { + "sindrets/diffview.nvim", + event = "BufRead", + disable = not O.plugin.diffview.active, + } + + -- Lush Create Color Schemes + use { + "rktjmp/lush.nvim", + -- cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"}, + disable = not O.plugin.lush.active, + } + + -- LANGUAGE SPECIFIC GOES HERE + use { + "lervag/vimtex", + ft = "tex", + config = function() + require "cfg.vimtex" + end, + } + + -- Rust tools + -- TODO: use lazy loading maybe? + use { + "simrat39/rust-tools.nvim", + disable = not O.lang.rust.rust_tools.active, + } + + -- Elixir + use { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } } + + -- Javascript / Typescript + use { + "jose-elias-alvarez/nvim-lsp-ts-utils", + ft = { + "javascript", + "javascriptreact", + "javascript.jsx", + "typescript", + "typescriptreact", + "typescript.tsx", + }, + } + + -- Autotags <div>|</div> + use { + "windwp/nvim-ts-autotag", + event = "InsertEnter", + disable = not O.plugin.ts_autotag.active, + } + + -- Custom semantic text objects + use { + "nvim-treesitter/nvim-treesitter-textobjects", + disable = not O.plugin.ts_textobjects.active, + } + + -- Smart text objects + use { + "RRethy/nvim-treesitter-textsubjects", + disable = not O.plugin.ts_textsubjects.active, + } + + -- Text objects using hint labels + use { + "mfussenegger/nvim-ts-hint-textobject", + event = "BufRead", + disable = not O.plugin.ts_hintobjects.active, + } + + -- vim rooter for projects + use { + "airblade/vim-rooter", + event = "BufRead", + disable = not O.plugin.vim_rooter.active, + } + + -- hop + use { + "phaazon/hop.nvim", + disable = not O.plugin.hop.active, + } + + for _, plugin in pairs(O.custom_plugins) do + packer.use(plugin) end -) +end) diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index 0e38be4..371cdb0 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -1,40 +1,60 @@ -vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object" -vim.cmd('set shortmess+=c') -- Don't pass messages to |ins-completion-menu|. -vim.cmd('set inccommand=split') -- Make substitution work in realtime -vim.o.hidden = O.hidden_files -- Required to keep multiple buffers open multiple buffers -vim.o.title = true -TERMINAL = vim.fn.expand('$TERMINAL') -vim.cmd('let &titleold="'..TERMINAL..'"') -vim.o.titlestring="%<%F%=%l/%L - nvim" -vim.wo.wrap = O.wrap_lines -- Display long lines as just one line -vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys -vim.cmd('syntax on') -- syntax highlighting -vim.o.pumheight = 10 -- Makes popup menu smaller -vim.o.fileencoding = "utf-8" -- The encoding written to file -vim.o.cmdheight = 2 -- More space for displaying messages -vim.cmd('set colorcolumn=99999') -- fix indentline for now -vim.o.mouse = "a" -- Enable your mouse -vim.o.splitbelow = true -- Horizontal splits will automatically be below -vim.o.termguicolors = true -- set term gui colors most terminals support this -vim.o.splitright = true -- Vertical splits will automatically be to the right --- vim.o.t_Co = "256" -- Support 256 colors -vim.o.conceallevel = 0 -- So that I can see `` in markdown files -vim.cmd('set ts=4') -- Insert 2 spaces for a tab -vim.cmd('set sw=4') -- Change the number of space characters inserted for indentation -vim.cmd('set expandtab') -- Converts tabs to spaces -vim.bo.smartindent = true -- Makes indenting smart -vim.wo.number = O.number -- set numbered lines -vim.wo.relativenumber = O.relative_number -- set relative number -vim.wo.cursorline = true -- Enable highlighting of the current line -vim.o.showtabline = 2 -- Always show tabs -vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore -vim.o.backup = false -- This is recommended by coc -vim.o.writebackup = false -- This is recommended by coc -vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time -vim.o.updatetime = 300 -- Faster completion -vim.o.timeoutlen = O.timeoutlen -- By default timeoutlen is 1000 ms -vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else -vim.g.nvim_tree_disable_netrw = O.nvim_tree_disable_netrw -- enable netrw for remote gx gf support (must be set before plugin's packadd) -vim.g.loaded_netrwPlugin = 1 -- needed for netrw gx command to open remote links in browser -vim.cmd('filetype plugin on') -- filetype detection -vim.o.guifont = "SpaceMono Nerd Font:h17" +--- HELPERS --- + +local cmd = vim.cmd +local opt = vim.opt + +--- VIM ONLY COMMANDS --- + +cmd "filetype plugin on" +cmd('let &titleold="' .. TERMINAL .. '"') +cmd "set inccommand=split" +cmd "set iskeyword+=-" +cmd "set whichwrap+=<,>,[,],h,l" +if O.transparent_window then + cmd "au ColorScheme * hi Normal ctermbg=none guibg=none" + cmd "au ColorScheme * hi SignColumn ctermbg=none guibg=none" +end + +--- COLORSCHEME --- + +vim.g.colors_name = O.colorscheme + +--- SETTINGS --- + +opt.backup = false -- creates a backup file +opt.clipboard = "unnamedplus" -- allows neovim to access the system clipboard +opt.cmdheight = 2 -- more space in the neovim command line for displaying messages +opt.colorcolumn = "99999" -- fix indentline for now +opt.completeopt = { "menuone", "noselect" } +opt.conceallevel = 0 -- so that `` is visible in markdown files +opt.fileencoding = "utf-8" -- the encoding written to a file +opt.guifont = "monospace:h17" -- the font used in graphical neovim applications +opt.hidden = O.hidden_files -- required to keep multiple buffers and open multiple buffers +opt.hlsearch = O.hl_search -- highlight all matches on previous search pattern +opt.ignorecase = O.ignore_case -- ignore case in search patterns +opt.mouse = "a" -- allow the mouse to be used in neovim +opt.pumheight = 10 -- pop up menu height +opt.showmode = false -- we don't need to see things like -- INSERT -- anymore +opt.showtabline = 2 -- always show tabs +opt.smartcase = O.smart_case -- smart case +opt.smartindent = true -- make indenting smarter again +opt.splitbelow = true -- force all horizontal splits to go below current window +opt.splitright = true -- force all vertical splits to go to the right of current window +opt.swapfile = false -- creates a swapfile +opt.termguicolors = true -- set term gui colors (most terminals support this) +opt.timeoutlen = O.timeoutlen -- time to wait for a mapped sequence to complete (in milliseconds) +opt.title = true -- set the title of window to the value of the titlestring +opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to +opt.undodir = CACHE_PATH .. "/undo" -- set an undo directory +opt.undofile = true -- enable persisten undo +opt.updatetime = 300 -- faster completion +opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited +opt.expandtab = true -- convert tabs to spaces +opt.shiftwidth = 4 -- the number of spaces inserted for each indentation +opt.shortmess:append "c" +opt.tabstop = 4 -- insert 4 spaces for a tab +opt.cursorline = O.cursorline -- highlight the current line +opt.number = O.number -- set numbered lines +opt.relativenumber = O.relative_number -- set relative numbered lines +opt.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time +opt.wrap = O.wrap_lines -- display lines as one long line diff --git a/.config/nvim/vim-script/functions.vim b/.config/nvim/vim-script/functions.vim deleted file mode 100644 index d5f14f6..0000000 --- a/.config/nvim/vim-script/functions.vim +++ /dev/null @@ -1,36 +0,0 @@ -command! LspCodeAction lua require '_utils'.code_action() -command! LspDeclaration lua require '_utils'.declaration() -command! LspDefinition lua require '_utils'.definition() -command! LspDocumentSymbol lua require '_utils'.document_symbol() -command! LspFormatting lua require '_utils'.formatting() -command! LspFormattingSync lua require '_utils'.formatting_sync() -command! LspHover lua require '_utils'.hover() -command! LspImplementation lua require '_utils'.implementation() -command! LspRangeCodeAction lua require '_utils'.range_code_action() -command! LspRangeFormatting lua require '_utils'.range_formatting() -command! LspReferences lua require '_utils'.references() -command! LspRename lua require '_utils'.rename() -command! LspTypeDefinition lua require '_utils'.type_definition() -command! LspWorkspaceSymbol lua require '_utils'.workspace_symbol() -command! LspGotoNext lua require '_utils'.goto_next() -command! LspGotoPrev lua require '_utils'.goto_prev() -command! LspShowLineDianostics lua require '_utils'.show_line_diagnostics() -command! NextHunk lua require '_utils'.next_hunk() -command! PrevHunk lua require '_utils'.prev_hunk() -command! StageHunk lua require '_utils'.stage_hunk() -command! UndoStageHunk lua require '_utils'.undo_stage_hunk() -command! ResetHunk lua require '_utils'.reset_hunk() -command! ResetBuffer lua require '_utils'.reset_buffer() -command! PreviewHunk lua require '_utils'.preview_hunk() -command! BlameLine lua require '_utils'.blame_line() -command! W noa w - -" Debugging -command! DebugToggleBreakpoint lua require'dap'.toggle_breakpoint() -command! DebugStart lua require'dap'.continue() -command! DebugContinue lua require'dap'.continue() -command! DebugStepOver lua require'dap'.step_over() -command! DebugStepOut lua require'dap'.step_out() -command! DebugStepInto lua require'dap'.step_into() -command! DebugToggleRepl lua require'dap'.repl.toggle() -command! DebugGetSession lua require'dap'.session() |