diff options
| author | Christian Chiarulli <[email protected]> | 2021-07-13 21:13:55 -0400 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-13 21:13:55 -0400 | 
| commit | a097fa4c04e6db34bb409e0dea302c20629da8ec (patch) | |
| tree | fb1c5bdd14cac82a363ea6c25b03a475050305f2 | |
| parent | 04f9f53914a7dd999117ed73c5fa0ab3b0dc95e4 (diff) | |
LunarVim 0.4.8 (#919)0.4.8
80 files changed, 2139 insertions, 1972 deletions
| diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..7b3a25f3 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,32 @@ +<!-- This won't be rendered! +[CHECKLIST] +I prefixed the title with one of the following tags: + - [Feature]: For feature addition / improvements + - [Bugfix]: When fixing a functionality + - [Refactor]: When moving code without adding any functionality + - [Doc]: On documentation updates + +- I read the contributing guide (CONTRIBUTING.md) +- My code follows the style guidelines of this project +- I have performed a self-review of my code +- I have commented on my code, particularly in hard-to-understand areas +- I have made corresponding changes to the documentation +- My changes generate no new warnings +--> +# Description + +Please include a summary of the change and which issue is fixed. \ +List any dependencies that are required for this change. + +Fixes #(issue) + +## How Has This Been Tested? + +Please describe the tests that you ran to verify your changes. \ +Provide instructions so we can reproduce. \ +Please also list any relevant details for your test configuration. + +- Run command `:mycommand` +- Check logs +- ... + @@ -20,4 +20,5 @@ spell/  nv-settings.lua  lv-settings.lua  .stylua.toml +lua/lv-user/  lua/lv-user-config/ @@ -28,6 +28,21 @@ Make sure you have the newest version of Neovim (0.5).  bash <(curl -s https://raw.githubusercontent.com/ChristianChiarulli/lunarvim/master/utils/installer/install.sh)  ``` +If you help to develop Lunarvim, you can install a specific branch branch directly +``` bash +LVBRANCH=rolling bash <(curl -s https://raw.githubusercontent.com/ChristianChiarulli/lunarvim/rolling/utils/installer/install.sh) +``` + +If your installation is stuck on `Ok to remove? [y/N]`, it means there are some leftovers, \ +you can run the script with `--overwrite` but be warned this will remove the following folder: +- `~/.config/nvim` +- `~/.cache/nvim` +- `~/.local/share/nvim/site/pack/packer` +```bash +curl -s https://raw.githubusercontent.com/ChristianChiarulli/lunarvim/rolling/utils/installer/install.sh| LVBRANCH=rolling bash -s -- --overwrite +``` + +  ## Installing LSP for your language  Just enter `:LspInstall` followed by `<TAB>` to see your options @@ -45,18 +60,16 @@ Example:  -- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT  -- general -O.auto_complete = true -O.relative_number = false +-- O.default_options.wrap = true -- wrap long lines +O.completion.autocomplete = true +O.default_options.relativenumber = true  O.colorscheme = 'spacegray' -O.timeoutlen = 100 +O.default_options.timeoutlen = 100  O.leader_key = ' '  -- After changing plugin config it is recommended to run :PackerCompile -O.plugin.colorizer.active = true  O.plugin.dashboard.active = true  O.plugin.floatterm.active = true -O.plugin.symbol_outline = true -O.plugin.trouble.active = true  O.plugin.zen.active = true  -- if you don't want all the parsers change this to a table of the ones you want @@ -74,18 +87,29 @@ O.lang.tsserver.linter = nil  O.lang.tsserver.autoformat = true  -- python --- O.python.linter = 'flake8'  O.lang.python.isort = true  O.lang.python.diagnostics.virtual_text = true  O.lang.python.analysis.use_library_code_types = true +-- to change default formatter from yapf to black +-- O.lang.python.formatter.exe = "black" +-- O.lang.python.formatter.args = {"-"} + +-- go +-- to change default formatter from gofmt to goimports +-- O.lang.formatter.go.exe = "goimports"  -- Additional Plugins  -- O.user_plugins = { ---     {"folke/tokyonight.nvim"}, { ---         "ray-x/lsp_signature.nvim", ---         config = function() require"lsp_signature".on_attach() end, ---         event = "InsertEnter" ---     }  +--   {"folke/tokyonight.nvim"}, +--   { +--     "ray-x/lsp_signature.nvim", +--     config = function() +--       require"lsp_signature".on_attach() +--     end, +--     event = "InsertEnter" +--   }, +-- } +  -- }  -- Autocommands (https://neovim.io/doc/user/autocmd.html) @@ -99,6 +123,9 @@ O.lang.python.analysis.use_library_code_types = true  --     b = { "<cmd>echo 'second custom command'<cr>", "Description for b" },  --   },  -- } + +-- To link your init.vim (until you find Lua replacements) +-- vim.cmd('source ' .. CONFIG_PATH .. '/lua/lv-user/init.vim')  ```  ## Updating LunarVim @@ -119,6 +146,29 @@ cd ~/.config/nvim && git pull  To update Neovim use your package manager +## Project Goals + +1. Provide basic functionalities required from an IDE +    - LSP +    - Formatting/Linting +    - Debugging +    - Treesitter +    - Colorschemes +2. Be as fast and lean as possible  +    - Lazy loading +    - Not a single extra plugin +    - User configurable lang/feature enable/disable +3. Provide a [simple and easy](https://github.com/LunarVim/LunarVimCommunity) way for users to share their own configuration or use others.  +4. Hot reload of configurations +    - Hot install of lsp/treesitter/formatter required upon openning a filetype for the first time +5. Provide a stable & maintainable error free configuration layer over neovim  +    - With the help of the community behind it +    - Github workflow testing +    - Freezing plugin versions +6. Provide detailed documentation +    - Video series on how to configure LunarVim as an IDE for each lang +7. Valhalla +  ## Resources  - [YouTube](https://www.youtube.com/channel/UCS97tchJDq17Qms3cux8wcA) @@ -134,8 +184,11 @@ To update Neovim use your package manager  > "I have the processing power of a potato with 4 gb of ram and LunarVim runs perfectly."  > - @juanCortelezzi, LunarVim user. -<div align="center"> +> "My minimal config with a good amount less code than LunarVim loads 40ms slower. Time to switch." +> - @mvllow, Potential LunarVim user. + +<div align="center" id="madewithlua"> -[]() +[](#madewithlua)  </div> diff --git a/colors/spacegray.vim b/colors/spacegray.vim index be065c28..8d075ee1 100644 --- a/colors/spacegray.vim +++ b/colors/spacegray.vim @@ -1,259 +1,2 @@ -"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 +" Author: Christian Chiarulli <[email protected]> +lua require("spacegray")
\ No newline at end of file diff --git a/ftplugin/c.lua b/ftplugin/c.lua index f9064213..8beaae5d 100644 --- a/ftplugin/c.lua +++ b/ftplugin/c.lua @@ -1,3 +1,19 @@ +O.formatters.filetype["c"] = { +  function() +    return { +      exe = O.lang.c.formatter.exe, +      args = O.lang.c.formatter.args, +      stdin = not (O.lang.c.formatter.stdin ~= nil), +    } +  end, +} +O.formatters.filetype["cpp"] = O.formatters.filetype["c"] + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +} +  if require("lv-utils").check_lsp_client_active "clangd" then    return  end diff --git a/ftplugin/css.lua b/ftplugin/css.lua index ff8c1004..9cd7cc71 100644 --- a/ftplugin/css.lua +++ b/ftplugin/css.lua @@ -1,4 +1,6 @@  if not require("lv-utils").check_lsp_client_active "cssls" then +  local capabilities = vim.lsp.protocol.make_client_capabilities() +  capabilities.textDocument.completion.completionItem.snippetSupport = true    -- npm install -g vscode-css-languageserver-bin    require("lspconfig").cssls.setup {      cmd = { @@ -7,6 +9,7 @@ if not require("lv-utils").check_lsp_client_active "cssls" then        "--stdio",      },      on_attach = require("lsp").common_on_attach, +    capabilities = capabilities,    }  end diff --git a/ftplugin/dart.lua b/ftplugin/dart.lua index a0de0fd5..f9b68e9d 100644 --- a/ftplugin/dart.lua +++ b/ftplugin/dart.lua @@ -1,3 +1,17 @@ +O.formatters.filetype["dart"] = { +  function() +    return { +      exe = O.lang.dart.formatter.exe, +      args = O.lang.dart.formatter.args, +      stdin = not (O.lang.dart.formatter.stdin ~= nil), +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +}  if require("lv-utils").check_lsp_client_active "dartls" then    return  end diff --git a/ftplugin/euphoria3.lua b/ftplugin/euphoria3.lua index 7c3a1da3..b59a265a 100644 --- a/ftplugin/euphoria3.lua +++ b/ftplugin/euphoria3.lua @@ -2,7 +2,7 @@ if require("lv-utils").check_lsp_client_active "elixirls" then    return  end --- TODO Remove this at some point +-- TODO: Remove this at some point  require("lspconfig").elixirls.setup {    cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh" },  } diff --git a/ftplugin/go.lua b/ftplugin/go.lua index fbad5a2b..47de932f 100644 --- a/ftplugin/go.lua +++ b/ftplugin/go.lua @@ -1,3 +1,18 @@ +O.formatters.filetype["go"] = { +  function() +    return { +      exe = O.lang.go.formatter.exe, +      args = O.lang.go.formatter.args, +      stdin = not (O.lang.go.formatter.stdin ~= nil), +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +} +  if not require("lv-utils").check_lsp_client_active "gopls" then    require("lspconfig").gopls.setup {      cmd = { DATA_PATH .. "/lspinstall/go/gopls" }, diff --git a/ftplugin/java.lua b/ftplugin/java.lua index bba968b9..7db90f0e 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -1,3 +1,28 @@ +vim.cmd "let proj = FindRootDirectory()" +local root_dir = vim.api.nvim_get_var "proj" + +-- use the global prettier if you didn't find the local one +local prettier_instance = root_dir .. "/node_modules/.bin/prettier" +if vim.fn.executable(prettier_instance) ~= 1 then +  prettier_instance = O.lang.tsserver.formatter.exe +end + +O.formatters.filetype["java"] = { +  function() +    return { +      exe = prettier_instance, +      -- TODO: allow user to override this +      args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0) }, +      stdin = true, +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +} +  if require("lv-utils").check_lsp_client_active "jdtls" then    return  end @@ -18,11 +43,24 @@ if O.lang.java.java_tools.active then      cmd = { JAVA_LS_EXECUTABLE, WORKSPACE_PATH .. vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") },    } +  vim.api.nvim_set_keymap( +    "n", +    "<leader>la", +    ":lua require('jdtls').code_action()<CR>", +    { noremap = true, silent = true } +  ) +  vim.api.nvim_set_keymap( +    "n", +    "<leader>lR", +    ":lua require('jdtls').code_action(false, 'refactor')<CR>", +    { noremap = true, silent = true } +  ) +    vim.cmd "command! -buffer JdtCompile lua require('jdtls').compile()"    vim.cmd "command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()" -  vim.cmd "command! -buffer JdtJol lua require('jdtls').jol()" +  -- vim.cmd "command! -buffer JdtJol lua require('jdtls').jol()"    vim.cmd "command! -buffer JdtBytecode lua require('jdtls').javap()" -  vim.cmd "command! -buffer JdtJshell lua require('jdtls').jshell()" +  -- vim.cmd "command! -buffer JdtJshell lua require('jdtls').jshell()"  else    local util = require "lspconfig/util" @@ -48,7 +86,7 @@ end  --     init_options = {bundles = bundles}  -- }) --- TODO setup autoformat stuff later +-- TODO: setup autoformat stuff later  -- _java = {  --     -- {'FileType', 'java', 'luafile '..CONFIG_PATH..'/lua/lsp/java-ls.lua'},  --     { diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua index f74b54e9..fc59ab68 100644 --- a/ftplugin/javascript.lua +++ b/ftplugin/javascript.lua @@ -1,3 +1 @@  require "lsp.tsserver-ls" - -vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/json.lua b/ftplugin/json.lua index c7246e76..cb73995c 100644 --- a/ftplugin/json.lua +++ b/ftplugin/json.lua @@ -1,3 +1,17 @@ +O.formatters.filetype["json"] = { +  function() +    return { +      exe = O.lang.json.formatter.exe, +      args = O.lang.json.formatter.args, +      stdin = not (O.lang.json.formatter.stdin ~= nil), +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +}  if require("lv-utils").check_lsp_client_active "jsonls" then    return  end diff --git a/ftplugin/less.lua b/ftplugin/less.lua new file mode 120000 index 00000000..6b9e5a8d --- /dev/null +++ b/ftplugin/less.lua @@ -0,0 +1 @@ +css.lua
\ No newline at end of file diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua index 2ffaa472..eb7b9944 100644 --- a/ftplugin/lua.lua +++ b/ftplugin/lua.lua @@ -1,3 +1,17 @@ +O.formatters.filetype["lua"] = { +  function() +    return { +      exe = O.lang.lua.formatter.exe, +      args = O.lang.lua.formatter.args, +      stdin = not (O.lang.lua.formatter.stdin ~= nil), +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +}  if not require("lv-utils").check_lsp_client_active "sumneko_lua" then    -- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)    local sumneko_root_path = DATA_PATH .. "/lspinstall/lua" @@ -31,17 +45,3 @@ if not require("lv-utils").check_lsp_client_active "sumneko_lua" then      },    }  end - -if O.lang.lua.autoformat then -  require("lv-utils").define_augroups { -    _lua_autoformat = { -      { -        "BufWritePre", -        "*.lua", -        "lua vim.lsp.buf.formatting_sync(nil, 1000)", -      }, -    }, -  } -end - -vim.cmd "setl ts=2 sw=2" diff --git a/ftplugin/php.lua b/ftplugin/php.lua index 713ef44e..054dff79 100644 --- a/ftplugin/php.lua +++ b/ftplugin/php.lua @@ -1,3 +1,17 @@ +O.formatters.filetype["php"] = { +  function() +    return { +      exe = O.lang.php.formatter.exe, +      args = O.lang.php.formatter.args, +      stdin = not (O.lang.php.formatter.stdin ~= nil), +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +}  if require("lv-utils").check_lsp_client_active "intelephense" then    return  end diff --git a/ftplugin/python.lua b/ftplugin/python.lua index 0cf7c1a7..d2ade7e2 100644 --- a/ftplugin/python.lua +++ b/ftplugin/python.lua @@ -1,6 +1,21 @@ +O.formatters.filetype["python"] = { +  function() +    return { +      exe = O.lang.python.formatter.exe, +      args = O.lang.python.formatter.args, +      stdin = not (O.lang.python.formatter.stdin ~= nil), +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +} +  local python_arguments = {} --- TODO replace with path argument +-- TODO: replace with path argument  local flake8 = {    LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -",    lintStdin = true, @@ -25,6 +40,7 @@ if not require("lv-utils").check_lsp_client_active "efm" then      -- init_options = {initializationOptions},      cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },      init_options = { documentFormatting = true, codeAction = false }, +    root_dir = require("lspconfig").util.root_pattern(".git/", "requirements.txt"),      filetypes = { "python" },      settings = {        rootMarkers = { ".git/", "requirements.txt" }, @@ -63,7 +79,7 @@ if not require("lv-utils").check_lsp_client_active "pyright" then    }  end -if O.plugin.debug.active and O.plugin.dap_install.active then +if O.plugin.dap.active then    local dap_install = require "dap-install"    dap_install.config("python_dbg", {})  end diff --git a/ftplugin/ruby.lua b/ftplugin/ruby.lua index 7f86ffb9..ff7e7c8b 100644 --- a/ftplugin/ruby.lua +++ b/ftplugin/ruby.lua @@ -1,3 +1,17 @@ +O.formatters.filetype["ruby"] = { +  function() +    return { +      exe = O.lang.ruby.formatter.exe, +      args = O.lang.ruby.formatter.args, +      stdin = not (O.lang.ruby.formatter.stdin ~= nil), +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +}  if require("lv-utils").check_lsp_client_active "solargraph" then    return  end diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index 4fb47582..dd34483e 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -1,3 +1,17 @@ +O.formatters.filetype["rust"] = { +  function() +    return { +      exe = O.lang.rust.formatter.exe, +      args = O.lang.rust.formatter.args, +      stdin = not (O.lang.rust.formatter.stdin ~= nil), +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +}  if require("lv-utils").check_lsp_client_active "rust_analyzer" then    return  end @@ -81,11 +95,11 @@ else      cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },      on_attach = require("lsp").common_on_attach,      filetypes = { "rust" }, -    root_dir = require("lspconfig.util").root_pattern("Cargo.toml", "rust-project.json"), +    root_dir = require("lspconfig.util").root_pattern("Carrust.toml", "rust-project.json"),    }  end --- TODO fix these mappings +-- TODO: fix these mappings  vim.api.nvim_exec(    [[      autocmd Filetype rust nnoremap <leader>lm <Cmd>RustExpandMacro<CR> diff --git a/ftplugin/sass.lua b/ftplugin/sass.lua new file mode 120000 index 00000000..6b9e5a8d --- /dev/null +++ b/ftplugin/sass.lua @@ -0,0 +1 @@ +css.lua
\ No newline at end of file diff --git a/ftplugin/scss.lua b/ftplugin/scss.lua new file mode 120000 index 00000000..6b9e5a8d --- /dev/null +++ b/ftplugin/scss.lua @@ -0,0 +1 @@ +css.lua
\ No newline at end of file diff --git a/ftplugin/sh.lua b/ftplugin/sh.lua index c299f2de..54002f19 100644 --- a/ftplugin/sh.lua +++ b/ftplugin/sh.lua @@ -1,3 +1,17 @@ +O.formatters.filetype["sh"] = { +  function() +    return { +      exe = O.lang.sh.formatter.exe, +      args = O.lang.sh.formatter.args, +      stdin = not (O.lang.sh.formatter.stdin ~= nil), +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +}  if not require("lv-utils").check_lsp_client_active "bashls" then    -- npm i -g bash-language-server    require("lspconfig").bashls.setup { @@ -26,6 +40,7 @@ if not require("lv-utils").check_lsp_client_active "efm" then      -- init_options = {initializationOptions},      cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },      init_options = { documentFormatting = true, codeAction = false }, +    root_dir = require("lspconfig").util.root_pattern ".git/",      filetypes = { "sh" },      settings = {        rootMarkers = { ".git/" }, diff --git a/ftplugin/tex.lua b/ftplugin/tex.lua index 7ad35000..c5748189 100644 --- a/ftplugin/tex.lua +++ b/ftplugin/tex.lua @@ -6,3 +6,33 @@ require("lspconfig").texlab.setup {    cmd = { DATA_PATH .. "/lspinstall/latex/texlab" },    on_attach = require("lsp").common_on_attach,  } + +vim.g.vimtex_compiler_method = "latexmk" +vim.g.vimtex_view_method = "zathura" +vim.g.vimtex_fold_enabled = 0 +vim.g.vimtex_quickfix_ignore_filters = O.lang.latex.ignore_errors + +O.plugin.which_key.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" }, +} + +-- 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 +) +if O.lang.latex.auto_save then +  vim.api.nvim_exec([[au FocusLost * :wa]], false) +end diff --git a/ftplugin/tf.lua b/ftplugin/tf.lua index 7291cbd8..a328f7c2 100644 --- a/ftplugin/tf.lua +++ b/ftplugin/tf.lua @@ -1,3 +1,19 @@ +O.formatters.filetype["hcl"] = { +  function() +    return { +      exe = O.lang.terraform.formatter.exe, +      args = O.lang.terraform.formatter.args, +      stdin = not (O.lang.terraform.formatter.stdin ~= nil), +    } +  end, +} +O.formatters.filetype["tf"] = O.formatters.filetype["hcl"] + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +} +  if require("lv-utils").check_lsp_client_active "terraformls" then    return  end diff --git a/ftplugin/yaml.lua b/ftplugin/yaml.lua index 219022f5..f1dfc5dc 100644 --- a/ftplugin/yaml.lua +++ b/ftplugin/yaml.lua @@ -1,3 +1,17 @@ +O.formatters.filetype["yaml"] = { +  function() +    return { +      exe = O.lang.yaml.formatter.exe, +      args = O.lang.yaml.formatter.args, +      stdin = not (O.lang.yaml.formatter.stdin ~= nil), +    } +  end, +} + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +}  if require("lv-utils").check_lsp_client_active "yamlls" then    return  end diff --git a/ftplugin/zsh.lua b/ftplugin/zsh.lua index 49cd103d..750e8ede 100644 --- a/ftplugin/zsh.lua +++ b/ftplugin/zsh.lua @@ -24,6 +24,7 @@ if not require("lv-utils").check_lsp_client_active "efm" then      -- init_options = {initializationOptions},      cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },      init_options = { documentFormatting = true, codeAction = false }, +    root_dir = require("lspconfig").util.root_pattern ".git/",      filetypes = { "zsh" },      settings = {        rootMarkers = { ".git/" }, @@ -1,15 +1,15 @@  require "default-config"  require "keymappings" -vim.cmd("luafile " .. CONFIG_PATH .. "/lv-config.lua") -require "settings" +local status_ok, _ = pcall(vim.cmd, "luafile " .. CONFIG_PATH .. "/lv-config.lua") +if not status_ok then +  print "something is wrong with your lv-config" +end  require "plugins"  vim.g.colors_name = O.colorscheme -- Colorscheme must get called after plugins are loaded or it will break new installs. +require "settings"  require "lv-utils" -require "lv-treesitter" -if O.plugin.dashboard.active then -  require("lv-dashboard").config() -end --- TODO these gues need to be in language files + +-- TODO: these guys need to be in language files  -- require "lsp"  -- if O.lang.emmet.active then  --   require "lsp.emmet-ls" diff --git a/lua/lv-autopairs/init.lua b/lua/core/autopairs.lua index b8dad5f3..b8dad5f3 100644 --- a/lua/lv-autopairs/init.lua +++ b/lua/core/autopairs.lua diff --git a/lua/lv-barbar/init.lua b/lua/core/bufferline.lua index 2b5cf97d..d4e4b4fe 100644 --- a/lua/lv-barbar/init.lua +++ b/lua/core/bufferline.lua @@ -1,10 +1,9 @@ -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 })  vim.api.nvim_set_keymap("n", "<S-l>", ":BufferNext<CR>", { noremap = true, silent = true })  vim.api.nvim_set_keymap("n", "<S-h>", ":BufferPrevious<CR>", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", { noremap = true, silent = true }) -O.user_which_key["b"] = { +O.plugin.which_key.mappings["b"] = {    name = "Buffers",    j = { "<cmd>BufferPick<cr>", "jump to buffer" },    f = { "<cmd>Telescope buffers<cr>", "Find buffer" }, diff --git a/lua/lv-compe/init.lua b/lua/core/compe.lua index f42e8ad3..c8152ad1 100644 --- a/lua/lv-compe/init.lua +++ b/lua/core/compe.lua @@ -1,14 +1,7 @@ ---if not package.loaded['compe'] then ---   return --- end -  local M = {} - -vim.g.vsnip_snippet_dir = O.vnsip_dir -  M.config = function() -  local opt = { -    enabled = O.auto_complete, +  O.completion = { +    enabled = true,      autocomplete = true,      debug = false,      min_length = 1, @@ -27,24 +20,28 @@ M.config = function()        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 = "  "}, +      vim_dadbod_completion = false, +      snippets_nvim = false, +      ultisnips = false, +      treesitter = false,        emoji = { kind = " ﲃ  (Emoji)", filetypes = { "markdown", "text" } },        -- for emoji press : (idk if that in compe tho)      },    } +end + +M.setup = function() +  vim.g.vsnip_snippet_dir = O.vsnip_dir +    local status_ok, compe = pcall(require, "compe")    if not status_ok then      return    end -  compe.setup(opt) +  compe.setup(O.completion)    local t = function(str)      return vim.api.nvim_replace_termcodes(str, true, true, true) diff --git a/lua/core/dap.lua b/lua/core/dap.lua new file mode 100644 index 00000000..bc76e221 --- /dev/null +++ b/lua/core/dap.lua @@ -0,0 +1,41 @@ +local M = {} +M.config = function() +  O.plugin.dap = { +    active = false, +    breakpoint = { +      text = "", +      texthl = "LspDiagnosticsSignError", +      linehl = "", +      numhl = "", +    }, +  } +end + +M.setup = function() +  local status_ok, dap = pcall(require, "dap") +  if not status_ok then +    return +  end + +  vim.fn.sign_define("DapBreakpoint", O.plugin.dap.breakpoint) +  dap.defaults.fallback.terminal_win_cmd = "50vsplit new" + +  O.user_which_key["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" }, +  } +end + +return M diff --git a/lua/core/dashboard.lua b/lua/core/dashboard.lua new file mode 100644 index 00000000..e58b6f06 --- /dev/null +++ b/lua/core/dashboard.lua @@ -0,0 +1,100 @@ +local M = {} +M.config = function() +  O.plugin.dashboard = { +    active = false, +    search_handler = "telescope", +    custom_header = { +      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⣶⣾⠿⠿⠟⠛⠛⠛⠛⠿⠿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⡿⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒⠂⠉⠉⠉⠉⢩⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⢰⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠠⡀⠀⠀⢀⣾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⢀⣸⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡧⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠈⠁⠒⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣇⠀⠀⠀⠀⠀⠀⠉⠢⠤⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡟⠈⠑⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠑⠒⠤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡇⠀⠀⢀⣣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠒⠢⠤⠄⣀⣀⠀⠀⠀⢠⣿⡟⠀⠀⠀⣺⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", +      "⠀⣿⠇⠀⠀⠀⠀⠀⣤⡄⠀⠀⢠⣤⡄⠀⢨⣭⣠⣤⣤⣤⡀⠀⠀⢀⣤⣤⣤⣤⡄⠀⠀⠀⣤⣄⣤⣤⣤⠀⠀⣿⣯⠉⠉⣿⡟⠀⠈⢩⣭⣤⣤⠀⠀⠀⠀⣠⣤⣤⣤⣄⣤⣤", +      "⢠⣿⠀⠀⠀⠀⠀⠀⣿⠃⠀⠀⣸⣿⠁⠀⣿⣿⠉⠀⠈⣿⡇⠀⠀⠛⠋⠀⠀⢹⣿⠀⠀⠀⣿⠏⠀⠸⠿⠃⠀⣿⣿⠀⣰⡟⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡟⢸⣿⡇⢀⣿", +      "⣸⡇⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⣿⡟⠀⢠⣿⡇⠀⠀⢰⣿⡇⠀⣰⣾⠟⠛⠛⣻⡇⠀⠀⢸⡿⠀⠀⠀⠀⠀⠀⢻⣿⢰⣿⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⢸⣿⠇⢸⣿⠀⢸⡏", +      "⣿⣧⣤⣤⣤⡄⠀⠘⣿⣤⣤⡤⣿⠇⠀⢸⣿⠁⠀⠀⣼⣿⠀⠀⢿⣿⣤⣤⠔⣿⠃⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⢸⣿⣿⠋⠀⠀⠀⢠⣤⣤⣿⣥⣤⡄⠀⣼⣿⠀⣸⡏⠀⣿⠃", +      "⠉⠉⠉⠉⠉⠁⠀⠀⠈⠉⠉⠀⠉⠀⠀⠈⠉⠀⠀⠀⠉⠉⠀⠀⠀⠉⠉⠁⠈⠉⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠁⠀⠉⠁⠀⠉⠁⠀⠉⠀", +    }, + +    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", +      -- }, +      c = { +        description = { "  Find Word          " }, +        command = "Telescope live_grep", +      }, +      d = { +        description = { "  Settings           " }, +        command = ":e " .. CONFIG_PATH .. "/lv-config.lua", +      }, +    }, + +    footer = { "chrisatmachine.com" }, +  } +end + +M.setup = function() +  vim.g.dashboard_disable_at_vimenter = 0 + +  vim.g.dashboard_custom_header = O.plugin.dashboard.custom_header + +  vim.g.dashboard_default_executive = O.plugin.dashboard.search_handler + +  vim.g.dashboard_custom_section = O.plugin.dashboard.custom_section + +  -- 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 +  require("lv-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>" }, +    }, +  } +end + +return M diff --git a/lua/lv-floatterm/init.lua b/lua/core/floatterm.lua index 94696db4..3d7e0e6e 100644 --- a/lua/lv-floatterm/init.lua +++ b/lua/core/floatterm.lua @@ -1,31 +1,30 @@  local M = {} -  M.config = function() -  local status_ok, fterm = pcall(require, "FTerm") -  if not status_ok then -    return -  end - -  fterm.setup { +  O.plugin.floatterm = { +    active = false,      dimensions = { -      height = 0.8, -      width = 0.8, +      height = 0.9, +      width = 0.9,        x = 0.5, -      y = 0.5, +      y = 0.3,      },      border = "single", -- or 'double'    } +end + +M.setup = function() +  local status_ok, fterm = pcall(require, "FTerm") +  if not status_ok then +    return +  end + +  fterm.setup(O.plugin.floatterm)    -- Create LazyGit Terminal    local term = require "FTerm.terminal"    local lazy = term:new():setup {      cmd = "lazygit", -    dimensions = { -      height = 0.9, -      width = 0.9, -      x = 0.5, -      y = 0.3, -    }, +    dimensions = O.plugin.floatterm.dimensions,    }    local function is_installed(exe) @@ -54,7 +53,11 @@ M.config = function()    --   ]],    --     false    --   ) + +  O.plugin.which_key.mappings["gg"] = "LazyGit"    vim.api.nvim_set_keymap("n", "<A-i>", "<CMD>lua require('FTerm').toggle()<CR>", { noremap = true, silent = true }) +  vim.api.nvim_set_keymap("n", "<leader>gg", "<CMD>lua _G.__fterm_lazygit()<CR>", { noremap = true, silent = true }) +    vim.api.nvim_set_keymap(      "t",      "<A-i>", diff --git a/lua/core/formatter.lua b/lua/core/formatter.lua new file mode 100644 index 00000000..05de74ab --- /dev/null +++ b/lua/core/formatter.lua @@ -0,0 +1,60 @@ +-- autoformat +if O.format_on_save then +  require("lv-utils").define_augroups { +    autoformat = { +      { +        "BufWritePost", +        "*", +        ":silent FormatWrite", +      }, +    }, +  } +end + +-- -- check if formatter has been defined for the language or not +-- local function formatter_exists(lang_formatter) +--   if lang_formatter == nil then +--     return false +--   end +--   if lang_formatter.exe == nil or lang_formatter.args == nil then +--     return false +--   end +--   return true +-- end + +-- returns default formatter for given language +-- local function formatter_return(lang_formatter) +--   return { +--     exe = lang_formatter.exe, +--     args = lang_formatter.args, +--     stdin = not (lang_formatter.stdin ~= nil), +--   } +-- end + +-- fill a table like this -> {rust: {exe:"sth",args:{"a","b"},stdin=true},go: {}...} +-- local formatter_filetypes = {} +-- for k, v in pairs(O.lang) do +--   if formatter_exists(v.formatter) then +--     local keys = v.filetypes +--     if keys == nil then +--       keys = { k } +--     end +--     for _, l in pairs(keys) do +--       formatter_filetypes[l] = { +--         function() +--           return formatter_return(v.formatter) +--         end, +--       } +--     end +--   end +-- end +local status_ok, formatter = pcall(require, "formatter") +if not status_ok then +  return +end + +if not O.format_on_save then +  vim.cmd [[if exists('#autoformat#BufWritePost') +	:autocmd! autoformat +	endif]] +end diff --git a/lua/lv-galaxyline/init.lua b/lua/core/galaxyline.lua index c7a8fa55..281202a8 100644 --- a/lua/lv-galaxyline/init.lua +++ b/lua/core/galaxyline.lua @@ -5,28 +5,12 @@ local status_ok, gl = pcall(require, "galaxyline")  if not status_ok then    return  end --- get my theme in galaxyline repo --- local colors = require('galaxyline.theme').default -local colors = { -  bg = "#2E2E2E", -  -- bg = '#292D38', -  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", -} + +-- NOTE: if someone defines colors but doesn't have them then this will break +local palette_status_ok, colors = pcall(require, O.colorscheme .. ".palette") +if not palette_status_ok then +  colors = O.plugin.galaxyline.colors +end  local condition = require "galaxyline.condition"  local gls = gl.section @@ -61,8 +45,8 @@ table.insert(gls.left, {        vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()])        return "▊"      end, -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineNC", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { "NONE", colors.alt_bg },    },  })  -- print(vim.fn.getbufvar(0, 'ts')) @@ -75,8 +59,8 @@ table.insert(gls.left, {      end,      condition = condition.check_git_workspace,      separator = " ", -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineGit", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { colors.orange, colors.alt_bg },    },  }) @@ -85,8 +69,8 @@ table.insert(gls.left, {      provider = "GitBranch",      condition = condition.check_git_workspace,      separator = " ", -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineNC", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { colors.grey, colors.alt_bg },    },  }) @@ -95,7 +79,7 @@ table.insert(gls.left, {      provider = "DiffAdd",      condition = condition.hide_in_width,      icon = "  ", -    highlight = "StatusLineGitAdd", +    highlight = { colors.green, colors.alt_bg },    },  }) @@ -104,7 +88,7 @@ table.insert(gls.left, {      provider = "DiffModified",      condition = condition.hide_in_width,      icon = " 柳", -    highlight = "StatusLineGitChange", +    highlight = { colors.blue, colors.alt_bg },    },  }) @@ -113,7 +97,7 @@ table.insert(gls.left, {      provider = "DiffRemove",      condition = condition.hide_in_width,      icon = "  ", -    highlight = "StatusLineGitDelete", +    highlight = { colors.red, colors.alt_bg },    },  }) @@ -122,7 +106,7 @@ table.insert(gls.left, {      provider = function()        return " "      end, -    highlight = "StatusLineGitDelete", +    highlight = { colors.grey, colors.alt_bg },    },  })  -- get output from shell command @@ -153,7 +137,7 @@ local PythonEnv = function()    if vim.bo.filetype == "python" then      local venv = os.getenv "CONDA_DEFAULT_ENV"      if venv ~= nil then -      return "🅒 (" .. env_cleanup(venv) .. ")" +      return "  (" .. env_cleanup(venv) .. ")"      end      venv = os.getenv "VIRTUAL_ENV"      if venv ~= nil then @@ -166,8 +150,8 @@ end  table.insert(gls.left, {    VirtualEnv = {      provider = PythonEnv, -    highlight = "StatusLineTreeSitter",      event = "BufEnter", +    highlight = { colors.green, colors.alt_bg },    },  }) @@ -175,15 +159,14 @@ table.insert(gls.right, {    DiagnosticError = {      provider = "DiagnosticError",      icon = "  ", -    highlight = "StatusLineLspDiagnosticsError", +    highlight = { colors.red, colors.alt_bg },    },  })  table.insert(gls.right, {    DiagnosticWarn = {      provider = "DiagnosticWarn",      icon = "  ", - -    highlight = "StatusLineLspDiagnosticsWarning", +    highlight = { colors.orange, colors.alt_bg },    },  }) @@ -191,8 +174,7 @@ table.insert(gls.right, {    DiagnosticInfo = {      provider = "DiagnosticInfo",      icon = "  ", - -    highlight = "StatusLineLspDiagnosticsInformation", +    highlight = { colors.yellow, colors.alt_bg },    },  }) @@ -200,8 +182,7 @@ table.insert(gls.right, {    DiagnosticHint = {      provider = "DiagnosticHint",      icon = "  ", - -    highlight = "StatusLineLspDiagnosticsHint", +    highlight = { colors.blue, colors.alt_bg },    },  }) @@ -214,8 +195,8 @@ table.insert(gls.right, {        return ""      end,      separator = " ", -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineTreeSitter", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { colors.green, colors.alt_bg },    },  }) @@ -229,13 +210,15 @@ local get_lsp_client = function(msg)    local lsps = ""    for _, client in ipairs(clients) do      local filetypes = client.config.filetypes -    if filetypes and vim.fn.index(filetypes, buf_ft) ~= 1 then +    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 +        if not string.find(lsps, client.name) then +          lsps = lsps .. ", " .. client.name +        end          -- print("more", lsps)        end      end @@ -257,8 +240,8 @@ table.insert(gls.right, {        end        return true      end, -    icon = "  ", -    highlight = "StatusLineNC", +    icon = " ", +    highlight = { colors.grey, colors.alt_bg },    },  }) @@ -266,8 +249,8 @@ table.insert(gls.right, {    LineInfo = {      provider = "LineColumn",      separator = "  ", -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineNC", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { colors.grey, colors.alt_bg },    },  }) @@ -275,8 +258,8 @@ table.insert(gls.right, {    PerCent = {      provider = "LinePercent",      separator = " ", -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineNC", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { colors.grey, colors.alt_bg },    },  }) @@ -287,8 +270,8 @@ table.insert(gls.right, {      end,      condition = condition.hide_in_width,      separator = " ", -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineNC", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { colors.grey, colors.alt_bg },    },  }) @@ -297,8 +280,8 @@ table.insert(gls.right, {      provider = "FileTypeName",      condition = condition.hide_in_width,      separator = " ", -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineNC", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { colors.grey, colors.alt_bg },    },  }) @@ -307,8 +290,8 @@ table.insert(gls.right, {      provider = "FileEncode",      condition = condition.hide_in_width,      separator = " ", -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineNC", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { colors.grey, colors.alt_bg },    },  }) @@ -318,8 +301,8 @@ table.insert(gls.right, {        return " "      end,      separator = " ", -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineNC", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { colors.grey, colors.alt_bg },    },  }) @@ -327,8 +310,8 @@ table.insert(gls.short_line_left, {    BufferType = {      provider = "FileTypeName",      separator = " ", -    separator_highlight = "StatusLineSeparator", -    highlight = "StatusLineNC", +    separator_highlight = { "NONE", colors.alt_bg }, +    highlight = { colors.grey, colors.alt_bg },    },  }) @@ -336,9 +319,8 @@ table.insert(gls.short_line_left, {    SFileName = {      provider = "SFileName",      condition = condition.buffer_not_empty, - -    highlight = "StatusLineNC", +    highlight = { colors.grey, colors.alt_bg },    },  }) ---table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}}) +--table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.alt_bg}}}) diff --git a/lua/lv-gitsigns/init.lua b/lua/core/gitsigns.lua index 920c3120..bc310ad6 100644 --- a/lua/lv-gitsigns/init.lua +++ b/lua/core/gitsigns.lua @@ -1,13 +1,7 @@  local M = {} -  M.config = function() -  local status_ok, gitsigns = pcall(require, "gitsigns") -  if not status_ok then -    return -  end -  gitsigns.setup { +  O.plugin.gitsigns = {      signs = { -      -- TODO add hl to colorscheme        add = {          hl = "GitSignsAdd",          text = "▎", @@ -54,4 +48,12 @@ M.config = function()    }  end +M.setup = function() +  local status_ok, gitsigns = pcall(require, "gitsigns") +  if not status_ok then +    return +  end +  gitsigns.setup(O.plugin.gitsigns) +end +  return M diff --git a/lua/lv-nvimtree/init.lua b/lua/core/nvimtree.lua index 97cfe033..cb3eacea 100644 --- a/lua/lv-nvimtree/init.lua +++ b/lua/core/nvimtree.lua @@ -8,7 +8,7 @@ if not status_ok then    return  end  -- -M.config = function() +M.setup = function()    local g = vim.g    vim.o.termguicolors = true @@ -17,7 +17,7 @@ M.config = function()    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_auto_close = 1    g.nvim_tree_quit_on_open = 0    g.nvim_tree_follow = 1    g.nvim_tree_indent_markers = 1 diff --git a/lua/core/status_colors.lua b/lua/core/status_colors.lua new file mode 100644 index 00000000..ddb4aa98 --- /dev/null +++ b/lua/core/status_colors.lua @@ -0,0 +1,19 @@ +O.plugin.galaxyline = { +  active = true, +  colors = { +    alt_bg = "#2E2E2E", +    grey = "#858585", +    blue = "#569CD6", +    green = "#608B4E", +    yellow = "#DCDCAA", +    orange = "#FF8800", +    purple = "#C586C0", +    magenta = "#D16D9E", +    cyan = "#4EC9B0", +    red = "#D16969", +    error_red = "#F44747", +    warning_orange = "#FF8800", +    info_yellow = "#FFCC66", +    hint_blue = "#9CDCFE", +  }, +} diff --git a/lua/core/telescope.lua b/lua/core/telescope.lua new file mode 100644 index 00000000..5a067d67 --- /dev/null +++ b/lua/core/telescope.lua @@ -0,0 +1,96 @@ +local M = {} +M.config = function() +  local status_ok, actions = pcall(require, "telescope.actions") +  if not status_ok then +    return +  end + +  O.plugin.telescope = { +    active = false, +    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, +      path_display = { "shorten" }, +      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-n>"] = actions.cycle_history_next, +          ["<C-p>"] = actions.cycle_history_prev, +          ["<C-c>"] = actions.close, +          ["<C-j>"] = actions.move_selection_next, +          ["<C-k>"] = actions.move_selection_previous, +          ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist, +          ["<CR>"] = actions.select_default + actions.center, +          -- To disable a keymap, put [map] = false +          -- So, to not map "<C-n>", just put +          -- ["<c-t>"] = trouble.open_with_trouble, +          -- ["<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 +          -- 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-q>"] = actions.smart_send_to_qflist + actions.open_qflist, +          -- ["<c-t>"] = trouble.open_with_trouble, +          -- ["<C-i>"] = my_cool_custom_action, +        }, +      }, +    }, +    extensions = { +      fzy_native = { +        override_generic_sorter = false, +        override_file_sorter = true, +      }, +    }, +  } +end + +M.setup = function() +  local status_ok, telescope = pcall(require, "telescope") +  if not status_ok then +    return +  end +  telescope.setup(O.plugin.telescope) +  vim.api.nvim_set_keymap("n", "<Leader>f", ":Telescope find_files<CR>", { noremap = true, silent = true }) +end + +return M diff --git a/lua/core/treesitter.lua b/lua/core/treesitter.lua new file mode 100644 index 00000000..2b7a2d54 --- /dev/null +++ b/lua/core/treesitter.lua @@ -0,0 +1,187 @@ +local M = {} +M.config = function() +  O.treesitter = { +    ensure_installed = {}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages +    ignore_install = {}, +    matchup = { +      enable = false, -- mandatory, false will disable the whole extension +      -- disable = { "c", "ruby" },  -- optional, list of language that will be disabled +    }, +    highlight = { +      enable = true, -- false will disable the whole extension +      additional_vim_regex_highlighting = true, +      disable = { "latex" }, +    }, +    context_commentstring = { +      enable = false, +      config = { css = "// %s" }, +    }, +    -- indent = {enable = true, disable = {"python", "html", "javascript"}}, +    -- TODO seems to be broken +    indent = { enable = { "javascriptreact" } }, +    autotag = { enable = false }, +    textobjects = { +      swap = { +        enable = false, +        -- swap_next = textobj_swap_keymaps, +      }, +      -- move = textobj_move_keymaps, +      select = { +        enable = false, +        -- keymaps = textobj_sel_keymaps, +      }, +    }, +    textsubjects = { +      enable = false, +      keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" }, +    }, +    playground = { +      enable = false, +      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 = false, +      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 +    }, +  } + +  -- -- TODO refactor treesitter +  -- -- @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" }, +  -- }, +end + +M.setup = function() +  -- 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_previous"] ~= 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 + +  local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs") +  if not status_ok then +    return +  end + +  treesitter_configs.setup(O.treesitter) +end + +return M diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua new file mode 100644 index 00000000..c3255705 --- /dev/null +++ b/lua/core/which-key.lua @@ -0,0 +1,195 @@ +local M = {} +M.config = function() +  O.plugin.which_key = { +    active = false, +    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 +        }, +        spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints +      }, +      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 +    }, + +    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 = true, -- use `nowait` when creating keymaps +    }, +    vopts = { +      mode = "v", -- VISUAL 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 = true, -- use `nowait` when creating keymaps +    }, +    -- NOTE: Prefer using : over <cmd> as the latter avoids going back in normal-mode. +    -- see https://neovim.io/doc/user/map.html#:map-cmd +    vmappings = { +      ["/"] = { ":CommentToggle<CR>", "Comment" }, +    }, +    mappings = { +      ["w"] = { "<cmd>w!<CR>", "Save" }, +      ["q"] = { "<cmd>q!<CR>", "Quit" }, +      ["/"] = { "<cmd>CommentToggle<CR>", "Comment" }, +      ["c"] = { "<cmd>BufferClose<CR>", "Close Buffer" }, +      ["e"] = { "<cmd>lua require'core.nvimtree'.toggle_tree()<CR>", "Explorer" }, +      ["f"] = { "<cmd>Telescope find_files<CR>", "Find File" }, +      ["h"] = { '<cmd>let @/=""<CR>', "No Highlight" }, +      [";"] = { "<cmd>Dashboard<CR>", "Dashboard" }, +      p = { +        name = "Packer", +        c = { "<cmd>PackerCompile<cr>", "Compile" }, +        i = { "<cmd>PackerInstall<cr>", "Install" }, +        r = { "<cmd>lua require('lv-utils').reload_lv_config()<cr>", "Reload" }, +        s = { "<cmd>PackerSync<cr>", "Sync" }, +        u = { "<cmd>PackerUpdate<cr>", "Update" }, +      }, + +      -- " 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 +      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>silent FormatWrite<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 = { "<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" }, +        k = { "<cmd>Telescope keymaps<cr>", "Keymaps" }, +        C = { "<cmd>Telescope commands<cr>", "Commands" }, +      }, +      T = { +        name = "Treesitter", +        i = { ":TSConfigInfo<cr>", "Info" }, +      }, +    }, +  } +end + +M.setup = function() +  -- if not package.loaded['which-key'] then +  --  return +  -- end +  local status_ok, which_key = pcall(require, "which-key") +  if not status_ok then +    return +  end + +  which_key.setup(O.plugin.which_key.setup) + +  local opts = O.plugin.which_key.opts +  local vopts = O.plugin.which_key.vopts + +  local mappings = O.plugin.which_key.mappings +  local vmappings = O.plugin.which_key.vmappings + +  -- 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 + +  local wk = require "which-key" + +  wk.register(mappings, opts) +  wk.register(vmappings, vopts) +  wk.register(O.user_which_key, opts) +end + +return M diff --git a/lua/core/zen.lua b/lua/core/zen.lua new file mode 100644 index 00000000..99a5d769 --- /dev/null +++ b/lua/core/zen.lua @@ -0,0 +1,34 @@ +local M = {} +M.config = function() +  O.plugin["zen"] = { +    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 + +M.setup = function() +  local status_ok, zen_mode = pcall(require, "zen-mode") +  if not status_ok then +    return +  end +  zen_mode.setup(O.plugin.zen) +end + +return M diff --git a/lua/default-config.lua b/lua/default-config.lua index 317886cc..b10c9590 100644 --- a/lua/default-config.lua +++ b/lua/default-config.lua @@ -5,97 +5,70 @@ TERMINAL = vim.fn.expand "$TERMINAL"  USER = vim.fn.expand "$USER"  O = { -  format_on_save = true, -  auto_close_tree = 0, -  auto_complete = true, -  colorcolumn = "99999", -- fixes indentline for now +  leader_key = "space",    colorscheme = "spacegray", -  clipboard = "unnamedplus", -  hidden_files = true, -  wrap_lines = false, -  spell = false, -  spelllang = "en", -  number = true, -  relative_number = false, -  number_width = 4, -  shift_width = 2, -  tab_stop = 2, -  cmdheight = 2, -  cursorline = true, -  shell = "bash", -  scrolloff = 0, -  timeoutlen = 100, -  nvim_tree_disable_netrw = 0, -  ignore_case = true, -  smart_case = true, -  lushmode = false, -  hl_search = false, -  document_highlight = true, +  line_wrap_cursor_movement = true,    transparent_window = false, -  leader_key = "space", -  vnsip_dir = vim.fn.stdpath "config" .. "/snippets", +  format_on_save = true, +  vsnip_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" }, +  default_options = { +    backup = false, -- creates a backup file +    clipboard = "unnamedplus", -- allows neovim to access the system clipboard +    cmdheight = 2, -- more space in the neovim command line for displaying messages +    colorcolumn = "99999", -- fixes indentline for now +    completeopt = { "menuone", "noselect" }, +    conceallevel = 0, -- so that `` is visible in markdown files +    fileencoding = "utf-8", -- the encoding written to a file +    guifont = "monospace:h17", -- the font used in graphical neovim applications +    hidden = true, -- required to keep multiple buffers and open multiple buffers +    hlsearch = false, -- highlight all matches on previous search pattern +    ignorecase = true, -- ignore case in search patterns +    mouse = "a", -- allow the mouse to be used in neovim +    pumheight = 10, -- pop up menu height +    showmode = false, -- we don't need to see things like -- INSERT -- anymore +    showtabline = 2, -- always show tabs +    smartcase = true, -- smart case +    smartindent = true, -- make indenting smarter again +    splitbelow = true, -- force all horizontal splits to go below current window +    splitright = true, -- force all vertical splits to go to the right of current window +    swapfile = false, -- creates a swapfile +    termguicolors = true, -- set term gui colors (most terminals support this) +    timeoutlen = 100, -- time to wait for a mapped sequence to complete (in milliseconds) +    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 +    undodir = CACHE_PATH .. "/undo", -- set an undo directory +    undofile = true, -- enable persisten undo +    updatetime = 300, -- faster completion +    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 +    expandtab = true, -- convert tabs to spaces +    shiftwidth = 2, -- the number of spaces inserted for each indentation +    tabstop = 2, -- insert 2 spaces for a tab +    cursorline = true, -- highlight the current line +    number = true, -- set numbered lines +    relativenumber = false, -- set relative numbered lines +    numberwidth = 4, -- set number column width to 2 {default 4} +    signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time +    wrap = false, -- display lines as one long line +    spell = false, +    spelllang = "en", +    scrolloff = 8, -- is one of my fav    }, +  plugin = {}, + +  -- TODO: refactor for tree +  auto_close_tree = 0, +  nvim_tree_disable_netrw = 0, +    lsp = { +    document_highlight = true,      popup_border = "single",    }, -  database = { save_location = "~/.config/nvcode_db", auto_execute = 1 }, - -  plugin = { -    -- Builtins -    dashboard = { active = false }, -    colorizer = { active = false }, -    -- zen = { active = false }, -    ts_playground = { active = false }, -    ts_context_commentstring = { active = false }, -    ts_hintobjects = { active = false }, -    ts_autotag = { active = false }, -    ts_rainbow = { active = false }, -    ts_textobjects = { 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 }, -    dap_install = { active = false }, -    lush = { active = false }, -    diffview = { active = false }, -    floatterm = { active = false }, -    trouble = { active = false }, -    sanegx = { active = false }, -  }, +  database = { save_location = "~/.config/lunarvim_db", auto_execute = 1 }, +  -- TODO: just using mappings (leader mappings)    user_which_key = {},    user_plugins = { @@ -106,8 +79,18 @@ O = {      { "FileType", "qf", "set nobuflisted" },    }, +  formatters = { +    filetype = {}, +  }, + +  -- TODO move all of this into lang specific files, only require when using    lang = { -    cmake = {}, +    cmake = { +      formatter = { +        exe = "clang-format", +        args = {}, +      }, +    },      clang = {        diagnostics = {          virtual_text = { spacing = 0, prefix = "" }, @@ -116,25 +99,43 @@ O = {        },        cross_file_rename = true,        header_insertion = "never", +      filetypes = { "c", "cpp", "objc" }, +      formatter = { +        exe = "clang-format", +        args = {}, +      },      },      css = {        virtual_text = true,      },      dart = {        sdk_path = "/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot", +      formatter = { +        exe = "dart", +        args = { "format" }, +      },      },      docker = {},      efm = {},      elm = {}, -    emmet = { active = true }, +    emmet = { active = false },      elixir = {},      graphql = {}, -    go = {}, +    go = { +      formatter = { +        exe = "gofmt", +        args = {}, +      }, +    },      html = {},      java = {        java_tools = {          active = false,        }, +      formatter = { +        exe = "prettier", +        args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" }, +      },      },      json = {        diagnostics = { @@ -142,15 +143,27 @@ O = {          signs = true,          underline = true,        }, +      formatter = { +        exe = "python", +        args = { "-m", "json.tool" }, +      },      },      kotlin = {}, -    latex = {}, +    latex = { +      auto_save = false, +      ignore_errors = {}, +    },      lua = {        diagnostics = {          virtual_text = { spacing = 0, prefix = "" },          signs = true,          underline = true,        }, +      formatter = { +        exe = "stylua", +        args = {}, +        stdin = false, +      },      },      php = {        format = { @@ -167,8 +180,14 @@ O = {          underline = true,        },        filetypes = { "php", "phtml" }, +      formatter = { +        exe = "phpcbf", +        args = { "--standard=PSR12", vim.api.nvim_buf_get_name(0) }, +        stdin = false, +      },      },      python = { +      -- @usage can be flake8 or yapf        linter = "",        isort = false,        diagnostics = { @@ -181,6 +200,10 @@ O = {          auto_search_paths = true,          use_library_code_types = true,        }, +      formatter = { +        exe = "yapf", +        args = {}, +      },      },      ruby = {        diagnostics = { @@ -189,6 +212,10 @@ O = {          underline = true,        },        filetypes = { "rb", "erb", "rakefile", "ruby" }, +      formatter = { +        exe = "rufo", +        args = { "-x" }, +      },      },      rust = {        rust_tools = { @@ -196,6 +223,11 @@ O = {          parameter_hints_prefix = "<-",          other_hints_prefix = "=>", -- prefix for all the other hints (type, chaining)        }, +      -- @usage can be clippy +      formatter = { +        exe = "rustfmt", +        args = { "--emit=stdout", "--edition=2018" }, +      },        linter = "",        diagnostics = {          virtual_text = { spacing = 0, prefix = "" }, @@ -212,6 +244,11 @@ O = {          signs = true,          underline = true,        }, +      formatter = { +        exe = "shfmt", +        args = { "-w" }, +        stdin = false, +      },      },      svelte = {},      tailwindcss = { @@ -226,44 +263,43 @@ O = {          "typescriptreact",        },      }, -    terraform = {}, +    terraform = { +      formatter = { +        exe = "terraform", +        args = { "fmt" }, +        stdin = false, +      }, +    },      tsserver = { -      -- @usage can be 'eslint' +      -- @usage can be 'eslint' or 'eslint_d'        linter = "",        diagnostics = {          virtual_text = { spacing = 0, prefix = "" },          signs = true,          underline = true,        }, +      formatter = { +        exe = "prettier", +        args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" }, +      },      },      vim = {}, -    yaml = {}, -  }, - -  dashboard = { - -    custom_header = { -      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⣶⣾⠿⠿⠟⠛⠛⠛⠛⠿⠿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⡿⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒⠂⠉⠉⠉⠉⢩⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⢰⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠠⡀⠀⠀⢀⣾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⢀⣸⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡧⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠈⠁⠒⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣇⠀⠀⠀⠀⠀⠀⠉⠢⠤⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡟⠈⠑⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠑⠒⠤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡇⠀⠀⢀⣣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠒⠢⠤⠄⣀⣀⠀⠀⠀⢠⣿⡟⠀⠀⠀⣺⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", -      "⠀⣿⠇⠀⠀⠀⠀⠀⣤⡄⠀⠀⢠⣤⡄⠀⢨⣭⣠⣤⣤⣤⡀⠀⠀⢀⣤⣤⣤⣤⡄⠀⠀⠀⣤⣄⣤⣤⣤⠀⠀⣿⣯⠉⠉⣿⡟⠀⠈⢩⣭⣤⣤⠀⠀⠀⠀⣠⣤⣤⣤⣄⣤⣤", -      "⢠⣿⠀⠀⠀⠀⠀⠀⣿⠃⠀⠀⣸⣿⠁⠀⣿⣿⠉⠀⠈⣿⡇⠀⠀⠛⠋⠀⠀⢹⣿⠀⠀⠀⣿⠏⠀⠸⠿⠃⠀⣿⣿⠀⣰⡟⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡟⢸⣿⡇⢀⣿", -      "⣸⡇⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⣿⡟⠀⢠⣿⡇⠀⠀⢰⣿⡇⠀⣰⣾⠟⠛⠛⣻⡇⠀⠀⢸⡿⠀⠀⠀⠀⠀⠀⢻⣿⢰⣿⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⢸⣿⠇⢸⣿⠀⢸⡏", -      "⣿⣧⣤⣤⣤⡄⠀⠘⣿⣤⣤⡤⣿⠇⠀⢸⣿⠁⠀⠀⣼⣿⠀⠀⢿⣿⣤⣤⠔⣿⠃⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⢸⣿⣿⠋⠀⠀⠀⢠⣤⣤⣿⣥⣤⡄⠀⣼⣿⠀⣸⡏⠀⣿⠃", -      "⠉⠉⠉⠉⠉⠁⠀⠀⠈⠉⠉⠀⠉⠀⠀⠈⠉⠀⠀⠀⠉⠉⠀⠀⠀⠉⠉⠁⠈⠉⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠁⠀⠉⠁⠀⠉⠁⠀⠉⠀", +    yaml = { +      formatter = { +        exe = "prettier", +        args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" }, +      },      }, -    footer = { "chrisatmachine.com" },    },  } -require "lv-zen.config" +require "core.status_colors" +require("core.gitsigns").config() +require("core.compe").config() +require("core.dashboard").config() +require("core.dap").config() +require("core.floatterm").config() +require("core.zen").config() +require("core.telescope").config() +require("core.treesitter").config() +require("core.which-key").config() diff --git a/lua/keymappings.lua b/lua/keymappings.lua index c2701ac1..fed362aa 100644 --- a/lua/keymappings.lua +++ b/lua/keymappings.lua @@ -1,83 +1,106 @@ --- 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 }) +local function register_mappings(mappings, default_options) +  for mode, mode_mappings in pairs(mappings) do +    for _, mapping in pairs(mode_mappings) do +      local options = #mapping == 3 and table.remove(mapping) or default_options +      local prefix, cmd = unpack(mapping) +      pcall(vim.api.nvim_set_keymap, mode, prefix, cmd, options) +    end +  end +end --- Terminal window navigation -vim.api.nvim_set_keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", { silent = true, noremap = true }) -vim.api.nvim_set_keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", { silent = true, noremap = true }) -vim.api.nvim_set_keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", { silent = true, noremap = true }) -vim.api.nvim_set_keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", { silent = true, noremap = true }) -vim.api.nvim_set_keymap("i", "<C-h>", "<C-\\><C-N><C-w>h", { silent = true, noremap = true }) -vim.api.nvim_set_keymap("i", "<C-j>", "<C-\\><C-N><C-w>j", { silent = true, noremap = true }) -vim.api.nvim_set_keymap("i", "<C-k>", "<C-\\><C-N><C-w>k", { silent = true, noremap = true }) -vim.api.nvim_set_keymap("i", "<C-l>", "<C-\\><C-N><C-w>l", { silent = true, noremap = true }) -vim.api.nvim_set_keymap("t", "<Esc>", "<C-\\><C-n>", { silent = true, noremap = true }) +local mappings = { +  i = { -- Insert mode +    -- I hate escape +    { "jk", "<ESC>" }, +    { "kj", "<ESC>" }, +    { "jj", "<ESC>" }, --- 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 +    -- Move current line / block with Alt-j/k ala vscode. +    { "<A-j>", "<Esc>:m .+1<CR>==gi" }, +    { "<A-k>", "<Esc>:m .-2<CR>==gi" }, + +    -- Terminal window navigation +    { "<C-h>", "<C-\\><C-N><C-w>h" }, +    { "<C-j>", "<C-\\><C-N><C-w>j" }, +    { "<C-k>", "<C-\\><C-N><C-w>k" }, +    { "<C-l>", "<C-\\><C-N><C-w>l" }, +  }, +  n = { -- Normal mode +    -- Better window movement +    { "<C-h>", "<C-w>h", { silent = true } }, +    { "<C-j>", "<C-w>j", { silent = true } }, +    { "<C-k>", "<C-w>k", { silent = true } }, +    { "<C-l>", "<C-w>l", { silent = true } }, + +    -- Resize with arrows +    { "<C-Up>", ":resize -2<CR>", { silent = true } }, +    { "<C-Down>", ":resize +2<CR>", { silent = true } }, +    { "<C-Left>", ":vertical resize -2<CR>", { silent = true } }, +    { "<C-Right>", ":vertical resize +2<CR>", { silent = true } }, + +    -- Tab switch buffer +    -- { "<TAB>", ":bnext<CR>" }, +    -- { "<S-TAB>", ":bprevious<CR>" }, --- better indenting -vim.api.nvim_set_keymap("v", "<", "<gv", { noremap = true, silent = true }) -vim.api.nvim_set_keymap("v", ">", ">gv", { noremap = true, silent = true }) +    -- Move current line / block with Alt-j/k a la vscode. +    { "<A-j>", ":m .+1<CR>==" }, +    { "<A-k>", ":m .-2<CR>==" }, --- 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 }) +    -- QuickFix +    { "]q", ":cnext<CR>" }, +    { "[q", ":cprev<CR>" }, --- 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 }) +    -- {'<C-TAB>', 'compe#complete()', {noremap = true, silent = true, expr = true}}, +  }, +  t = { -- Terminal mode +    -- Terminal window navigation +    { "<C-h>", "<C-\\><C-N><C-w>h" }, +    { "<C-j>", "<C-\\><C-N><C-w>j" }, +    { "<C-k>", "<C-\\><C-N><C-w>k" }, +    { "<C-l>", "<C-\\><C-N><C-w>l" }, +  }, +  v = { -- Visual/Select mode +    -- Better indenting +    { "<", "<gv" }, +    { ">", ">gv" }, --- 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 }) +    -- { "p", '"0p', { silent = true } }, +    -- { "P", '"0P', { silent = true } }, +  }, +  x = { -- Visual mode +    -- Move selected line / block of text in visual mode +    { "K", ":move '<-2<CR>gv-gv" }, +    { "J", ":move '>+1<CR>gv-gv" }, --- 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 }) +    -- Move current line / block with Alt-j/k ala vscode. +    { "<A-j>", ":m '>+1<CR>gv-gv" }, +    { "<A-k>", ":m '<-2<CR>gv-gv" }, +  }, +  [""] = { +    -- Toggle the QuickFix window +    { "<C-q>", ":call QuickFixToggle()<CR>" }, +  }, +} --- 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 }) +-- TODO: fix this +if vim.fn.has "mac" == 1 then +  mappings["n"][5][1] = "<A-Up>" +  mappings["n"][6][1] = "<A-Down>" +  mappings["n"][7][1] = "<A-Left>" +  mappings["n"][8][1] = "<A-Right>" +end + +register_mappings(mappings, { silent = true, noremap = 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' --- vim.api.nvim_set_keymap('v', 'p', '"0p', {silent = true}) --- vim.api.nvim_set_keymap('v', 'P', '"0P', {silent = true}) -  -- vim.cmd('inoremap <expr> <TAB> (\"\\<C-n>\")')  -- vim.cmd('inoremap <expr> <S-TAB> (\"\\<C-p>\")') --- vim.api.nvim_set_keymap('i', '<C-TAB>', 'compe#complete()', {noremap = true, silent = true, expr = true}) -  -- vim.cmd([[  -- map p <Plug>(miniyank-autoput)  -- map P <Plug>(miniyank-autoPut)  -- map <leader>n <Plug>(miniyank-cycle)  -- map <leader>N <Plug>(miniyank-cycleback)  -- ]]) - --- Toggle the QuickFix window -vim.api.nvim_set_keymap("", "<C-q>", ":call QuickFixToggle()<CR>", { noremap = true, silent = true }) diff --git a/lua/lsp/angular-ls.lua b/lua/lsp/angular-ls.lua index e1363731..818faf38 100644 --- a/lua/lsp/angular-ls.lua +++ b/lua/lsp/angular-ls.lua @@ -1,4 +1,4 @@ --- TODO find correct root filetype +-- TODO: find correct root filetype  -- :LspInstall angular  require("lspconfig").angularls.setup {    cmd = { DATA_PATH .. "/lspinstall/angular/node_modules/@angular/language-server/bin/ngserver", "--stdio" }, diff --git a/lua/lsp/emmet-ls.lua b/lua/lsp/emmet-ls.lua index a671ff88..e38747ac 100644 --- a/lua/lsp/emmet-ls.lua +++ b/lua/lsp/emmet-ls.lua @@ -10,7 +10,7 @@ capabilities.textDocument.completion.completionItem.snippetSupport = true  configs.emmet_ls = {    default_config = {      cmd = { "emmet-ls", "--stdio" }, -    filetypes = { "html", "css", "javascript", "typescript" }, +    filetypes = { "html", "css", "javascript", "typescript", "vue" },      root_dir = function()        return vim.loop.cwd()      end, diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 096ceabf..01f82737 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -1,4 +1,4 @@ --- TODO figure out why this don't work +-- TODO: figure out why this don't work  vim.fn.sign_define(    "LspDiagnosticsSignError",    { texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError" } @@ -20,6 +20,7 @@ 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> gp <cmd>lua require'lsp'.PeekDefinition()<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> :lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<CR>" @@ -103,7 +104,72 @@ local function documentHighlight(client, bufnr)  end  local lsp_config = {} -if O.document_highlight then +-- Taken from https://www.reddit.com/r/neovim/comments/gyb077/nvimlsp_peek_defination_javascript_ttserver/ +function lsp_config.preview_location(location, context, before_context) +  -- location may be LocationLink or Location (more useful for the former) +  context = context or 15 +  before_context = before_context or 0 +  local uri = location.targetUri or location.uri +  if uri == nil then +    return +  end +  local bufnr = vim.uri_to_bufnr(uri) +  if not vim.api.nvim_buf_is_loaded(bufnr) then +    vim.fn.bufload(bufnr) +  end + +  local range = location.targetRange or location.range +  local contents = vim.api.nvim_buf_get_lines( +    bufnr, +    range.start.line - before_context, +    range["end"].line + 1 + context, +    false +  ) +  local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype") +  return vim.lsp.util.open_floating_preview(contents, filetype, { border = O.lsp.popup_border }) +end + +function lsp_config.preview_location_callback(_, method, result) +  local context = 15 +  if result == nil or vim.tbl_isempty(result) then +    print("No location found: " .. method) +    return nil +  end +  if vim.tbl_islist(result) then +    lsp_config.floating_buf, lsp_config.floating_win = lsp_config.preview_location(result[1], context) +  else +    lsp_config.floating_buf, lsp_config.floating_win = lsp_config.preview_location(result, context) +  end +end + +function lsp_config.PeekDefinition() +  if vim.tbl_contains(vim.api.nvim_list_wins(), lsp_config.floating_win) then +    vim.api.nvim_set_current_win(lsp_config.floating_win) +  else +    local params = vim.lsp.util.make_position_params() +    return vim.lsp.buf_request(0, "textDocument/definition", params, lsp_config.preview_location_callback) +  end +end + +function lsp_config.PeekTypeDefinition() +  if vim.tbl_contains(vim.api.nvim_list_wins(), lsp_config.floating_win) then +    vim.api.nvim_set_current_win(lsp_config.floating_win) +  else +    local params = vim.lsp.util.make_position_params() +    return vim.lsp.buf_request(0, "textDocument/typeDefinition", params, lsp_config.preview_location_callback) +  end +end + +function lsp_config.PeekImplementation() +  if vim.tbl_contains(vim.api.nvim_list_wins(), lsp_config.floating_win) then +    vim.api.nvim_set_current_win(lsp_config.floating_win) +  else +    local params = vim.lsp.util.make_position_params() +    return vim.lsp.buf_request(0, "textDocument/implementation", params, lsp_config.preview_location_callback) +  end +end + +if O.lsp.document_highlight then    function lsp_config.common_on_attach(client, bufnr)      documentHighlight(client, bufnr)    end @@ -131,7 +197,7 @@ function lsp_config.tsserver_on_attach(client, bufnr)      -- formatting      enable_formatting = O.lang.tsserver.autoformat, -    formatter = O.lang.tsserver.formatter, +    formatter = O.lang.tsserver.formatter.exe,      formatter_config_fallback = nil,      -- parentheses completion diff --git a/lua/lsp/svelte-ls.lua b/lua/lsp/svelte-ls.lua index 9d7b8973..e5ddb3b3 100644 --- a/lua/lsp/svelte-ls.lua +++ b/lua/lsp/svelte-ls.lua @@ -1,4 +1,4 @@ --- TODO what is a svelte filetype +-- TODO: what is a svelte filetype  require("lspconfig").svelte.setup {    cmd = { DATA_PATH .. "/lspinstall/svelte/node_modules/.bin/svelteserver", "--stdio" },    on_attach = require("lsp").common_on_attach, diff --git a/lua/lsp/tailwindcss-ls.lua b/lua/lsp/tailwindcss-ls.lua index 4c90ebd0..38c1e7cc 100644 --- a/lua/lsp/tailwindcss-ls.lua +++ b/lua/lsp/tailwindcss-ls.lua @@ -1,4 +1,4 @@ --- TODO what is a tailwindcss filetype +-- TODO: what is a tailwindcss filetype  local lspconfig = require "lspconfig"  lspconfig.tailwindcss.setup { diff --git a/lua/lsp/ts-fmt-lint.lua b/lua/lsp/ts-fmt-lint.lua index 8a6c366c..a73b817e 100644 --- a/lua/lsp/ts-fmt-lint.lua +++ b/lua/lsp/ts-fmt-lint.lua @@ -5,30 +5,42 @@ 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}", +  if O.lang.tsserver.linter == "eslint" or O.lang.tsserver.linter == "eslint_d" then +    local eslint = { +      lintCommand = O.lang.tsserver.linter .. " -f unix --stdin --stdin-filename   {INPUT}", +      lintStdin = true, +      lintFormats = { "%f:%l:%c: %m" }, +      lintIgnoreExitCode = true, +      formatCommand = O.lang.tsserver.linter .. " --fix-to-stdout --stdin  --stdin-filename=${INPUT}",        formatStdin = true,      } +    table.insert(tsserver_args, eslint)    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" }, +    root_dir = require("lspconfig").util.root_pattern(".git/", "package.json"), +    filetypes = { +      "vue", +      "javascript", +      "javascriptreact", +      "typescript", +      "typescriptreact", +      "javascript.jsx", +      "typescript.tsx", +    },      settings = {        rootMarkers = { ".git/", "package.json" },        languages = { -        html = { prettier }, -        css = { prettier }, -        json = { prettier }, -        yaml = { prettier }, +        vue = tsserver_args, +        javascript = tsserver_args, +        javascriptreact = tsserver_args, +        ["javascript.jsx"] = tsserver_args, +        typescript = tsserver_args, +        ["typescript.tsx"] = tsserver_args, +        typescriptreact = tsserver_args,        },      },    } diff --git a/lua/lsp/tsserver-ls.lua b/lua/lsp/tsserver-ls.lua index d7c4ec3c..8ed801e8 100644 --- a/lua/lsp/tsserver-ls.lua +++ b/lua/lsp/tsserver-ls.lua @@ -1,3 +1,29 @@ +vim.cmd "let proj = FindRootDirectory()" +local root_dir = vim.api.nvim_get_var "proj" + +-- use the global prettier if you didn't find the local one +local prettier_instance = root_dir .. "/node_modules/.bin/prettier" +if vim.fn.executable(prettier_instance) ~= 1 then +  prettier_instance = O.lang.tsserver.formatter.exe +end + +O.formatters.filetype["javascriptreact"] = { +  function() +    return { +      exe = prettier_instance, +      -- TODO: allow user to override this +      args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" }, +      stdin = true, +    } +  end, +} +O.formatters.filetype["javascript"] = O.formatters.filetype["javascriptreact"] + +require("formatter.config").set_defaults { +  logging = false, +  filetype = O.formatters.filetype, +} +  if require("lv-utils").check_lsp_client_active "tsserver" then    return  end diff --git a/lua/lv-colorizer/init.lua b/lua/lv-colorizer/init.lua deleted file mode 100644 index abe2f728..00000000 --- a/lua/lv-colorizer/init.lua +++ /dev/null @@ -1,14 +0,0 @@ -local status_ok, colorizer = pcall(require, "colorizer") -if not status_ok then -  return -end -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/lua/lv-dap/init.lua b/lua/lv-dap/init.lua deleted file mode 100644 index f3312bbb..00000000 --- a/lua/lv-dap/init.lua +++ /dev/null @@ -1,29 +0,0 @@ -local status_ok, dap = pcall(require, "dap") -if not status_ok then -  return -end --- require "dap" -vim.fn.sign_define("DapBreakpoint", { -  text = "", -  texthl = "LspDiagnosticsSignError", -  linehl = "", -  numhl = "", -}) -dap.defaults.fallback.terminal_win_cmd = "50vsplit new" - -O.user_which_key["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" }, -} diff --git a/lua/lv-dashboard/init.lua b/lua/lv-dashboard/init.lua deleted file mode 100644 index 7e6fc060..00000000 --- a/lua/lv-dashboard/init.lua +++ /dev/null @@ -1,70 +0,0 @@ -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", -    -- }, -    c = { -      description = { "  Find Word          " }, -      command = "Telescope live_grep", -    }, -    d = { -      description = { "  Settings           " }, -      command = ":e " .. CONFIG_PATH .. "/lv-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("lv-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/lua/lv-lspinstall/init.lua b/lua/lv-lspinstall/init.lua deleted file mode 100644 index f6796fe3..00000000 --- a/lua/lv-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/lua/lv-neoformat/init.lua b/lua/lv-neoformat/init.lua deleted file mode 100644 index 4dbaad23..00000000 --- a/lua/lv-neoformat/init.lua +++ /dev/null @@ -1,23 +0,0 @@ --- autoformat -if O.format_on_save then -  require("lv-utils").define_augroups { -    autoformat = { -      { -        "BufWritePre", -        "*", -        [[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]], -      }, -    }, -  } -end - -vim.g.neoformat_run_all_formatters = 0 - -vim.g.neoformat_enabled_python = { "autopep8", "yapf", "docformatter" } -vim.g.neoformat_enabled_javascript = { "prettier" } - -if not O.format_on_save then -  vim.cmd [[if exists('#autoformat#BufWritePre') -	:autocmd! autoformat -	endif]] -end diff --git a/lua/lv-symbols-outline/init.lua b/lua/lv-symbols-outline/init.lua deleted file mode 100644 index f15b5dfb..00000000 --- a/lua/lv-symbols-outline/init.lua +++ /dev/null @@ -1,15 +0,0 @@ -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/lua/lv-telescope/init.lua b/lua/lv-telescope/init.lua deleted file mode 100644 index 39c7b951..00000000 --- a/lua/lv-telescope/init.lua +++ /dev/null @@ -1,90 +0,0 @@ -local status_ok, telescope = pcall(require, "telescope") -if not status_ok then -  return -end -local actions = require "telescope.actions" --- if O.plugin.trouble.active then ---     local trouble = require("trouble.providers.telescope") --- end --- Global remapping ------------------------------- --- '--color=never', -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, -    path_display = { "shorten" }, -    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/lua/lv-themes/spacegray.lua b/lua/lv-themes/spacegray.lua deleted file mode 100644 index 0bb695c0..00000000 --- a/lua/lv-themes/spacegray.lua +++ /dev/null @@ -1,373 +0,0 @@ -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/lua/lv-treesitter/init.lua b/lua/lv-treesitter/init.lua deleted file mode 100644 index 55f45809..00000000 --- a/lua/lv-treesitter/init.lua +++ /dev/null @@ -1,146 +0,0 @@ --- 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_previous"] ~= 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 -local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then -  return -end - -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/lua/lv-utils/init.lua b/lua/lv-utils/init.lua index 6a7d3c88..d2d23cfb 100644 --- a/lua/lv-utils/init.lua +++ b/lua/lv-utils/init.lua @@ -3,9 +3,11 @@ local lv_utils = {}  function lv_utils.reload_lv_config()    vim.cmd "source ~/.config/nvim/lv-config.lua"    vim.cmd "source ~/.config/nvim/lua/plugins.lua" -  vim.cmd "source ~/.config/nvim/lua/lv-neoformat/init.lua" +  vim.cmd "source ~/.config/nvim/lua/settings.lua" +  vim.cmd "source ~/.config/nvim/lua/core/formatter.lua"    vim.cmd ":PackerCompile"    vim.cmd ":PackerInstall" +  -- vim.cmd ":PackerClean"  end  function lv_utils.check_lsp_client_active(name) @@ -40,9 +42,13 @@ function lv_utils.define_augroups(definitions) -- {{{1    end  end +function lv_utils.unrequire(m) +  package.loaded[m] = nil +  _G[m] = nil +end +  lv_utils.define_augroups { -  _user_autocommands = O.user_autocommands,    _general_settings = {      {        "TextYankPost", @@ -55,6 +61,11 @@ lv_utils.define_augroups {        "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",      },      { +      "BufWinEnter", +      "dashboard", +      "setlocal cursorline signcolumn=yes cursorcolumn number", +    }, +    {        "BufRead",        "*",        "setlocal formatoptions-=c formatoptions-=r formatoptions-=o", @@ -95,6 +106,7 @@ lv_utils.define_augroups {      -- will cause split windows to be resized evenly if main window is resized      { "BufWritePost", "plugins.lua", "PackerCompile" },    }, +    -- _fterm_lazygit = {    --   -- will cause esc key to exit lazy git    --   {"TermEnter", "*", "call LazyGitNativation()"} @@ -106,6 +118,7 @@ lv_utils.define_augroups {    --   {'InsertEnter', '*', 'if &cursorline | let g:ms_cursorlineoff = 1 | setlocal nocursorline | endif'},    --   {'InsertLeave', '*', 'if exists("g:ms_cursorlineoff") | setlocal cursorline | endif'},    -- }, +  _user_autocommands = O.user_autocommands,  }  vim.cmd [[ @@ -120,4 +133,4 @@ endfunction  return lv_utils --- TODO find a new home for these autocommands +-- TODO: find a new home for these autocommands diff --git a/lua/lv-vimtex/init.lua b/lua/lv-vimtex/init.lua deleted file mode 100644 index 4d7b93bd..00000000 --- a/lua/lv-vimtex/init.lua +++ /dev/null @@ -1,25 +0,0 @@ -vim.g.vimtex_compiler_method = "latexmk" -vim.g.vimtex_view_method = "zathura" -vim.g.vimtex_fold_enabled = 0 - -O.user_which_key["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" }, -} - --- 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/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua deleted file mode 100644 index beaaff42..00000000 --- a/lua/lv-which-key/init.lua +++ /dev/null @@ -1,251 +0,0 @@ --- if not package.loaded['which-key'] then ---  return --- end -local status_ok, which_key = pcall(require, "which-key") -if not status_ok then -  return -end - -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 -    }, -    spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints -  }, -  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>h", ':let @/=""<CR>', { noremap = true, silent = true }) - --- explorer - -vim.api.nvim_set_keymap( -  "n", -  "<Leader>e", -  ":lua require'lv-nvimtree'.toggle_tree()<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>/", ":CommentToggle<CR>", { noremap = true, silent = true }) -vim.api.nvim_set_keymap("v", "<leader>/", ":CommentToggle<CR>", { noremap = true, silent = true }) - --- close buffer -vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", { noremap = true, silent = true }) - --- Save -vim.api.nvim_set_keymap("n", "<leader>w", ":w!<CR>", { noremap = true, silent = true }) - --- Quit -vim.api.nvim_set_keymap("n", "<leader>q", ":q!<CR>", { noremap = true, silent = true }) - --- open lv-config -vim.api.nvim_set_keymap( -  "n", -  "<leader>.", -  ":e " .. CONFIG_PATH .. "/lv-config.lua<CR>", -  { noremap = true, silent = true } -) - -local mappings = { -  ["w"] = "Save", -  ["q"] = "Quit", -  ["."] = "LunarConfig", -  ["/"] = "Comment", -  ["c"] = "Close Buffer", -  ["e"] = "Explorer", -  ["f"] = "Find File", -  ["h"] = "No Highlight", -  [";"] = "Dashboard", -  p = { -    name = "Packer", -    c = { "<cmd>PackerCompile<cr>", "Compile" }, -    i = { "<cmd>PackerInstall<cr>", "Install" }, -    r = { "<cmd>lua require('lv-utils').reload_lv_config()<cr>", "Reload" }, -    s = { "<cmd>PackerSync<cr>", "Sync" }, -    u = { "<cmd>PackerUpdate<cr>", "Update" }, -  }, - -  -- " 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 -  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>Neoformat<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" }, -  }, -  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.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 - -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 - -if O.plugin.floatterm then -  vim.api.nvim_set_keymap("n", "<leader>gg", "<CMD>lua _G.__fterm_lazygit()<CR>", { noremap = true, silent = true }) -  mappings["gg"] = "LazyGit" -end - -for k, v in pairs(O.user_which_key) do -  mappings[k] = v -end - -local wk = require "which-key" -wk.register(mappings, opts) diff --git a/lua/lv-zen/config.lua b/lua/lv-zen/config.lua deleted file mode 100644 index ef1e2bc5..00000000 --- a/lua/lv-zen/config.lua +++ /dev/null @@ -1,21 +0,0 @@ -O.plugin["zen"] = { -	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 -	}, -} diff --git a/lua/lv-zen/init.lua b/lua/lv-zen/init.lua deleted file mode 100644 index ce48a4b0..00000000 --- a/lua/lv-zen/init.lua +++ /dev/null @@ -1,10 +0,0 @@ -local M = {} -local status_ok, zen_mode = pcall(require, "zen-mode") -if not status_ok then -  return -end - -M.config = function() -  zen_mode.setup(O.plugin.zen) -end -return M diff --git a/lua/plugins.lua b/lua/plugins.lua index a9c625ce..129bc91d 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -14,6 +14,7 @@ if not packer_ok then  end  packer.init { +  -- package_root = require("packer.util").join_paths(vim.fn.stdpath "data", "lvim", "pack"),    git = { clone_timeout = 300 },    display = {      open_fn = function() @@ -26,50 +27,74 @@ 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) +  -- 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 = "VimEnter" } -  -- Telescope +  use { +    "kabouzeid/nvim-lspinstall", +    event = "VimEnter", +    config = function() +      require("lspinstall").setup() +    end, +  } +    use { "nvim-lua/popup.nvim" }    use { "nvim-lua/plenary.nvim" }    use { "tjdevries/astronauta.nvim" } + +  -- Telescope    use {      "nvim-telescope/telescope.nvim", -    config = [[require('lv-telescope')]], -    --event = "BufEnter", +    config = [[require('core.telescope').setup()]],    }    -- Autocomplete    use {      "hrsh7th/nvim-compe", -    event = "InsertEnter", +    -- event = "InsertEnter", +    config = function() +      require("core.compe").setup() +    end, +  } + +  -- Autopairs +  use { +    "windwp/nvim-autopairs", +    -- event = "InsertEnter", +    after = { "telescope.nvim" },      config = function() -      require("lv-compe").config() +      require "core.autopairs"      end,    } +  -- Snippets +    use { "hrsh7th/vim-vsnip", event = "InsertEnter" }    use { "rafamadriz/friendly-snippets", event = "InsertEnter" }    -- Treesitter -  use { "nvim-treesitter/nvim-treesitter" } +  use { +    "nvim-treesitter/nvim-treesitter", +    config = function() +      require("core.treesitter").setup() +    end, +  } -  -- Neoformat +  -- Formatter.nvim    use { -    "sbdchd/neoformat", +    "mhartington/formatter.nvim",      config = function() -      require "lv-neoformat" +      require "core.formatter"      end, -    event = "BufRead",    } +  -- NvimTree    use {      "kyazdani42/nvim-tree.lua", -    -- event = "BufEnter", +    -- event = "BufWinOpen",      -- cmd = "NvimTreeToggle",      commit = "fd7f60e242205ea9efc9649101c81a07d5f458bb",      config = function() -      require("lv-nvimtree").config() +      require("core.nvimtree").setup()      end,    } @@ -77,7 +102,7 @@ return require("packer").startup(function(use)      "lewis6991/gitsigns.nvim",      config = function() -      require("lv-gitsigns").config() +      require("core.gitsigns").setup()      end,      event = "BufRead",    } @@ -86,25 +111,15 @@ return require("packer").startup(function(use)    use {      "folke/which-key.nvim",      config = function() -      require "lv-which-key" +      require("core.which-key").setup()      end,      event = "BufWinEnter",    } -  -- Autopairs -  use { -    "windwp/nvim-autopairs", -    event = "InsertEnter", -    after = { "telescope.nvim" }, -    config = function() -      require "lv-autopairs" -    end, -  } -    -- Comments    use {      "terrortylor/nvim-comment", -    event = "BufWinEnter", +    event = "BufRead",      config = function()        local status_ok, nvim_comment = pcall(require, "nvim_comment")        if not status_ok then @@ -114,8 +129,13 @@ return require("packer").startup(function(use)      end,    } -  -- Color -  use { "christianchiarulli/nvcode-color-schemes.vim", opt = true } +  -- vim-rooter +  use { +    "airblade/vim-rooter", +    config = function() +      vim.g.rooter_silent_chdir = 1 +    end, +  }    -- Icons    use { "kyazdani42/nvim-web-devicons" } @@ -124,171 +144,78 @@ return require("packer").startup(function(use)    use {      "glepnir/galaxyline.nvim",      config = function() -      require "lv-galaxyline" +      require "core.galaxyline"      end, -    -- event = "VimEnter", +    event = "BufWinEnter", +    disable = not O.plugin.galaxyline.active,    }    use {      "romgrk/barbar.nvim",      config = function() -      require "lv-barbar" +      require "core.bufferline"      end,      event = "BufWinEnter",    } -  -- Builtins, these do not load by default - -  -- Dashboard -  use { -    "ChristianChiarulli/dashboard-nvim", -    event = "BufWinEnter", -    -- cmd = { "Dashboard", "DashboardNewFile", "DashboardJumpMarks" }, -    -- config = function() -    --   require("lv-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("lv-zen").config() -    end, -    disable = not O.plugin.zen.active, -  } - +  -- Debugging    use { -    "norcalli/nvim-colorizer.lua", -    event = "BufWinEnter", +    "mfussenegger/nvim-dap", +    -- event = "BufWinEnter",      config = function() -      require "lv-colorizer" -      -- vim.cmd "ColorizerReloadAllBuffers" +      require("core.dap").setup()      end, -    disable = not O.plugin.colorizer.active, +    disable = not O.plugin.dap.active,    } -  -- Treesitter playground -  use { -    "nvim-treesitter/playground", -    event = "BufRead", -    disable = not O.plugin.ts_playground.active, -  } - -  use { -    "lukas-reineke/indent-blankline.nvim", -    event = "BufRead", -    setup = function() -      vim.g.indentLine_enabled = 1 -      vim.g.indent_blankline_char = "▏" - -      vim.g.indent_blankline_filetype_exclude = { -        "help", -        "terminal", -        "dashboard", -      } -      vim.g.indent_blankline_buftype_exclude = { "terminal" } - -      vim.g.indent_blankline_show_trailing_blankline_indent = false -      vim.g.indent_blankline_show_first_indent_level = true -    end, -    disable = not O.plugin.indent_line.active, -  } - -  -- comments in context +  -- Debugger management    use { -    "JoosepAlviste/nvim-ts-context-commentstring", -    event = "BufRead", -    disable = not O.plugin.ts_context_commentstring.active, +    "Pocco81/DAPInstall.nvim", +    -- event = "BufWinEnter", +    -- event = "BufRead", +    disable = not O.plugin.dap.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, -  } +  -- Builtins, these do not load by default -  -- Debugging +  -- Dashboard    use { -    "mfussenegger/nvim-dap", +    "ChristianChiarulli/dashboard-nvim", +    event = "BufWinEnter",      config = function() -      require "lv-dap" +      require("core.dashboard").setup()      end, -    disable = not O.plugin.debug.active, +    disable = not O.plugin.dashboard.active,    } +  -- TODO: remove in favor of akinsho/nvim-toggleterm.lua    -- Floating terminal    use {      "numToStr/FTerm.nvim",      event = "BufWinEnter",      config = function() -      require("lv-floatterm").config() +      require("core.floatterm").setup()      end,      disable = not O.plugin.floatterm.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 +  -- Zen Mode    use { -    "nvim-telescope/telescope-project.nvim", +    "folke/zen-mode.nvim", +    cmd = "ZenMode",      event = "BufRead", -    setup = function() -      vim.cmd [[packadd telescope.nvim]] +    config = function() +      require("core.zen").setup()      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, +    disable = not O.plugin.zen.active,    } -  -- Debugger management -  use { -    "Pocco81/DAPInstall.nvim", -    -- event = "BufRead", -    disable = not O.plugin.dap_install.active, -  } +  ---------------------------------------------------------------------------------    -- LANGUAGE SPECIFIC GOES HERE    use {      "lervag/vimtex",      ft = "tex", -    config = function() -      require "lv-vimtex" -    end,    }    -- Rust tools @@ -316,56 +243,11 @@ return require("packer").startup(function(use)    use {      "mfussenegger/nvim-jdtls", +    -- ft = { "java" },      disable = not O.lang.java.java_tools.active,    } -  -- use { -  --   "jose-elias-alvarez/null-ls.nvim", -  --   ft = { -  --     "javascript", -  --     "javascriptreact", -  --     "javascript.jsx", -  --     "typescript", -  --     "typescriptreact", -  --     "typescript.tsx", -  --   }, -  --   config = function() -  --     require("null-ls").setup() -  --   end, -  -- } - -  -- Pretty parentheses -  use { -    "p00f/nvim-ts-rainbow", -    disable = not O.plugin.ts_rainbow.active, -  } - -  -- 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, -  } - +  -- Install user plugins    for _, plugin in pairs(O.user_plugins) do      packer.use(plugin)    end diff --git a/lua/settings.lua b/lua/settings.lua index cce8d87e..e4ee9e24 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -9,52 +9,52 @@ cmd "filetype plugin on"  cmd('let &titleold="' .. TERMINAL .. '"')  cmd "set inccommand=split"  cmd "set iskeyword+=-" -cmd "set whichwrap+=<,>,[,],h,l" + +if O.line_wrap_cursor_movement then +  cmd "set whichwrap+=<,>,[,],h,l" +end +  if O.transparent_window then    cmd "au ColorScheme * hi Normal ctermbg=none guibg=none"    cmd "au ColorScheme * hi SignColumn ctermbg=none guibg=none" +  cmd "let &fcs='eob: '"  end  ---  SETTINGS  --- -opt.backup = false -- creates a backup file -opt.clipboard = O.clipboard -- allows neovim to access the system clipboard -opt.cmdheight = O.cmdheight -- more space in the neovim command line for displaying messages -opt.colorcolumn = O.colorcolumn -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.scrolloff = O.scrolloff -- minimal number of screen lines to keep above and below the cursor -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 = O.shift_width -- the number of spaces inserted for each indentation  opt.shortmess:append "c" -opt.tabstop = O.tab_stop -- 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.numberwidth = O.number_width -- set number column width to 2 {default 4} -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 -opt.spell = O.spell -opt.spelllang = O.spelllang + +local disabled_built_ins = { +  "netrw", +  "netrwPlugin", +  "netrwSettings", +  "netrwFileHandlers", +  "gzip", +  "zip", +  "zipPlugin", +  "tar", +  "tarPlugin", -- 'man', +  "getscript", +  "getscriptPlugin", +  "vimball", +  "vimballPlugin", +  "2html_plugin", +  "logipat", +  "rrhelper", +  "spellfile_plugin", +  -- 'matchit', 'matchparen', 'shada_plugin', +} + +if O.leader_key == " " or O.leader_key == "space" then +  vim.g.mapleader = ' ' +else +  vim.g.mapleader = O.leader_key +end + +for _, plugin in pairs(disabled_built_ins) do +  vim.g["loaded_" .. plugin] = 1 +end + +for k, v in pairs(O.default_options) do +  vim.opt[k] = v +end diff --git a/lua/spacegray/Git.lua b/lua/spacegray/Git.lua new file mode 100644 index 00000000..f1a2ed39 --- /dev/null +++ b/lua/spacegray/Git.lua @@ -0,0 +1,10 @@ +local Git = { +		SignAdd = {fg = C.sign_add, }, +		SignChange = {fg = C.sign_change, }, +		SignDelete = {fg = C.sign_delete, }, +		GitSignsAdd = {fg = C.sign_add, }, +		GitSignsChange = {fg = C.sign_change, }, +		GitSignsDelete = {fg = C.sign_delete, }, +} + +return Git
\ No newline at end of file diff --git a/lua/spacegray/LSP.lua b/lua/spacegray/LSP.lua new file mode 100644 index 00000000..eb674175 --- /dev/null +++ b/lua/spacegray/LSP.lua @@ -0,0 +1,92 @@ +local LSP = { +		LspDiagnosticsDefaultError = {fg = C.error_red, }, +		LspDiagnosticsDefaultWarning = {fg = C.warning_orange, }, +		LspDiagnosticsDefaultInformation = {fg = C.info_yellow, }, +		LspDiagnosticsDefaultHint = {fg = C.hint_blue, }, +		LspDiagnosticsVirtualTextError = {fg = C.error_red, }, +		LspDiagnosticsVirtualTextWarning = {fg = C.warning_orange, }, +		LspDiagnosticsVirtualTextInformation = {fg = C.info_yellow, }, +		LspDiagnosticsVirtualTextHint = {fg = C.hint_blue, }, +		LspDiagnosticsFloatingError = {fg = C.error_red, }, +		LspDiagnosticsFloatingWarning = {fg = C.warning_orange, }, +		LspDiagnosticsFloatingInformation = {fg = C.info_yellow, }, +		LspDiagnosticsFloatingHint = {fg = C.hint_blue, }, +		LspDiagnosticsSignError = {fg = C.error_red, }, +		LspDiagnosticsSignWarning = {fg = C.warning_orange, }, +		LspDiagnosticsSignInformation = {fg = C.info_yellow, }, +		LspDiagnosticsSignHint = {fg = C.hint_blue, }, +		LspDiagnosticsError = {fg = C.error_red, }, +		LspDiagnosticsWarning = {fg = C.warning_orange, }, +		LspDiagnosticsInformation = {fg = C.info_yellow, }, +		LspDiagnosticsHint = {fg = C.hint_blue, }, +		LspDiagnosticsUnderlineError = {fg = C.error_red, }, +		LspDiagnosticsUnderlineWarning = {fg = C.warning_orange, }, +		LspDiagnosticsUnderlineInformation = {fg = C.info_yellow, }, +		LspDiagnosticsUnderlineHint = {fg = C.hint_blue, }, +		QuickScopePrimary = {fg = C.cyan_test, style = "underline", }, +		QuickScopeSecondary = {fg = C.purple_test, style = "underline", }, +		TelescopeSelection = {fg = C.hint_blue, }, +		TelescopeMatching = {fg = C.info_yellow, style = "bold", }, +		TelescopeBorder = {fg = C.cyan, bg = C.bg, }, +		NvimTreeFolderIcon = {fg = C.blue, }, +		NvimTreeIndentMarker = {fg = C.gray, }, +		NvimTreeNormal = {fg = C.light_gray, bg = C.alt_bg, }, +		NvimTreeVertSplit = {fg = C.alt_bg, bg = C.alt_bg, }, +		NvimTreeFolderName = {fg = C.blue, }, +		NvimTreeOpenedFolderName = {fg = C.cyan, style = "italic", }, +		NvimTreeImageFile = {fg = C.purple, }, +		NvimTreeSpecialFile = {fg = C.orange, }, +		NvimTreeGitStaged = {fg = C.sign_add, }, +		NvimTreeGitNew = {fg = C.sign_add, }, +		NvimTreeGitDirty = {fg = C.sign_add, }, +		NvimTreeGitDeleted = {fg = C.sign_delete, }, +		NvimTreeGitMerge = {fg = C.sign_change, }, +		NvimTreeGitRenamed = {fg = C.sign_change, }, +		NvimTreeSymlink = {fg = C.cyan, }, +		NvimTreeRootFolder = {fg = C.fg, style = "bold", }, +		NvimTreeExecFile = {fg = C.green, }, +		BufferCurrent = {fg = C.fg, bg = C.bg, }, +		BufferCurrentIndex = {fg = C.fg, bg = C.bg, }, +		BufferCurrentMod = {fg = C.info_yellow, bg = C.bg, }, +		BufferCurrentSign = {fg = C.hint_blue, bg = C.bg, }, +		BufferCurrentTarget = {fg = C.red, bg = C.bg, style = "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.hint_blue, bg = C.bg, }, +		BufferVisibleTarget = {fg = C.red, bg = C.bg, style = "bold", }, +		BufferInactive = {fg = C.gray, bg = C.alt_bg, }, +		BufferInactiveIndex = {fg = C.gray, bg = C.alt_bg, }, +		BufferInactiveMod = {fg = C.info_yellow, bg = C.alt_bg, }, +		BufferInactiveSign = {fg = C.gray, bg = C.alt_bg, }, +		BufferInactiveTarget = {fg = C.red, bg = C.alt_bg, style = "bold", }, +		StatusLine = {fg = C.alt_bg, }, +		StatusLineNC = {fg = C.alt_bg, }, +		StatusLineSeparator = {fg = C.alt_bg, }, +		StatusLineTerm = {fg = C.alt_bg, }, +		StatusLineTermNC = {fg = C.alt_bg, }, +		CodiVirtualText = {fg = C.pale_purple, }, +		IndentBlanklineContextChar = {fg = C.accent, }, +		DashboardHeader = {fg = C.blue, }, +		DashboardCenter = {fg = C.purple, }, +		DashboardFooter = {fg = C.cyan, }, +		CompeDocumentation = {bg = C.alt_bg, }, +		DiffViewNormal = {fg = C.gray, bg = C.alt_bg, }, +		DiffviewStatusAdded = {fg = C.sign_add, }, +		DiffviewStatusModified = {fg = C.sign_change, }, +		DiffviewStatusRenamed = {fg = C.sign_change, }, +		DiffviewStatusDeleted = {fg = C.sign_delete, }, +		DiffviewFilePanelInsertion = {fg = C.sign_add, }, +		DiffviewFilePanelDeletion = {fg = C.sign_delete, }, +		DiffviewVertSplit = {bg = C.bg, }, +		diffAdded = {fg = C.sign_add, }, +		diffRemoved = {fg = C.sign_delete, }, +		diffFileId = {fg = C.blue, style = "bold,reverse", }, +		diffFile = {fg = C.alt_bg, }, +		diffNewFile = {fg = C.green, }, +		diffOldFile = {fg = C.red, }, +		debugPc = {bg = C.cyan, }, +		debugBreakpoint = {fg = C.red, style = "reverse", }, +} + +return LSP
\ No newline at end of file diff --git a/lua/spacegray/Treesitter.lua b/lua/spacegray/Treesitter.lua new file mode 100644 index 00000000..95348406 --- /dev/null +++ b/lua/spacegray/Treesitter.lua @@ -0,0 +1,56 @@ +local Treesitter = { +		TSComment = {fg = C.gray, }, +		TSAnnotation = {fg = C.purple, }, +		TSAttribute = {fg = C.cyan, }, +		TSConstructor = {fg = C.purple, }, +		TSType = {fg = C.purple, }, +		TSTypeBuiltin = {fg = C.purple, }, +		TSConditional = {fg = C.blue, }, +		TSException = {fg = C.blue, }, +		TSInclude = {fg = C.blue, }, +		TSKeyword = {fg = C.blue, }, +		TSKeywordFunction = {fg = C.blue, }, +		TSLabel = {fg = C.blue, }, +		TSNamespace = {fg = C.blue, }, +		TSRepeat = {fg = C.blue, }, +		TSConstant = {fg = C.orange, }, +		TSConstBuiltin = {fg = C.orange, }, +		TSFloat = {fg = C.red, }, +		TSNumber = {fg = C.red, }, +		TSBoolean = {fg = C.red, }, +		TSCharacter = {fg = C.light_green, }, +		TSError = {fg = C.error_red, }, +		TSFunction = {fg = C.yellow, }, +		TSFuncBuiltin = {fg = C.yellow, }, +		TSMethod = {fg = C.yellow, }, +		TSConstMacro = {fg = C.cyan, }, +		TSFuncMacro = {fg = C.cyan, }, +		TSVariable = {fg = C.white, }, +		TSVariableBuiltin = {fg = C.cyan, }, +		TSProperty = {fg = C.cyan, }, +		TSOperator = {fg = C.gray_blue, }, +		TSField = {fg = C.white, }, +		TSParameter = {fg = C.white, }, +		TSParameterReference = {fg = C.white, }, +		TSSymbol = {fg = C.white, }, +		TSText = {fg = C.fg, }, +		TSPunctDelimiter = {fg = C.gray, }, +		TSTagDelimiter = {fg = C.gray, }, +		TSPunctBracket = {fg = C.gray, }, +		TSPunctSpecial = {fg = C.gray, }, +		TSString = {fg = C.green, }, +		TSStringRegex = {fg = C.light_green, }, +		TSStringEscape = {fg = C.light_green, }, +		TSTag = {fg = C.blue, }, +		TSEmphasis = {style = "italic", }, +		TSUnderline = {style = "underline", }, +		TSTitle = {fg = C.blue, style = "bold", }, +		TSLiteral = {fg = C.green, }, +		TSURI = {fg = C.cyan, style = "underline", }, +		TSKeywordOperator = {fg = C.blue, }, +		TSStructure = {fg = C.purple_test, }, +		TSStrong = {fg = C.yellow, }, +		TSQueryLinterError = {fg = C.warning_orange, }, +} + +return Treesitter
\ No newline at end of file diff --git a/lua/spacegray/Whichkey.lua b/lua/spacegray/Whichkey.lua new file mode 100644 index 00000000..2c02f11b --- /dev/null +++ b/lua/spacegray/Whichkey.lua @@ -0,0 +1,9 @@ +local Whichkey = { +		WhichKey = {fg = C.purple, }, +		WhichKeySeperator = {fg = C.green, }, +		WhichKeyGroup = {fg = C.blue, }, +		WhichKeyDesc = {fg = C.cyan, }, +		WhichKeyFloat = {bg = C.alt_bg, }, +} + +return Whichkey
\ No newline at end of file diff --git a/lua/spacegray/config.lua b/lua/spacegray/config.lua new file mode 100644 index 00000000..f9c10951 --- /dev/null +++ b/lua/spacegray/config.lua @@ -0,0 +1,23 @@ +local config + +vim = vim or { g = {}, o = {} } + +local function opt(key, default) +    if vim.g[key] == nil then +        return default +    end +    if vim.g[key] == 0 then +        return false +    end +    return vim.g[key] +end + +config = { +    transparent_background = opt("transparent_background", false), +    italic_comments = opt("italic_keywords", true) and "italic" or "NONE", +    italic_keywords = opt("italic_keywords", true) and "italic" or "NONE", +    italic_functions = opt("italic_function", false) and "italic" or "NONE", +    italic_variables = opt("italic_variables", true) and "italic" or "NONE", +} + +return config
\ No newline at end of file diff --git a/lua/spacegray/highlights.lua b/lua/spacegray/highlights.lua new file mode 100644 index 00000000..9a20b46d --- /dev/null +++ b/lua/spacegray/highlights.lua @@ -0,0 +1,99 @@ +local highlights = { +		Normal = {fg = C.fg, bg = Config.transparent_background and "NONE" or C.bg, }, +		SignColumn = {bg = C.bg, }, +		MsgArea = {fg = C.fg, bg = C.bg, }, +		ModeMsg = {fg = C.fg, bg = C.bg, }, +		MsgSeparator = {fg = C.fg, bg = C.bg, }, +		SpellBad = {fg = C.error_red, style = "underline", }, +		SpellCap = {fg = C.yellow, style = "underline", }, +		SpellLocal = {fg = C.green, style = "underline", }, +		SpellRare = {fg = C.purple, style = "underline", }, +		NormalNC = {fg = C.fg, bg = C.bg, }, +		Pmenu = {fg = C.white, bg = C.accent, }, +		PmenuSel = {fg = C.alt_bg, bg = C.blue, }, +		WildMenu = {fg = C.alt_bg, bg = C.blue, }, +		CursorLineNr = {fg = C.light_gray, style = "bold", }, +		Comment = {fg = C.gray, style = "italic", }, +		Folded = {fg = C.accent, bg = C.alt_bg, }, +		FoldColumn = {fg = C.accent, bg = C.alt_bg, }, +		LineNr = {fg = C.gray, }, +		FloatBoder = {fg = C.gray, bg = C.alt_bg, }, +		Whitespace = {fg = C.gray, }, +		VertSplit = {fg = C.bg, bg = C.accent, }, +		CursorLine = {bg = C.alt_bg, }, +		CursorColumn = {bg = C.alt_bg, }, +		ColorColumn = {bg = C.alt_bg, }, +		NormalFloat = {bg = C.alt_bg, }, +		Visual = {bg = C.alt_bg, }, +		VisualNOS = {bg = C.alt_bg, }, +		WarningMsg = {fg = C.error_red, bg = C.bg, }, +		DiffAdd = {fg = C.alt_bg, bg = C.sign_add, }, +		DiffChange = {fg = C.alt_bg, bg = C.sign_change, style = "underline", }, +		DiffDelete = {fg = C.alt_bg, bg = C.sign_delete, }, +		QuickFixLine = {bg = C.accent, }, +		PmenuSbar = {bg = C.alt_bg, }, +		PmenuThumb = {bg = C.white, }, +		MatchWord = {style = "underline", }, +		MatchParen = {fg = C.pale_purple, bg = C.bg, style = "underline", }, +		MatchWordCur = {style = "underline", }, +		MatchParenCur = {style = "underline", }, +		Cursor = {fg = C.cursor_fg, bg = C.cursor_bg, }, +		lCursor = {fg = C.cursor_fg, bg = C.cursor_bg, }, +		CursorIM = {fg = C.cursor_fg, bg = C.cursor_bg, }, +		TermCursor = {fg = C.cursor_fg, bg = C.cursor_bg, }, +		TermCursorNC = {fg = C.cursor_fg, bg = C.cursor_bg, }, +		Conceal = {fg = C.accent, }, +		Directory = {fg = C.blue, }, +		SpecialKey = {fg = C.blue, style = "bold", }, +		Title = {fg = C.blue, style = "bold", }, +		ErrorMsg = {fg = C.error_red, bg = C.bg, style = "bold", }, +		Search = {fg = C.hint_blue, bg = C.alt_bg, }, +		IncSearch = {fg = C.hint_blue, bg = C.alt_bg, }, +		Substitute = {fg = C.alt_bg, bg = C.gray_blue, }, +		MoreMsg = {fg = C.cyan, }, +		Question = {fg = C.cyan, }, +		EndOfBuffer = {fg = C.bg, }, +		NonText = {fg = C.bg, }, +		Variable = {fg = C.white, }, +		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 = {fg = C.purple, }, +		Structure = {fg = C.purple, }, +		Typedef = {fg = C.purple, }, +		Keyword = {fg = C.blue, }, +		Statement = {fg = C.blue, }, +		Conditional = {fg = C.blue, }, +		Repeat = {fg = C.blue, }, +		Label = {fg = C.blue, }, +		Exception = {fg = C.blue, }, +		Include = {fg = C.blue, }, +		PreProc = {fg = C.cyan, }, +		Define = {fg = C.cyan, }, +		Macro = {fg = C.cyan, }, +		PreCondit = {fg = C.cyan, }, +		Special = {fg = C.orange, }, +		SpecialChar = {fg = C.orange, }, +		Tag = {fg = C.blue, }, +		Debug = {fg = C.red, }, +		Delimiter = {fg = C.gray, }, +		SpecialComment = {fg = C.gray, }, +		Underlined = {style = "underline", }, +		Bold = {style = "bold", }, +		Italic = {style = "italic", }, +		Ignore = {fg = C.cyan, bg = C.bg, style = "bold", }, +		Todo = {fg = C.red, bg = C.bg, style = "bold", }, +		Error = {fg = C.error_red, bg = C.bg, style = "bold", }, +		TabLine = {fg = C.white, bg = C.alt_bg, }, +		TabLineSel = {fg = C.white, bg = C.alt_bg, }, +		TabLineFill = {fg = C.white, bg = C.alt_bg, }, +} + +return highlights
\ No newline at end of file diff --git a/lua/spacegray/init.lua b/lua/spacegray/init.lua new file mode 100644 index 00000000..0a8e748e --- /dev/null +++ b/lua/spacegray/init.lua @@ -0,0 +1,26 @@ +vim.api.nvim_command("hi clear") +if vim.fn.exists("syntax_on") then +    vim.api.nvim_command("syntax reset") +end +vim.o.background = "dark" +vim.o.termguicolors = true +vim.g.colors_name = "spacegray" + +local util = require("spacegray.util") +Config = require("spacegray.config") +C = require("spacegray.palette") +local highlights = require("spacegray.highlights") +local Treesitter = require("spacegray.Treesitter") +local markdown = require("spacegray.markdown") +local Whichkey = require("spacegray.Whichkey") +local Git = require("spacegray.Git") +local LSP = require("spacegray.LSP") + + +local skeletons = { +    highlights, Treesitter, markdown, Whichkey, Git, LSP +} + +for _, skeleton in ipairs(skeletons) do +    util.initialise(skeleton) +end
\ No newline at end of file diff --git a/lua/spacegray/markdown.lua b/lua/spacegray/markdown.lua new file mode 100644 index 00000000..19863dc8 --- /dev/null +++ b/lua/spacegray/markdown.lua @@ -0,0 +1,27 @@ +local markdown = { +		markdownBlockquote = {fg = C.accent, }, +		markdownBold = {fg = C.yellow, style = "bold", }, +		markdownCode = {fg = C.green, }, +		markdownCodeBlock = {fg = C.green, }, +		markdownCodeDelimiter = {fg = C.green, }, +		markdownH1 = {fg = C.blue, }, +		markdownH2 = {fg = C.blue, }, +		markdownH3 = {fg = C.blue, }, +		markdownH4 = {fg = C.blue, }, +		markdownH5 = {fg = C.blue, }, +		markdownH6 = {fg = C.blue, }, +		markdownHeadingDelimiter = {fg = C.red, }, +		markdownHeadingRule = {fg = C.accent, }, +		markdownId = {fg = C.purple, }, +		markdownIdDeclaration = {fg = C.blue, }, +		markdownIdDelimiter = {fg = C.light_gray, }, +		markdownLinkDelimiter = {fg = C.light_gray, }, +		markdownItalic = {style = "italic", }, +		markdownLinkText = {fg = C.blue, }, +		markdownListMarker = {fg = C.red, }, +		markdownOrderedListMarker = {fg = C.red, }, +		markdownRule = {fg = C.accent, }, +		markdownUrl = {fg = C.cyan, style = "underline", }, +} + +return markdown
\ No newline at end of file diff --git a/lua/spacegray/palette.lua b/lua/spacegray/palette.lua new file mode 100644 index 00000000..49e429e5 --- /dev/null +++ b/lua/spacegray/palette.lua @@ -0,0 +1,33 @@ +local colors = { +  fg = "#c8c9d1", +  bg = "#212121", +  alt_bg = "#2a2a2a", +  accent = "#383d45", +  white = "#c8c9d1", +  gray = "#858585", +  light_gray = "#c8c9c1", +  blue = "#5486c0", +  gray_blue = "#66899d", +  cyan = "#65a7c5", +  red = "#b04b57", +  green = "#87b379", +  light_green = "#b2d77c", +  yellow = "#eeba5a", +  orange = "#c6735a", +  purple = "#bf83c1", +  pale_purple = "#7199ee", +  magenta = "#D16D9E", +  cursor_fg = "#515052", +  cursor_bg = "#AEAFAD", +  sign_add = "#587c0c", +  sign_change = "#0c7d9d", +  sign_delete = "#94151b", +  error_red = "#F44747", +  warning_orange = "#ff8800", +  info_yellow = "#FFCC66", +  hint_blue = "#4FC1FF", +  purple_test = "#ff00ff", +  cyan_test = "#00ffff", +} + +return colors diff --git a/lua/spacegray/util.lua b/lua/spacegray/util.lua new file mode 100644 index 00000000..1cc5a009 --- /dev/null +++ b/lua/spacegray/util.lua @@ -0,0 +1,22 @@ +local M = {} + +local function highlight(group, properties) +    local bg = properties.bg == nil and "" or "guibg=" .. properties.bg +    local fg = properties.fg == nil and "" or "guifg=" .. properties.fg +    local style = properties.style == nil and "" or "gui=" .. properties.style + +    local cmd = table.concat({ +        "highlight", group, bg, fg, style +    }, " ") + +    vim.api.nvim_command(cmd) +end + + +function M.initialise(skeleton) +    for group, properties in pairs(skeleton) do +        highlight(group, properties) +    end +end + +return M
\ No newline at end of file diff --git a/utils/installer/install.sh b/utils/installer/install.sh index dedd1dc8..0473bbab 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -1,5 +1,6 @@  #!/bin/sh - +#Set Variable to master is not set differently +LVBRANCH="${LVBRANCH:-master}"  set -o nounset # error when referencing undefined variable  set -o errexit # exit when command fails @@ -100,7 +101,7 @@ installpacker() {  cloneconfig() {      echo "Cloning LunarVim configuration" -    git clone --branch master https://github.com/ChristianChiarulli/lunarvim.git ~/.config/nvim +    git clone --branch $LVBRANCH https://github.com/ChristianChiarulli/lunarvim.git ~/.config/nvim      cp $HOME/.config/nvim/utils/installer/lv-config.example-no-ts.lua $HOME/.config/nvim/lv-config.lua      nvim --headless \          +'autocmd User PackerComplete sleep 100m | qall' \ @@ -181,6 +182,13 @@ installextrapackages() {  # Welcome  echo 'Installing LunarVim' +if [[ $* == *--overwrite* ]]; then +  echo '!!Warning!! -> Removing all nvim related config because of the --overwrite flag' +  rm -rf "$HOME/.config/nvim" +  rm -rf "$HOME/.cache/nvim" +  rm -rf "$HOME/.local/share/nvim/site/pack/packer" +fi +  # move old nvim directory if it exists  [ -d "$HOME/.config/nvim" ] && moveoldnvim diff --git a/utils/installer/lv-config.example-no-ts.lua b/utils/installer/lv-config.example-no-ts.lua index 3c7fecb1..33d9f433 100644 --- a/utils/installer/lv-config.example-no-ts.lua +++ b/utils/installer/lv-config.example-no-ts.lua @@ -7,28 +7,23 @@ a global executable or a path to  an executable  ]]  -- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT +  -- general +  O.format_on_save = true -O.auto_complete = true +O.completion.autocomplete = true  O.colorscheme = "spacegray"  O.auto_close_tree = 0 -O.wrap_lines = false -O.timeoutlen = 100 +O.default_options.wrap = true +O.default_options.timeoutlen = 100  O.leader_key = " " -O.ignore_case = true -O.smart_case = true --- TODO User Config for predefined plugins +-- TODO: User Config for predefined plugins  -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile  O.plugin.dashboard.active = true -O.plugin.colorizer.active = false -O.plugin.ts_playground.active = false -O.plugin.indent_line.active = false +O.plugin.floatterm.active = true  O.plugin.zen.active = false - --- dashboard --- O.dashboard.custom_header = {""} --- O.dashboard.footer = {""} +O.plugin.zen.window.height = 0.90  -- if you don't want all the parsers change this to a table of the ones you want  O.treesitter.ensure_installed = {} @@ -40,10 +35,22 @@ O.treesitter.highlight.enabled = true  O.lang.python.isort = true  O.lang.python.diagnostics.virtual_text = true  O.lang.python.analysis.use_library_code_types = true +-- to change default formatter from yapf to black +-- O.lang.python.formatter.exe = "black" +-- O.lang.python.formatter.args = {"-"} + +-- go +-- to change default formatter from gofmt to goimports +-- O.lang.formatter.go.exe = "goimports"  -- javascript  O.lang.tsserver.linter = nil +-- latex +-- O.lang.latex.auto_save = false +-- O.lang.latex.ignore_errors = { } + +  -- Additional Plugins  -- O.user_plugins = {  --     {"folke/tokyonight.nvim"}, { diff --git a/utils/installer/lv-config.example.lua b/utils/installer/lv-config.example.lua index b61a0271..7072c60c 100644 --- a/utils/installer/lv-config.example.lua +++ b/utils/installer/lv-config.example.lua @@ -7,28 +7,23 @@ a global executable or a path to  an executable  ]]  -- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT +  -- general +  O.format_on_save = true -O.auto_complete = true +O.completion.autocomplete = true  O.colorscheme = "spacegray"  O.auto_close_tree = 0 -O.wrap_lines = false -O.timeoutlen = 100 +O.default_options.wrap = true +O.default_options.timeoutlen = 100  O.leader_key = " " -O.ignore_case = true -O.smart_case = true --- TODO User Config for predefined plugins +-- TODO: User Config for predefined plugins  -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile  O.plugin.dashboard.active = true -O.plugin.colorizer.active = false -O.plugin.ts_playground.active = false -O.plugin.indent_line.active = false +O.plugin.floatterm.active = true  O.plugin.zen.active = false - --- dashboard --- O.dashboard.custom_header = {""} --- O.dashboard.footer = {""} +O.plugin.zen.window.height = 0.90  -- if you don't want all the parsers change this to a table of the ones you want  O.treesitter.ensure_installed = "maintained" @@ -36,14 +31,31 @@ O.treesitter.ignore_install = { "haskell" }  O.treesitter.highlight.enabled = true  -- python --- O.python.linter = 'flake8' +-- O.lang.python.linter = 'flake8'  O.lang.python.isort = true  O.lang.python.diagnostics.virtual_text = true  O.lang.python.analysis.use_library_code_types = true +-- to change default formatter from yapf to black +-- O.lang.python.formatter.exe = "black" +-- O.lang.python.formatter.args = {"-"} + +-- go +-- to change default formatter from gofmt to goimports +-- O.lang.formatter.go.exe = "goimports"  -- javascript  O.lang.tsserver.linter = nil +-- rust +-- O.lang.rust.formatter = { +--   exe = "rustfmt", +--   args = {"--emit=stdout", "--edition=2018"}, +-- } + +-- latex +-- O.lang.latex.auto_save = false +-- O.lang.latex.ignore_errors = { } +  -- Additional Plugins  -- O.user_plugins = {  --     {"folke/tokyonight.nvim"}, { diff --git a/utils/lv-vscode/init.vim b/utils/lv-vscode/init.vim index 1aa30934..d85184ea 100644 --- a/utils/lv-vscode/init.vim +++ b/utils/lv-vscode/init.vim @@ -1,6 +1,6 @@  " packadd quickscope -execute 'luafile ' . stdpath('config') . '/lua/settings.lua' +" execute 'luafile ' . stdpath('config') . '/lua/settings.lua'  function! s:manageEditorSize(...)      let count = a:1 | 
