Compare commits

...
408 Commits
Author SHA1 Message Date
c-my 4252f585a6 fix: move option "nvim_tree_indent_markers" to setup 2022-04-11 01:06:46 +08:00
Justin Perez 6061f9455d Typecheck return value of chadrc; propagate errors
* Don't blindly assume the only way `require "custom/chadrc.lua" can
  fail is that the file doesn't exist.
* Provide user with a more useful message when return value is wrong
2022-04-10 17:48:10 +05:30
guoliang 3d78ef3474 fix: insert mode nav shortcut 2022-04-10 17:46:16 +05:30
siduck 3585ae3dfd use better keybinds for spawning terms 2022-04-10 15:42:46 +05:30
justin-f-perez cbc813388d override default branch for bufferline
By default packer tries to use "master" for the branch of any plugin that doesn't have a branch explicitly defined. However, the bufferline authors recently renamed their default branch from "master" to main. Thus, packer will work fine with bufferline for any new clones, but it will fail to update for anyone who had the old branch name "master" set.

See also: https://github.com/wbthomason/packer.nvim/issues/86
2022-04-10 09:17:26 +05:30
zbirenbaum 4a888ad037 add float term mappings and config 2022-04-09 01:32:27 -04:00
zbirenbaum d7522a940d add disable option for statusline hide au 2022-04-09 08:49:19 +05:30
Arman.H b21defd4e4 refactor: remove unnecessary mapping 2022-04-07 21:57:11 +05:30
zbirenbaum 03563f30cc add new location option for chadterm 2022-04-02 14:33:45 +05:30
siduck 232b453c29 avoid using default mapping for copying 2022-04-01 19:36:29 +05:30
siduck af22bee84a use previous split ratio for horizontal term buffer 2022-04-01 13:06:14 +05:30
siduck bf89f0bf5f fix typo in mapping 2022-04-01 12:54:37 +05:30
siduck 63d54926a4 add mappings to spawn nobufflisted terms 2022-04-01 11:47:05 +05:30
siduck 4ca8d781cf add option to enable inbuilt plugins (#919) (#914) 2022-03-31 12:52:23 +05:30
zbirenbaum e328b86336 add terminal customizations options to default config 2022-03-31 06:51:36 +05:30
zbirenbaum 1face444b8 change plugin init to config terminal on load extensions, change mappings to use new chadterm 2022-03-31 06:51:36 +05:30
siduck b9e8f489ed add new readme badges for matrix and telegram 2022-03-28 21:20:14 +05:30
siduck 6e9c78d1af avoid using default keymap (#910) 2022-03-26 22:20:39 +05:30
tuberry 47e4f0361f fix: let hl_override be compatible with custom themes
load `hl_override` after the theme
2022-03-26 19:58:29 +05:30
tuberry ec5017126c feat: support themes other than defaults
Try to activate a theme if not presented in defaults. Accordingly,
add the option `ui.colors` to provide the missing `hl_theme*` in
the custom theme.
2022-03-26 16:00:31 +05:30
zbirenbaum 958a62bc67 fix nvimtree vim globals not having any effect 2022-03-24 21:28:11 +05:30
siduck 75dbf5027d fix dashboard not showing | (#888) 2022-03-20 07:30:30 +05:30
i3cheese 229ad7e00d Fix j -> gj mapping. 2022-03-19 11:27:11 +05:30
johnsiras ec274db8b2 Make the alpha override-abble. 2022-03-19 10:22:09 +05:30
Freyskeyd 4ad0bf1b22 Exposing on_attach to configure plugins in custom
Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
2022-03-13 18:33:51 +05:30
siduck f58c7e7b9e fix nvimtree opening half on file open (#606) 2022-03-12 08:39:16 +05:30
socialsmoker223 1278a3b703 Imporve luasnip Tab jump behaviour 2022-03-07 22:06:13 +05:30
Daniel Boll ef6ecab861 fix(null-ls): stop null-ls prompt for multiple formaters
add `client.resolved_capabilities.{document_formatting,document_range_formatting}` to on_attach of lspconfig in order to eliminate null-ls prompt for 2 formaters. Not tested with more formaters like in python, I'd say that then it'll prompt still

Signed-off-by: Daniel Boll <danielboll.academico@gmail.com>
2022-03-07 19:18:14 +05:30
siduck e1cdf92a01 clean nvimtree config
recently nvimtree had some updates regarding these options moving into the setup table of its config and these were the default ones so i removed it!
2022-03-02 14:43:29 +05:30
siduck ac392cd29b misc
cb531cd90b
2022-03-02 14:36:21 +05:30
siduck cb531cd90b shorten some long mapping vars, fix (#849)| fix (#836) 2022-03-01 12:43:34 +05:30
zbirenbaum 1777be0064 fix for treesitter not loading on creating new file 2022-03-01 08:00:21 +05:30
Ruben Verheyden 5ec6112a59 fix for (#844) Replace-paste at end of line incorrect 2022-02-27 18:25:06 +05:30
Jay Patel 0cf5d77f72 feat: Run :TSUpdate on TS Install / Update
https://github.com/NvChad/NvChad/pull/838

> TreeSitter recommends running `:TSUpdate` after update with TS or on (re-)installation of Treesitter. Reference example recommended by TS: https://github.com/nvim-treesitter/nvim-treesitter/wiki/Installation
2022-02-24 09:52:16 +05:30
Niclas 05e48656de Fix typo, become chadributor 2022-02-22 19:39:19 +05:30
zbirenbaum 76d194b141 fix for getting config settings from plugin table 2022-02-20 11:46:06 +05:30
siduck ceaf02e0bf replace dashboard with alpha.nvim (#816) 2022-02-20 11:44:43 +05:30
zbirenbaum c1e372e2cd fix autocmd breaking term plugins 2022-02-20 08:08:06 +05:30
siduck 9ca0af1a24 disable nvimtree hijack on buffers
https://github.com/kyazdani42/nvim-tree.lua/issues/992
2022-02-17 19:45:43 +05:30
zbirenbaum 4be722d4a6 fix global variable causing issues 2022-02-15 08:12:51 +05:30
siduck d9d380e41b clean example chadrc
Some of the recent issues have been caused when the user doesnt even have the custom.plugins file and requires it in chadrc i.e copies the example chadrc as it is without reading it, that results in chadrc not working at all
2022-02-14 16:15:39 +05:30
zbirenbaum f81531df42 improve method of adding and removing plugins 2022-02-14 16:11:41 +05:30
siduck a21e884983 remove snippet option for cmp | fix telescope first time delay 2022-02-12 07:31:23 +05:30
Felix Kratz ca481b1385 fix acid blue cursor 2022-02-11 06:57:48 +05:30
Akianonymus e7bba86ccf plugins/colorizer: Move to our org fork 2022-02-07 20:21:11 +05:30
siduck baaa7f0d4b fix (#793) 2022-02-06 10:16:32 +05:30
siduck 748f0db485 lazy load Comment.nvim on gcc keybind (#801) 2022-02-05 19:09:25 +05:30
siduck 7b7c204e23 correct repo name for extensions plugin 2022-02-04 22:19:06 +05:30
siduck f4c4d8f6c6 enable snippets by default 2022-02-04 22:17:10 +05:30
siduck 70baf718d2 clean highlights definitions 2022-02-04 12:19:16 +05:30
Akianonymus 46db63749f cmp: Add border to floating docs, move completeopt inside config
format files
2022-02-04 06:12:31 +05:30
Akianonymus 5a3ac7300d plugins/lspkind_icons: Add icon for TypeParameter 2022-02-04 06:12:31 +05:30
siduck 71295f9b61 re-add lspconfig capabilities 2022-02-02 22:26:04 +05:30
siduck 3ee787fe08 remove un-needed filetype option 2022-02-02 10:07:49 +05:30
socialsmoker223 2eab84f8f1 lunasnip super-tab like mapping example from hrsh7th/nvim-cmp 2022-02-01 18:56:33 +05:30
siduck d0ad028efc rm conflict in mappings
leader n for nummber line conflicted with leader nn
2022-01-31 14:31:21 +05:30
i3cheese 195f6f3621 Toggle relative numbers and copy to system clipboards mappings 2022-01-31 14:45:07 +05:30
siduck 1f73ef0ec6 clean remove_default_plugins function 2022-01-31 14:13:51 +05:30
Akianonymus 6b06bb9ed4 Remove duplicate code, missed in d8dabe9 | Format files 2022-01-31 11:13:31 +05:30
zbirenbaum d8dabe9e5e defer and restore shada 2022-01-31 10:40:36 +05:30
zbirenbaum bd98d76ad6 improve startup time with shada load deferral 2022-01-31 09:03:20 +05:30
zbirenbaum e87c10f225 fix for removals 2022-01-31 08:07:09 +05:30
zbirenbaum 4bda425371 added field for removing plugins to default config and call to plugin removal in init.lua 2022-01-31 07:08:15 +05:30
zbirenbaum 4b68a75853 added helper functions for removing plugins from default plugin table 2022-01-31 07:08:15 +05:30
i3Cheese a3a5b506de fix empty snippets 2022-01-31 06:21:33 +05:30
Akianonymus de246fa0f5 Resolve https://github.com/NvChad/NvChad/issues/774 | Format 2022-01-30 23:09:25 +05:30
siduck 64c32d2e5e clean packer config | Breaking change 2022-01-30 12:51:46 +05:30
siduck e8b31c9308 add impatient.nvim and filetype.nvim | improve startuptime 2022-01-29 23:02:23 +05:30
siduck 50aa25f307 remove duplicate var | tidy 2022-01-29 20:03:59 +05:30
siduck 0349de6d10 lazy load nvim-cmp if snippets are disabled 2022-01-29 19:59:59 +05:30
i3cheese 2a02054a39 Add config.plugins.status.snippets to enable/disable snippets 2022-01-29 19:59:59 +05:30
siduck ee5b79d3d4 fix (#740) | lazy load lspconfig on nvim_cmp_lsp module 2022-01-26 20:17:44 +05:30
siduck 20e8249efa fix typo in variable 2022-01-23 13:03:39 +05:30
siduck 4511b84d6c load lspconfig after cmp | fix (#740)
if cmp isnt lazy loaded then load lspconfig after it so cmp-nvim-lsp capabilities can be used by lspconfig
2022-01-23 12:54:15 +05:30
emincanozcan ddd13df5af Fix typo 2022-01-23 06:22:30 +05:30
siduck c2a1298ac0 fix error handling of custom/init.lua (#739) 2022-01-22 18:33:05 +05:30
Akianonymus b9fcaf610f plugins:lspconfig: Add module name to packer config
https://github.com/NvChad/NvChad/issues/730
2022-01-22 14:53:26 +05:30
Akianonymus bad06dc44f mappings: Allow to remove plugin mappings in chadrc
This enables us to disable a plugin mappings individually

for eg:
  M.mappings.plugins = {
      telelscope = {
          find_hiddenfiles = false
      }
  }

  This will disable the telelscope find_hiddenfiles mapping.

It's also helpful when we want to use the mapping used by find_hiddenfiles for something else
2022-01-22 14:53:26 +05:30
Akianonymus 4c85f25a09 init.lua: Print error message if custom init.lua cannot be called properly 2022-01-22 14:53:26 +05:30
Akianonymus b86ae3b170 configs/statusline: Fix extra space before git diff removed icon 2022-01-22 14:53:26 +05:30
siduck a0dd82a292 clean nvimtree config 2022-01-22 11:05:27 +05:30
zbirenbaum 4077ff3520 fixed chadrc string overrides calling default function parameter. Added ability to use function as config override 2022-01-22 10:15:38 +05:30
Akianonymus bccd8e4ab9 utils: Improve override functions | Fix nvimtree and statusline config |
Misc

* make more things configurable
* use more generic variable names
* handle some edgecases
* cleanup
* format files
2022-01-22 10:15:38 +05:30
zbirenbaum 82211ed829 updated init.lua requires to support new plugin default configuration format 2022-01-22 10:15:38 +05:30
zbirenbaum c3beea11ee Added support for modifying specific key values in default configs via chadrc to all plugin configurations with setup table(s) 2022-01-22 10:15:38 +05:30
zbirenbaum cf7f8a557a added helper function to support partial plugin config overrides via tables in chadrc 2022-01-22 10:15:38 +05:30
siduck 8f7b19f23b lazy load telescope module 2022-01-20 11:37:32 +05:30
Danilo Horta e6223cc587 Enable FastWrap capabilities: https://github.com/windwp/nvim-autopairs#fastwrap 2022-01-12 16:45:51 +05:30
siduck b1338beb0f add option to toggle lazy load for cmp and related 2022-01-11 18:43:09 +05:30
siduck a21ee2f22f clean | organize statusline config 2022-01-11 11:42:36 +05:30
zbirenbaum fa9f9aad0b rewrote statusline to be compartmentalized into named components and easier to understand/customize as a basis 2022-01-11 11:42:36 +05:30
siduck 8c2bbd2143 fix cursor bugging when using auto-completion #603 2022-01-11 06:14:32 +05:30
siduck e9b25e5912 rm un-needed lazy loading for comment.nvim
loading it with our lazy_load function would mean that it would load after the UI so using module=comment doesnt make any sense at all, so keeping only the module part would mean that this plugin would load on mappings that invoke comment.nvim functions
2022-01-10 06:32:27 +05:30
siduck 71b710b35b add option for packerInit | fix (#715) 2022-01-09 09:07:18 +05:30
David Stark ea6f2a1490 hotfix to :Telescope command flag order 2022-01-08 07:39:57 +05:30
David Stark 83ad616dd3 when finding all files via Telescope follow symlinks 2022-01-08 07:07:24 +05:30
Matt Bailey 6f65cffaa1 chore: add spell directory to gitignore 2022-01-08 07:06:04 +05:30
siduck 4e54ee0081 rm hooks 2022-01-07 19:58:05 +05:30
siduck 799432e99e load custom/init.lua at last | fix (#694) 2022-01-07 07:30:55 +05:30
siduck 0a546e4720 rm unused hook 2022-01-06 22:30:48 +05:30
siduck 4c88eaec49 readme badge : update nvim version 2022-01-04 06:44:45 +05:30
zbirenbaum 1e6f9a2e52 fix errors thrown by neovim no longer allowing implicit conversions of nil to 0 in api function calls. See neovim/neovim#16745 for details on why this is now an error 2022-01-04 06:39:27 +05:30
Dundar Göc 9d013a3529 chore: fix typos 2022-01-04 06:07:38 +05:30
siduck 9551ce7031 rm telescope-media-files.nvim!
it heavily relies on xorg so doesnt fully work on linux!, forget about macos,windows. Added a basic config doc for it here : https://nvchad.github.io/Extras#telescope-media-filesnvim
2022-01-01 17:30:42 +05:30
siduck abe720b881 remove telescope fzf-native.nvim plugin 2022-01-01 16:24:19 +05:30
Jorde Vorstenbosch edcf93ea81 docs: fix some old links
Change some old links that were linking to the old repo.
2021-12-31 20:21:47 +05:30
justin-f-perez e77be17fe6 fix typo in example_init.lua
"install_plugin" -> "install_plugins"
2021-12-29 06:48:08 +05:30
siduck de9b702f0e hide indentline on telescope preview window 2021-12-27 07:42:51 +05:30
ryanb-dev 688586eeec Telescope: Remove no_ignore option from find files
Prior to this change, searches through large repositories would include
files within the .gitignore, resulting in long search results and many
useless results.  This change results in find_files respecting
.gitignore and find_hiddenfiles instead being an exhaustive search over
all files within the current directory.
2021-12-27 08:05:07 +05:30
Akianonymus 331754a890 nvimtree: Load after nvim-web-devicons when lazy load disabled
this is necessary as nvimtree depends on nvim-web-devicons

follow up commit for a2d91ac
2021-12-26 10:44:30 +05:30
Akianonymus 60212005cb statusline: Refresh after BufRead too
sometimes events like BufEnter, BufWinEnter, etc are not enough for triggering a refresh, like opening nvim when nvimtree is not lazy load
2021-12-26 10:44:30 +05:30
siduck 19cb35d80e make nvimtree folder match its icon color 2021-12-25 10:57:25 +05:30
Akianonymus a2d91acc84 nvimtree: Allow changing lazy load from chadrc | Resolve https://github.com/NvChad/NvChad/issues/621
a packerCompile is needed after changin the config value in chadrc
2021-12-25 06:04:58 +05:30
boppyt 7be01383ab raise the minimum version to 0.6+ 2021-12-23 19:34:25 +05:30
Erasin ae90cca3f0 lua vim.diagnostic.setloclist 2021-12-23 18:43:49 +05:30
boppyt 344a9aa90c fix typo in feline repo 2021-12-23 05:53:37 +05:30
siduck e5435e93de update feline config (rename colors table to theme) 2021-12-22 22:35:16 +05:30
boppyt dbc95e41bf fix feline with new diagnostic api 2021-12-22 22:01:38 +05:30
siduck 3a966955d4 make lspconfig mappings compatible with nvim 0.6v 2021-12-22 18:05:07 +05:30
Danilo Horta 31e551af30 Make lspconfig mappings configurable. 2021-12-19 06:17:13 +05:30
siduck 1cd5150b70 update comment toggle mappings (#658) 2021-12-16 18:55:33 +05:30
Sravanth C f718060260 Rename esc_insertmode to better_escape
- change the plugin status name for better_escape
2021-12-16 18:37:24 +05:30
siduck abcd035e89 make lsphandlers overridable 2021-12-15 20:27:54 +05:30
siduck 01f652fcc4 hide nvimtree rootdir by default 2021-12-13 18:59:14 +05:30
siduck 7c9bf9cbe3 add some options for nvimtree 2021-12-12 08:49:40 +05:30
Akianonymus d2db2cc1cd plugin: Use Comment.nvim | Resolve #646 & #626 2021-12-11 22:54:59 +05:30
siduck 16d035c031 fix silly spelling mistake 2021-12-11 11:58:52 +05:30
Akianonymus 2293b16709 Cleanup | Format files
* fix some lint warnings
* remove some unneeded code
2021-12-11 11:58:52 +05:30
siduck 773d25980c fix blank telescope results title (#638) 2021-12-09 05:59:15 +05:30
siduck 52d4b564ba add more charity links ^^ 2021-12-08 22:37:22 +05:30
siduck 01babafd72 add option for fillchars 2021-12-08 12:30:16 +05:30
siduck 2a8afcb7b6 rm theme toggler config 2021-12-07 14:06:34 +05:30
siduck 27c33790ef Merge branch 'dev' 2021-12-07 13:50:54 +05:30
siduck fc593d0321 Delete format.yml 2021-12-07 14:05:58 +05:30
siduck ef6c1d4c27 Merge branch 'main' into dev 2021-12-07 13:50:39 +05:30
siduck 310d84d47f Merge branch 'main' into dev 2021-12-07 13:59:11 +05:30
Deneir Uy 97572ee1bb Fix LSP diagnostic icons 2021-12-07 13:51:49 +05:30
siduck 03d55e94a4 update highlights for lsp diagnostics 2021-12-04 23:06:07 +05:30
siduck 84c3a18fab include telescope highlights for transparency 2021-12-04 21:38:30 +05:30
siduck 6347a00023 add mapping, highlights for keybind cheatsheet | disable indentline in it 2021-12-04 21:04:04 +05:30
siduck 653a2f5337 add flat look to telescope | disable gitignore on nvimtree 2021-12-04 20:42:44 +05:30
siduck 9e8af5ad93 include NvimTreeNormalNC for transparency | add #608 2021-11-24 20:08:11 +05:30
siduck 067c6cc7fc Delete example_init.lua 2021-11-19 09:28:09 +05:30
siduck 7114ebd945 Delete example_chadrc.lua 2021-11-19 09:27:55 +05:30
siduck b4da490138 gitignore custom dir | add example configs 2021-11-19 07:44:06 +05:30
siduck 5c69d46dd6 rm unused config in nvimtree | include vim highlighting support by default 2021-11-19 07:17:09 +05:30
Daniel Cardona Rojas 07b4d19b8f feat(nvimtree): exclude terminal from window picker 2021-11-17 20:38:34 +05:30
siduck 3330d1cc06 clean up! 2021-11-17 11:00:57 +05:30
siduck aa9667a5de Revert "add cheatsheet.nvim"
This reverts commit e8b919723e.
2021-11-15 22:51:51 +05:30
siduck 1567a9c73a use tbl_deep_extend to merge configs | rm other functions 2021-11-15 21:39:35 +05:30
siduck e8b919723e add cheatsheet.nvim 2021-11-14 18:23:59 +05:30
siduck bdd6dc12c2 restructure | clean default_config 2021-11-14 12:43:36 +05:30
siduck 5db36d44fb restructure highlights.lua 2021-11-14 06:57:49 +05:30
siduck 8de3f4e84c restructure init.lua | lspconfig 2021-11-14 06:49:33 +05:30
siduck a256591e90 move plugin override function to utils | increase packer clone timeout 2021-11-13 23:07:20 +05:30
siduck b4c50fa443 misc change in override function 2021-11-13 22:26:38 +05:30
siduck c8a27d701c cleanup! 2021-11-13 21:59:31 +05:30
siduck fd668e559e add option for overriding highlights (#596) 2021-11-09 06:22:51 +05:30
siduck c5fe1f711e add : option to load autopairs sequentially (#584) 2021-11-05 20:04:52 +05:30
siduck 4b2bbe5d1c update configs for nvimtree and autopairs 2021-10-30 15:48:44 +05:30
bsmirks 01eec524be fixing broken links to chadtributors 2021-10-30 10:19:25 +05:30
bsmirks c7a36fe7d8 fixing broken links 2021-10-30 10:19:25 +05:30
bsmirks 69c0f38a7a fixing broken links 2021-10-30 10:19:25 +05:30
siduck76 2cf5fe7cea update screenshot links 2021-10-29 19:10:52 +05:30
siduck76 6e3e0bf029 fix luasnip incorrect path (#526) 2021-10-28 06:04:50 +05:30
siduck76 0e493bcacc add telescope title highlights 2021-10-27 12:10:13 +05:30
siduck76 068ae08f6c avoid using cmp disable var for autopairs (#567) 2021-10-22 05:47:35 +05:30
Andrew Balmos 67962828bb Add smartcase option 2021-10-22 05:47:54 +05:30
siduck76 56d05ac9d9 rm matchparen highlight (#557) 2021-10-21 14:21:50 +05:30
siduck76 003038b2a7 rm : doc lines from signature.nvim popups 2021-10-21 09:12:31 +05:30
siduck76 eefee5e17d clean config for inactive statusline 2021-10-17 11:28:47 +05:30
max397574 16a0c97fc9 fix: use better name for mapping 2021-10-16 21:26:30 +05:30
Akianonymus 9a45bb3f20 fix: Disabling shortline from chadrc
missed in https://github.com/NvChad/NvChad/commit/317eedd9b277b4457fbdfc6314e2cee955531c24

chore: format files
2021-10-14 11:08:23 +05:30
siduck76 1b4a67a1e1 nvimtree: disable updating cwd on focused files (#546) 2021-10-11 16:46:34 +05:30
siduck76 a24a65ab6b update : nvimtree diagnostic config 2021-10-11 09:55:44 +05:30
siduck76 fb9c54bc5d add: highlight color for NvimTreeNormalNC 2021-10-10 07:41:47 +05:30
Ay355 cb977a5313 fix: use of left/right arrow keys in insert mode
This allows the left and right arrows to move between lines in insert mode.
2021-10-09 17:45:12 +05:30
siduck76 1b44d4f2b9 add : highlight color for matchparen 2021-10-09 12:10:09 +05:30
siduck76 e8bbe1e4a1 Revert "update : capabalities cmp stuff in lspconfig | load cmp_lsp after lspconfig"
This reverts commit 86d92a2fd2.
2021-10-09 11:17:21 +05:30
siduck76 d221504482 add: cmp highlight groups 2021-10-09 10:03:49 +05:30
max397574 1ec9f80bdb fixed formatting 2021-10-09 10:23:10 +05:30
max397574 1af5510d03 fix cmp use correct function 2021-10-09 10:23:10 +05:30
max397574 8a426b9e62 fix cmp use new function 2021-10-09 10:23:10 +05:30
max397574 40554c80ad fix: new function to check for cmp completitions 2021-10-09 10:23:10 +05:30
peppapig450 5799af49e2 Fix another grammar mistake in example_init.lua 2021-10-08 05:43:10 +05:30
Sravanth C d47fcda9ef add: ttf, woff, woff2 icons 2021-10-07 06:25:28 +05:30
Sravanth C 5aa370e375 feat: robots.txt icon
- added robots.txt font glyph for nvim-web-dev-icons
2021-10-07 06:25:28 +05:30
peppapig450 7449c9e4f6 fix spelling/grammar in the example files 2021-10-07 06:23:42 +05:30
ashincoder e0ac314fab chore: Remove unsupported featurs from README.md 2021-10-06 21:09:53 +05:30
siduck76 86d92a2fd2 update : capabalities cmp stuff in lspconfig | load cmp_lsp after lspconfig 2021-10-05 06:59:00 +05:30
4a349a3b45 fix(CI): CI bug fixed | docs: Added charity contribution link (#532) (#533)
* fix: Fix stylua CI formatter | add charity link

Update format.yml

* chore: format with stylua

Co-authored-by: Ashin Antony <83629316+ashincoder@users.noreply.github.com>
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-10-04 14:56:36 +05:30
Ashin Antonyandgithub-actions[bot] 7d5a15f7ce fix(CI): CI bug fixed | docs: Added charity contribution link (#532)
* fix: Fix stylua CI formatter | add charity link

Update format.yml

* chore: format with stylua

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-10-04 10:11:57 +05:30
ashincoder 6fb97be55c chore: Removed superLinter 2021-10-02 12:16:21 +05:30
Ashin Antony b2cd5e38f5 fix: fix issue #455.
1. Show line diagnostics have been changed to `ge`. Since there are keybindings starting with g. Also `ge` is fast very useful for this reason.
2021-10-02 12:16:21 +05:30
Akianonymus 2356ba069e fix: #501 | delay when use d in visual mode
only if copy_del = false
2021-10-02 12:13:56 +05:30
Akianonymus 585266dcef fix: Packer blank window on PackerSync 2021-10-02 11:24:14 +05:30
Akianonymus d810cc35a7 chore: format files 2021-10-02 11:24:14 +05:30
Akianonymus 317eedd9b2 feat: Make short statusline toggleable from chadrc 2021-10-02 11:24:14 +05:30
siduck76 a1c234e001 clean : debloat config | rm un-needed plugins 2021-10-02 10:41:50 +05:30
Nathan Wallace ba3af27de0 add config option to disable nvimtree 2021-10-02 08:30:14 +05:30
siduck76 bd1319895d rm : unused function in bufferline config 2021-10-02 07:52:46 +05:30
siduck76 cd9b2c4810 Revert "fix : packer blank window on PackerSync"
This reverts commit 9a2430132f.
2021-10-01 19:34:18 +05:30
siduck76 9a2430132f fix : packer blank window on PackerSync 2021-10-01 17:15:23 +05:30
siduck76 1c9b5b46e4 rm : outdated lspconfig in example_chadrc 2021-10-01 05:14:02 +05:30
github-actions[bot] bcb4b15669 chore: format source code 2021-09-30 04:23:09 +00:00
siduck76 1756c92609 refactor : separate lspconfig setups 2021-09-30 09:51:00 +05:30
siduck76 0b55d45845 rm neoformat plugin 2021-09-29 22:34:22 +05:30
Ashin Antony 5db8d84515 Update init.lua 2021-09-29 22:03:29 +05:30
siduck76 e137fddf6e add : cmp-path plugin 2021-09-29 18:16:43 +05:30
siduck76 5bf92c5246 chore : dont gitignore custom dir contents 2021-09-29 15:17:41 +05:30
Ashin Antony 3d7f0159f5 fix: Fixes telescope issue where requiring telescope module
this fixes the following issue https://github.com/nvim-telescope/telescope.nvim/issues/1276
2021-09-29 06:55:19 +05:30
siduck76 92a9e13e7c Update init.lua 2021-09-28 15:11:03 +05:30
github-actions[bot] 7cab4295ee chore: format source code 2021-09-28 15:11:03 +05:30
Ashin Antony 8726de1faa chore: Clean init.lua
Why do we have a table to require a single module. We had this when we had plugins, colors etc. 
But we only have one module now. So why bother a list and looping through for a single module ?
2021-09-28 15:11:03 +05:30
Jeevan Shah dc80ae5795 chore: Dev pr template (#495)
* chore: add pr templates

* Move title formatting and make speed optional
2021-09-27 23:01:45 +10:00
Galen Rowell 94b01be483 fix: default_config var plugin -> plugins instead 2021-09-27 13:41:31 +05:30
siduck76 f2a0051aa9 fix : clean nvim-tree config 2021-09-27 12:07:32 +05:30
siduck76 548e4e4a9d fix : typo of nvimtree size 2021-09-27 11:19:19 +05:30
github-actions[bot] 962c2bfe69 chore: format source code 2021-09-27 11:19:19 +05:30
Justin MacCarthy 1cd3faffb3 Moved more setting into the setup, in line with the changes in NvimTree 2021-09-27 11:19:19 +05:30
siduck76 cb3c5682a8 fix : make inactive statuslines as thin lines 2021-09-26 23:48:25 +05:30
Sravanth 98ec153e8f fix: ignore unwanted files custom dir
- since it's pointless to track user specific files, added the custom dir to the ignore list except for the example files.
2021-09-27 00:11:37 +10:00
Galen Rowell 54d5c13d38 docs: move the README & CONTRIBUTING to the '.github.' folder,
this will keep user's nvim configs cleaner,
this is specifically a GitHub standard, not base Git
2021-09-26 23:53:49 +10:00
siduck76 f65338092d feat : window title option 2021-09-26 18:47:12 +05:30
marvelman3284 5bb7cd3360 chore: add contributing.md 2021-09-26 23:33:06 +10:00
marvelman3284 d6e08ba2aa fix: Replace Website Link in README.md 2021-09-26 18:28:51 +05:30
siduck76 ac28a9f99e fix : shortline for small screens (#468) 2021-09-26 15:53:50 +05:30
siduck76 7051afe43c fix : update nvimtree config 2021-09-26 15:40:12 +05:30
siduck76 555f61493a fix : update image links 2021-09-26 09:57:33 +05:30
siduck76 a41ab8b830 fix : Add option to disable cmp (#482) 2021-09-26 07:21:07 +05:30
siduck76 8e0dfc1de6 fix : add path for luasnip snippets (#483) 2021-09-26 07:03:00 +05:30
siduck76 50a5bcc870 rm : vim-fugitive plugin 2021-09-25 23:11:59 +05:30
siduck76 2685ad8e30 fix : update nvimtree config 2021-09-25 22:11:27 +05:30
siduck76 e408a1168f feat: update conf for gitsigns | format stuff 2021-09-24 21:55:44 +05:30
siduck76 9e8fb9db74 feat: add overrides for more plugins | disable some by default 2021-09-24 20:47:53 +05:30
siduck76 a820c3cafd fix : typo in default_config.lua 2021-09-24 19:12:44 +05:30
siduck76 595be18680 feat : option to disable git status on nvimtree (#487) 2021-09-24 19:07:24 +05:30
siduck76 cc48bfb5c8 remove cheatsheet.nvim 2021-09-24 18:57:36 +05:30
github-actions[bot] 3d0a0e53f7 chore: format source code 2021-09-24 19:11:55 +05:30
Galen Rowell ee586047e5 feat: improve mappings, move custom/init.lua & chadrc.lua -> custom/example_init.lua & example_chadrc.lua 2021-09-24 19:11:55 +05:30
Galen Rowell 9961cc0113 refactor: clean & re-organise default_config + chadrc
this completely overhauls the design of the two configuration files,
aiming to move options & various tables into a more sensible table structure

BREAKING CHANGE: this will break any user modificiations to the current
config
2021-09-24 19:11:55 +05:30
Galen Rowell 80c8bf4243 feat: allow packaged plugin config overrides within chadrc 2021-09-24 19:11:55 +05:30
Galen Rowell a5a5a8220c refactor: clean & small reorgnaisation of default_config 2021-09-24 19:11:55 +05:30
Galen Rowell a5ae8899d5 fix: merge_tables bug caught 2021-09-24 19:11:55 +05:30
Morten Olsen eced5f2ec4 feat: Hook based overrides 2021-09-24 19:11:55 +05:30
Morten Olsen bfc10e6034 feat: Add custom scripts and hook based setup
This commit introduces a hook system that allows the user to add custom
modules which can use these hooks to invoke function af specific NvChad
events to allow for extending og functionality
2021-09-24 19:11:55 +05:30
Galen Rowell ca1ad15ad2 refactor: Cleaning chadrc, moved to custom & moved default_config to core 2021-09-24 19:11:55 +05:30
siduck76 22f89cfeef Revert "remove cheatsheet.nvim for now"
This reverts commit f3fe3d46c8.
2021-09-24 18:31:42 +05:30
siduck76 f3fe3d46c8 remove cheatsheet.nvim for now 2021-09-24 18:22:04 +05:30
siduck76 0b30ed27d5 replace better-escape.vim with better-escape.nvim 2021-09-22 21:26:30 +05:30
github-actions[bot] 1658bf9fc6 chore: format source code 2021-09-19 14:36:13 +00:00
ayushjaipuriyar21@gmail.com c84f3cd6cf ignore node_module folder in telescope 2021-09-19 20:05:58 +05:30
Ay355 31d605608f docs: fix grammer in README 2021-09-18 11:43:03 +05:30
github-actions[bot] 1b2473bb9c chore: format source code 2021-09-17 13:06:32 +00:00
siduck76 62538e0b37 clean dashboard config 2021-09-17 18:15:06 +05:30
siduck76 61b6eda6af add light theme in theme toggler 2021-09-16 14:20:13 +05:30
siduck76 a52382c6fa fix dashboard ascii spacing 2021-09-14 23:47:37 +05:30
siduck76 256ba205e1 rm un-needed separator from statusline 2021-09-14 09:31:48 +05:30
siduck76 67e1038b59 update felin.nvim config 2021-09-11 11:07:04 +05:30
mxzel d0980b7109 fix typo 2021-09-10 21:06:13 +05:30
siduck76 cafd078e8f fix esc_insertmode settings not getting applied in chadrc (#422) 2021-09-10 16:21:54 +05:30
siduck76 4fcf9524ee rm lspinstall from readme 2021-09-10 16:34:06 +05:30
siduck76 4c025cd1bf debloat config | remove lspinstall 2021-09-10 15:40:54 +05:30
bruhtus 14f0460317 Remove duplicate nvim-tree images in readme 2021-09-09 17:20:10 +05:30
siduck76 2309f7c249 Update statusline.lua 2021-09-09 08:45:15 +05:30
Akianonymus 85117ef95e statusline: feline: Use default git provider
now it handles dirs too

https://github.com/famiu/feline.nvim/commit/092442db0c7eb6087f0ae2cbeb776781bcc16176
2021-09-09 08:45:15 +05:30
siduck76 f73ba68c08 move highlight themes to base16 repo 2021-09-09 08:10:12 +05:30
Ashin Antony 3d6d429793 feat: Move treesitter branch to compat-0.5
If you want to use this plugin with Neovim 0.5, please use the 0.5-compat branch. Be aware though that most improvements will require neovim nightly.
https://github.com/nvim-treesitter/nvim-treesitter
2021-09-09 07:15:31 +05:30
siduck76 fe84f3952d add onejelly theme 2021-09-08 19:03:29 +05:30
siduck76 d53761839d use pretty colors for jellybean theme 2021-09-08 17:56:54 +05:30
boppyt 8056b07cdc use jellybeans colors for bg 2021-09-08 16:48:28 +05:30
boppyt f6f13908fc jellybeans: increase overall readability 2021-09-08 16:48:28 +05:30
boppyt 5c22354817 fix jellybeans theme 2021-09-08 16:48:28 +05:30
boppyt 094ad61785 add jellybeans theme 2021-09-08 16:48:28 +05:30
boppyt ddb11c6bc1 add lfgruv theme 2021-09-07 22:06:56 +05:30
Kyle daa05d6688 add: collapsible sections 2021-09-07 16:18:40 +05:30
Kyle 72812acb76 revert: Support section but with better wording 2021-09-07 16:18:40 +05:30
Kyle 62fc276f8c add: plugin developers to support section 2021-09-07 16:18:40 +05:30
Kyle b515097dce fix: chadrc 2021-09-07 16:18:40 +05:30
Kyle 803143c2e9 add: collapsible themes, support refactor 2021-09-07 16:18:40 +05:30
Kyle 562a3b2824 refactor: warning, bloat & previous things 2021-09-07 16:18:40 +05:30
Kyle fed72bd15d add: links to features section 2021-09-07 16:18:40 +05:30
siduck76 f016bf634e fix lazyloading for autosave.nvim 2021-09-07 15:18:33 +05:30
github-actions[bot] 299ce1cde3 chore: format source code 2021-09-07 10:00:34 +00:00
Marco Mayer 1107be6417 Update feline config to new format 2021-09-07 15:30:18 +05:30
VULKAN 2ac6931c69 Auto close Nvimtree incase of quitting last buffer 2021-09-07 14:46:34 +05:30
curtain 9ee56ce229 use_lspsaga deprecated, see lsp_signature upstream commit 2021-09-07 08:56:27 +05:30
siduck76 d1777dfbdf load friendly-snippets before nvim-cmp 2021-09-07 07:07:39 +05:30
siduck76 0fece65c3f update readme 2021-09-04 17:07:36 +05:30
siduck76 53b7498d64 remove un-needed config 2021-09-04 16:59:19 +05:30
siduck76 5c71f1421b chadify blossom theme colors 2021-09-03 20:28:12 +05:30
github-actions[bot] 98b531682e chore: format source code 2021-09-03 13:57:49 +00:00
Dazai-san 472fab40cf fixed & cleaned blossom theme 2021-09-03 19:27:35 +05:30
Dazai-san 69718c7138 added bunny's blossom theme
adding rayes0's(githubname) blossom theme
2021-09-03 18:27:35 +05:30
Matthew Wareing 13abea4340 Update README.md
Lua should be stylized with a capital L, see: https://www.lua.org/about.html What's in a name?
2021-09-03 05:31:55 +05:30
siduck76 287b4bae9a fix typo in blankline config 2021-09-02 16:16:19 +05:30
siduck76 ba6592c4a9 use better colors for vertsplit/statuslineNc 2021-09-02 13:41:43 +05:30
siduck76 873b846d50 disable dashboard by default 2021-09-02 09:45:28 +05:30
siduck76 5742567630 avoid using globals in blankline config 2021-09-02 08:45:05 +05:30
siduck76 19e17eac58 add uwu theme 2021-09-01 19:03:34 +05:30
siduck76 a3e436d16d update blankline config 2021-09-01 10:09:02 +05:30
Marwan Mustafa ec7b15fead fix(plugin): indentline using config instead of setup 2021-09-01 09:51:09 +05:30
github-actions[bot] a125c388c3 chore: format source code 2021-08-31 19:02:03 +00:00
Prescott Murphy 2cf3e2cac5 Set colors for lsp diagnostics
Fixes a small issue with coloring when `diagnostics = "nvim_lsp"` is set to enhance color consistency.
2021-09-01 00:31:48 +05:30
mxzel a12455509b fix typo 2021-08-31 21:09:01 +05:30
siduck76 56ea1714f6 fix packer compile spam on startup (#325) 2021-08-30 11:48:52 +05:30
siduck76 ad35d6b6e2 use the default close_icon in bufferline 2021-08-30 11:40:58 +05:30
siduck76 e1dfaa7a45 add default config for nvim-colorizer 2021-08-30 05:54:31 +05:30
siduck76 60db2ec626 disable some plugins by default 2021-08-29 12:20:15 +05:30
JoakoV3 7ddd394172 Changed mappings to move between windows/terminals with Ctrl+h,j,k,l 2021-08-29 10:42:15 +05:30
siduck76 28015f639c change keys for lsp signature help mapping 2021-08-29 10:04:50 +05:30
siduck76 146c0ed54f improve aquarium theme colors 2021-08-29 10:01:41 +05:30
Frenzy 1dacbeb462 Added Aquarium 2021-08-29 09:46:28 +05:30
siduck76 df9a780846 change mapping keys for nvimtreefocus 2021-08-29 08:07:02 +05:30
siduck76 5db010e870 mv luasnip config to others.lua 2021-08-28 09:39:38 +05:30
siduck76 d5f4c04424 add original gruvbox theme 2021-08-28 06:48:51 +05:30
siduck76 2efac1cd67 add original nord theme | rename norchad 2021-08-28 06:22:26 +05:30
Akianonymus e800122b45 plugins/configs/cmp: Enclose in pcall 2021-08-27 18:23:48 +05:30
Akianonymus d90747415f plugins/configs/statusline: Fix branch seperator 2021-08-27 18:23:48 +05:30
Akianonymus cdf9250636 Hide statusline in help too 2021-08-27 18:23:48 +05:30
siduck76 6b31861aeb remove custom area from bufferline 2021-08-27 16:00:44 +05:30
ashincoder b63e1502a5 fix: Fixing the luasnip error while tabbing 2021-08-27 15:23:20 +05:30
Ashin Antony 57d0714362 format on pushes only not PR's. 2021-08-27 14:09:02 +05:30
siduck76 0e09c3f471 rm extra space from statusline icons 2021-08-27 13:48:04 +05:30
Akianonymus 2c33e3dd38 mappings: Fix strange delete/yank/cut behaviour | Resolve #379
use mode() to detect if currently in operator pending mode, if then use normal j otherwise gj
2021-08-27 10:20:57 +05:30
Akianonymus a1c103b6a8 lsp: Reload current buffer after startup
so lsp aftually starts for the current buffer, rest buffers are fine
2021-08-27 10:20:57 +05:30
siduck76 97e155f3a2 use nerdfont glyphs for lsp progress spinners 2021-08-27 09:58:54 +05:30
Ashin Antony f7ff16e84e Update format.yml
A document of yaml must not have a indent in the start of the line.
2021-08-27 09:39:21 +05:30
siduck76 130b2bfe00 Update format.yml 2021-08-27 09:16:10 +05:30
ashincoder 828217b9da feat: Added gh action formatter 2021-08-27 09:01:59 +05:30
siduck76 c87482f107 lazy load luasnip after cmp 2021-08-27 08:11:46 +05:30
siduck76 647c3730ae clean up 2021-08-27 07:56:44 +05:30
siduck76 253047747a remove lspkind 2021-08-27 07:53:06 +05:30
siduck76 475a4c5f38 replace compe with cmp 2021-08-27 06:44:58 +05:30
Prescott Murphy 59ec5a5fed Correct bufferline diagnostics alternate setting
Tiny change: the correct setting is `nvim_lsp` with an underscore, not a hyphen.

https://github.com/akinsho/bufferline.nvim#lsp-indicators
2021-08-27 06:00:34 +05:30
siduck76 3c7de7a890 keep chadreload on hold for now 2021-08-26 22:59:05 +05:30
siduck76 e107e1aaf7 add space between lsp text/icon in statusline 2021-08-26 20:07:48 +05:30
Akianonymus 4e645c3c9f mappings: Change reload_config function name
changed in nvchad/extensions repo
2021-08-26 19:41:27 +05:30
Akianonymus 780142b150 plugins/configs/bufferline: Use a more unique func name quit all, to avoid conflicts
format file
2021-08-26 19:41:27 +05:30
Akianonymus adf0168dcc plugins: More lazy load, yay
use vim.defer_fn to load the plugins after entering the ui

add the lazy load to setup

lazy load gitsigns, neoscroll, lspinstall and vim-matchup using this method

rearrange according to startup sequence
2021-08-26 19:41:27 +05:30
Akianonymus 66de975543 plugins/configs/statusline: Fix % icon for page position 2021-08-26 19:41:27 +05:30
Akianonymus af597372ec plugins/configs/statusline: Remove extra space in lsp indicator 2021-08-26 19:41:27 +05:30
ee981f4f4a plugins/configs/statusline: Fix git branch not appearing without opening files
* the default provider given by feline uses gitsigns which only updates when a file is opened

* code taken from: https://github.com/hoob3rt/lualine.nvim/blob/master/lua/lualine/components/branch.lua

* use gitsigns var when available

Co-authored-by: Famiu Haque <famiuhaque@gmail.com>
Co-authored-by: hoob3rt <pelczarskihubert@gmail.com>
Co-authored-by: Shadman <shadmansaleh3@gmail.com>
2021-08-26 19:41:27 +05:30
siduck76 8a21e73cc5 avoid using q! for quitting vim 2021-08-26 16:28:21 +05:30
siduck76 8f733755e8 add clickable btn for exiting nvim 2021-08-26 15:01:48 +05:30
ashincoder 80b632ee95 feat: Added lsp radial progress 2021-08-26 14:05:02 +05:30
siduck76 2f2389a31b statusline add lsp status 2021-08-26 10:59:37 +05:30
siduck76 21b2680e56 Merge branch 'main' of github.com:NvChad/NvChad 2021-08-26 10:48:17 +05:30
ashincoder 7d8f6b85c7 feat: Load lspkind on insert event. 2021-08-26 10:51:16 +05:30
siduck76 80d36cca00 move to feline.nvim 2021-08-26 10:48:13 +05:30
siduck76 9635b45404 clean mappings conf 2021-08-25 20:13:47 +05:30
ashincoder c02b1a063f feat: Added cmd for ChadReload 2021-08-25 20:10:23 +05:30
Akianonymus 9b4b288d01 utils: load_config: Use filereadable to check if file exists 2021-08-25 11:41:15 +05:30
Akianonymus 753f144d3f packerInit: Print error on clone failed 2021-08-25 11:41:15 +05:30
Akianonymus 1b2ec94b75 feat: Add copy_del and copy_cut options to config 2021-08-25 11:41:15 +05:30
Akianonymus 49216a9c93 feat: Support for custom user mappings | Improve map function
move map function to utils

rearrange utils, was missed
2021-08-25 11:41:15 +05:30
siduck76 4828cfd282 add mapping for finding hidden files with telescope (#360) 2021-08-25 05:36:44 +05:30
siduck76 3dc1db884c disable some plugins by default 2021-08-25 05:11:55 +05:30
siduck76 c66fb4ff3d add diagnostics options to bufferline/nvimtree 2021-08-24 21:15:05 +05:30
siduck76 cd5433d24b fix incorrect bg in tokyonight theme 2021-08-24 15:58:33 +05:30
siduck76 bf3e9a323f make gitsigns plugin load on dir containing .git only 2021-08-24 15:37:38 +05:30
ashincoder 2f61dbfcd8 feat: Added border for lsp hover doc 2021-08-24 13:32:11 +05:30
siduck76 7d74ca4767 use default lspconfig 2021-08-24 11:01:01 +05:30
Galen Rowell a3dbef5872 fix statusline bug, handle all Vim modes 2021-08-24 10:43:43 +05:30
Cam Cope bce7e624e2 Add LSP code action mappings
Tested with rust-analyzer
2021-08-24 09:27:21 +05:30
Noah Lidell fba26a3a40 commands to load fugitive 2021-08-24 09:05:06 +05:30
Kévin Dunglas 09f6c4c067 fix: don't hide dot files by default 2021-08-23 20:45:53 +05:30
siduck76 6fbb503a16 use ascending sorting : telescope (#346) 2021-08-23 17:15:29 +05:30
siduck76 ac83f1d580 add mapping to focus nvimtree (349) 2021-08-23 16:44:52 +05:30
siduck76 b2ec48ef30 avoid using global function : lspconfig 2021-08-23 16:06:02 +05:30
Charlie Strawn 49c809b6be fix contribute link in readme 2021-08-23 09:49:09 +05:30
Nicolas Dermine a65368aed9 fix typo 2021-08-23 00:30:28 +05:30
Niels Mentink f97490d179 Added a command to quickly spin up a working NvChad docker container 2021-08-22 20:12:12 +05:30
Akianonymus bf3d4b31a6 Missed in previous commit 2021-08-22 17:58:48 +05:30
Akianonymus a28a838c06 NvChad/core -> Nvchad/extensions 2021-08-22 17:54:10 +05:30
Akianonymus a82f71334f telescope-media: Check if ueberzug is available before loading the extension 2021-08-22 17:54:10 +05:30
Akianonymus ef40dfcbc1 plugins: Properly lazy load telescope
from packer docs

module = string or list      -- Specifies Lua module names for require. When requiring a string which starts
                               -- with one of these module names, the plugin will be loaded.
2021-08-22 17:54:10 +05:30
Akianonymus 3ee3b0368a config: Seperate plugin and non-plugin configs 2021-08-22 17:54:10 +05:30
Akianonymus e08a460543 config: Expose tabstop option 2021-08-22 17:54:10 +05:30
Akianonymus aa95c05179 Remove some unneeded events when hiding statusline
dunno why cmdwinenter was there

term enter is not needed as it will handled with Buf events

use filetype events as a buffer may not trigger other events but change
the filetype
2021-08-22 17:54:10 +05:30
Akianonymus 3719521d9a Disable statusline in dashboard
need here because out custom statusline hide function doesn't care about dashboard settings
2021-08-22 17:54:10 +05:30
Akianonymus e1d0678f6e mappings: Add PackerClean command 2021-08-22 17:54:10 +05:30
Akianonymus 9ffddb6b52 Restructure config | Move some to a packer plugin | Lot of cleanup
* move teleacope files, updater and related utils to
  https://github.com/NvChad/core

* restructure config file and directory structure

* expose mappings for better escape

* allow multiple mappings for some

* improve merge table function for the same

* move autocommands to a seperate file

* rearrange everything alphabetically where sanely possible

* rearrange packer plugin list on the basis of trigerred state

config structure now

 .
├──  init.lua
├──  LICENSE
├──  lua
│  ├──  chadrc.lua
│  ├──  colors
│  │  ├──  highlights.lua
│  │  ├──  init.lua
│  │  └──  themes
│  │     ├──  chadracula.lua
│  │     ├──  everforest.lua
│  │     ├──  gruvchad.lua
│  │     ├──  javacafe.lua
│  │     ├──  mountain.lua
│  │     ├──  norchad.lua
│  │     ├──  one-light.lua
│  │     ├──  onedark.lua
│  │     ├──  tokyonight.lua
│  │     └──  tomorrow-night.lua
│  ├──  core
│  │  ├──  autocmds.lua
│  │  ├──  init.lua
│  │  ├──  mappings.lua
│  │  ├──  options.lua
│  │  └──  utils.lua
│  ├──  default_config.lua
│  └──  plugins
│     ├──  configs
│     │  ├──  autopairs.lua
│     │  ├──  autosave.lua
│     │  ├──  bufferline.lua
│     │  ├──  chadsheet.lua
│     │  ├──  compe.lua
│     │  ├──  dashboard.lua
│     │  ├──  gitsigns.lua
│     │  ├──  icons.lua
│     │  ├──  lspconfig.lua
│     │  ├──  luasnip.lua
│     │  ├──  nvimtree.lua
│     │  ├──  others.lua
│     │  ├──  statusline.lua
│     │  ├──  telescope.lua
│     │  ├──  treesitter.lua
│     │  └──  zenmode.lua
│     ├──  init.lua
│     └──  packerInit.lua
└──  README.md
2021-08-22 17:54:10 +05:30
ashincoder 44ae0178f4 Change dest of bufferline since commit https://github.com/akinsho/bufferline.nvim/commit/720555e 2021-08-22 13:04:41 +05:30
Pablo Acuña ce5d33a93b Fix installation link 2021-08-22 09:13:51 +05:30
siduck76 dceb6a70d4 rm mappings var from bufferline conf 2021-08-21 17:36:55 +05:30
siduck76 7a06fbb0be disable autocwd by default 2021-08-21 17:19:11 +05:30
siduck76 18705c4da4 fix plenary.nvim not installed (#307) 2021-08-21 15:45:24 +05:30
siduck76 c60df482e9 open dir with nvim (#316)
opening dir with nvim will work by default but since we have lazy loaded nvimtree , it doesnt update the cwd in nvimtree. This will fix that.
2021-08-21 13:57:15 +05:30
siduck76 83992378a4 treesitter : keep only lua parser installed by default 2021-08-21 11:28:25 +05:30
siduck76 cbb0ddc0a5 clean lspconfig 2021-08-21 11:23:20 +05:30
siduck76 b5668a037a avoid setting root_dir for lspservers 2021-08-21 11:04:07 +05:30
siduck76 6206a9e27b rm popup.nvim 2021-08-20 23:20:12 +05:30
siduck76 513a279788 format charity links 2021-08-20 22:03:25 +05:30
siduck76 aca4353902 Replace personal donate links with charity stuff
Many have contributed to NvChad , I would feel very bad if I get the all the donation alone. So I removed links for my paypal , buy my a coffee etc and replaced it with some gofundme links.
2021-08-20 22:02:41 +05:30
ashincoder b57cb6cdc0 fix: fixed error of statusline. 2021-08-20 16:49:32 +05:30
Akianonymus b817c55542 mappings: Close buffer -> leader+x | Resolve #6
move theme toggle to leader+tt
2021-08-20 16:27:29 +05:30
Akianonymus 4c04160b87 dashboard: Fix alignment 2021-08-20 16:27:29 +05:30
Akianonymus e15e79b519 options.lua: Merge the TermOpen autocommands 2021-08-20 16:27:29 +05:30
Akianonymus 1f6dbed26b Improve hiding/showing statusline via config 2021-08-20 16:27:29 +05:30
Galen Rowell dbf0b56059 quickfix for not properly closing unlisted buffers, should be revised again 2021-08-20 13:02:52 +05:30
Galen Rowell fd5d50f194 fix Dashboard docs, fix default_config issue 2021-08-20 09:29:13 +05:30
Akianonymus 3ccd804da9 utils/update_nvchad: Use --rebase instead of --ff-only 2021-08-20 01:00:46 +05:30
Akianonymus 5fab35f2e1 utils/load_config: Implement force reload of config 2021-08-20 01:00:46 +05:30
Akianonymus f7d2bacb51 Fix theme switcher statusline reload 2021-08-20 01:00:46 +05:30
siduck76 d84b2d5ee1 Merge branch 'main' of github.com:NvChad/NvChad 2021-08-20 00:28:53 +05:30
siduck76 44182c0ca1 1.0v screenshots! 2021-08-20 00:40:45 +05:30
siduck76 89c371397f better colors 2021-08-20 00:28:42 +05:30
65 changed files with 3095 additions and 3577 deletions

No files matched your search

+161
View File
@@ -0,0 +1,161 @@
# [CONTRIBUTING](https://nvchad.github.io/contribute)
## NvChad install for contributors
If you wish to contribute to NvChad, you should:
1. [create a fork on GitHub](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
2. clone your fork to your machine
- For ssh:
```shell
$ git clone git@github.com:<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
```
- For https:
```shell
$ git clone https://github.com/<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
```
3. [add a new remote repo to track](https://www.atlassian.com/git/tutorials/git-forks-and-upstreams)
- this means you can push/pull as normal to your own repo, but also easily track & update from the NvChad repo
- for ssh:
```shell
$ git remote add upstream git@github.com:NvChad/NvChad.git
```
- for https:
```shell
$ git remote add upstream https://github.com/NvChad/NvChad.git
```
4. any time you create a branch to do some work, use
```shell
$ git fetch upstream && git checkout -b dev-myFEAT upstream/main
```
5. only use the **--rebase** flag to update your dev branch
- this means that there are no `Merge NvChad/main into devBranch` commits, which are to be avoided
```shell
$ git pull upstream --rebase
```
## Things to know before contributing
- When making a PR (pull request), please be very descriptive about what you've done!
- PR titles should be formatted with 'fix', 'chore' or 'feat'. ex: `feat: add new plugin`
- PRs should follow the pull request formats where applicable
- We are open to all PRs, but may decline some for a myriad of reasons. Though don't be discouraged! We'll still be open to discussions.
- PR's are always welcomed however NvChad aims to be less bloated. So PR's regarding existing plugin's enhancement and creating new features with existing plugins itself ( without adding a new plugin), bug fixes and corrections are more encouraged.
- NvChad won't keep adding more and more features (like adding new plugins most likely) as requested if they feel unneeded and aren't usable by the majority!! If you think the plugin you want to be added is very useful and many NvChaders would find it useful, then such feature's PR is welcomed!
- But adding specific features like adding config for [wakatime](https://github.com/wakatime/vim-wakatime) etc will be added in this [chad user configs](https://github.com/NvChad/NvChad/wiki/Chad-user-configs). This lets the user select the things only they want ( adding configs from extra configs ).
## How to remove or edit commits from your PR
> You may have been directed here to remove a commit such as a merge commit: `Merge NvChad/main into devBranch` from your PR
> As these commands edit your git history, you may need to **force push** with `git push origin --force`
1. Run the following:
```
$ git rebase -i HEAD~<NUMBER OF COMMITS TO GO BACK>
```
<details><summary>Example</summary>
<p>
```shell
$ git rebase -i HEAD~4
```
```shell
pick 28b2dcb statusline add lsp status
pick dad9a39 feat: Added lsp radial progress
pick 68f72f1 add clickable btn for exiting nvim
pick b281b53 avoid using q! for quitting vim
# Rebase 52b655b..b281b53 onto 52b655b (4 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
```
</p>
</details>
2. Change the `pick` commands to whatever you wish, you may wish to `d` `drop` or `e` `edit` a commit. Then save & quit this git file to run it.
<details><summary>Example</summary>
<p>
```shell {3,4}
pick 28b2dcb statusline add lsp status
pick dad9a39 feat: Added lsp radial progress
edit 68f72f1 add clickable btn for exiting nvim
d b281b53 avoid using q! for quitting vim
# Rebase 52b655b..b281b53 onto 52b655b (4 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
```
</p>
</details>
3. If you picked `drop` you are done, if you picked `edit` then edit your files, then run:
```shell
$ git add <files>
```
4. Once you have edited & added your files, run:
```shell
$ git rebase --continue
```
5. You will likely need to push using:
```shell
$ git push origin --force
```
## Help
For help with contributing and anything else nvChad related join the [discord](https://discord.gg/VyPxsGArXc)
+14
View File
@@ -0,0 +1,14 @@
Fixes Issue # (If it doesn't fix an issue then delete this line)
Features Added:
- Plugin Name (Add links if possible too)
Reasoning:
List why the feature is needed
Speed (If applicable):
Show the impact on the speed of nvChad
Other:
Anything else relevant goes here
+16
View File
@@ -0,0 +1,16 @@
(Make sure your title is either: 'fix', 'chore', or 'feat' then your title. ex: `fix: add new plugin`)
Fixes Issue # (If it doesn't fix an issue then delete this line)
Plugins Added:
- [Plugin Name](Plugin Link)
- [Plugin Name](Plugin Link)
Reasoning:
List why the plugin(s) should be added
Speed:
Show the impact on the speed of nvChad
Other:
Anything else relevant goes here
+175
View File
@@ -0,0 +1,175 @@
<h1 align="center">NvChad</h1>
<div align="center">
<a href="https://nvchad.github.io/">Home</a>
<span> • </span>
<a href="https://nvchad.github.io/getting-started/setup">Install</a>
<span> • </span>
<a href="https://nvchad.github.io/contribute">Contribute</a>
<span> • </span>
<a href="https://github.com/NvChad/NvChad#gift_heart-support">Support</a>
<span> • </span>
<a href="https://nvchad.github.io/Extras">Extras</a>
<p></p>
</div>
<div align="center">
[![Super Linter](https://img.shields.io/github/workflow/status/NvChad/NvChad/Super-Linter/main?style=flat-square&logo=github&label=Build&color=8DBBE9)]()
<a href="https://github.com/NvChad/NvChad/blob/main/LICENSE"
><img
src="https://img.shields.io/github/license/NvChad/NvChad?style=flat-square&logo=GNU&label=License&color=df967f"
alt="License"
/>
[![Neovim Minimum Version](https://img.shields.io/badge/Neovim-0.6.1-blueviolet.svg?style=flat-square&logo=Neovim&color=90E59A&logoColor=white)](https://github.com/neovim/neovim)
[![GitHub Issues](https://img.shields.io/github/issues/NvChad/NvChad.svg?style=flat-square&label=Issues&color=d77982)](https://github.com/NvChad/NvChad/issues)
[![Discord](https://img.shields.io/discord/869557815780470834?color=738adb&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/gADmkJb9Fb)
[![Matrix](https://img.shields.io/badge/Matrix-40aa8b.svg?style=flat-square&logo=Matrix&logoColor=white)](https://matrix.to/#/#nvchad:matrix.org)
[![Telegram](https://img.shields.io/badge/Telegram-blue.svg?style=flat-square&logo=Telegram&logoColor=white)](https://t.me/DE_WM)
</div>
## Showcase
<img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/dashboard-nvim.png"><hr>
<img src="https://cdn.discordapp.com/attachments/610012460828852229/853933487295299584/unknown.png"><hr>
<img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/initialNvim1.png"><hr>
<img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/initialNvim.png"><hr>
## Theme Showcase
<details><summary> <b>Images (Click to expand!)</b></summary>
![onedark](https://user-images.githubusercontent.com/59060246/130129880-59ab1ad5-9aa6-4f50-9ddd-d8dde0c16257.png)
![nord](https://user-images.githubusercontent.com/59060246/130129890-c01117df-ac3d-40dd-b95d-2681c2461bb4.png)
![gruvchad](https://user-images.githubusercontent.com/59060246/130129897-a68b1585-f42d-4325-8482-102dd2fe1e9e.png)
![everforest](https://user-images.githubusercontent.com/59060246/130129901-5e582f3e-b776-4d0c-9790-be5ae738b5a8.png)
</details>
## Very useful plugins used
<details><summary> <b>Images (Click to expand!)</b></summary>
<h3> Nvim-tree.lua </h3>
Fast file tree:
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/nvimtree.png"></kbd><hr>
<h3> Telescope-nvim </h3>
A fuzzy file finder, picker, sorter, previewer and much more:
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/tel.png"></kbd>
<h3> Indent-blankline.nvim </h3>
Adds indentline:
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/blanklineNvim.png"></kbd><hr>
<h3> Feline.nvim </h3>
Highly configurable statusline plugin:
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/statusline.png"></kbd><hr>
<h3> Nvim-bufferline.lua </h3>
Better tab implementation:
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/bufferline.png"></kbd><hr>
<h3> Nvim-web-devicons </h3>
Lua fork of Vim Devicons which offers more file icon customisability:
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/image.png"></kbd><hr>
<h3> Nvim-treesitter </h3
Better syntax highlighting for programming languages (NvChad by default comes with Lua/bash treesitter parsers).
Without/with Treesitter:
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/woTree.png"></kbd><hr>
</details>
## Credits
- [Elianiva](https://github.com/elianiva) helped me with NeoVim Lua related issues many times, NvChad wouldn't exist without his help at all.
- @lorvethe for making the beautiful NvChad logo.
## Features
- Many beautiful themes to choose from.
- Fast plugin loading.
- File navigation with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua).
- Managing tabs, buffers with [bufferline.nvim](https://github.com/akinsho/bufferline.nvim).
- Beautiful and configurable icons with [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons).
- Pretty and functional statusline with [feline.nvim](https://github.com/Famiu/feline.nvim).
- Git diffs and more with [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim) .
- NeoVim Lsp configuration with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig).
- Autocompletion with [nvim-cmp](https://github.com/hrsh7th/nvim-cmp).
- File searching, previewing image and text files and more with [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim).
- Syntax highlighting with [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
- Autoclosing braces and html tags with [nvim-autopairs](https://github.com/windwp/nvim-autopairs).
- Indentlines with [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim).
- Useful snippets with [LuaSnip](https://github.com/L3MON4D3/LuaSnip).
## Bloat
To everyone who thinks that NvChad is bloat: Bloat means different things to everyone.
NvChad has 38 plugins installed by default, yet it is still very fast because it uses the Packer plugin manager. Packer.nvim allows you to lazy load plugins, meaning they only get loaded when absolutely required. Furthermore, you can disable plugins you don't use in `chadrc.lua`.
<img src = "https://chadpaste.com/f/kdmxdabxbk.png">
# TODO
NvChad is focusing more on improving its already existing plugins and features instead of adding more plugins. Things you can do to help currently are:
- Improving base plugins configurations
- Debloating the config.
- Adding more themes.
## Try NvChad in a Docker container
This will leave your current Neovim configuration untouched. Once you exit Neovim, the image is deleted.
```zsh
docker run -w /root -it --rm alpine:edge sh -uelic '
apk add git nodejs neovim ripgrep alpine-sdk --update
git clone https://github.com/NvChad/NvChad ~/.config/nvim
nvim -c "autocmd User PackerComplete quitall" -c "PackerSync"
nvim
'
```
## Chadributors
<a href="https://github.com/NvChad/NvChad/graphs/contributors">
<img src="https://contrib.rocks/image?repo=NvChad/NvChad"/>
</a>
## Warning
If you have an issue with a plugin in NvChad, first you should report it to NvChad to see if it's an issue with it.
## :gift_heart: Support
I would happily accept donations but would feel awful since I'm not the only one who has worked on NvChad. The project has only been made possible by the many great contributors and plugin developers, thus taking the donations just for me feels unjustified. If you enjoy using NvChad and would like to show your support then try to be a better you! Help the people in need whenever possible and do charity work. Be nice to loved ones and strangers alike. Do not be rude, always try to be helpful and caring for one another. It's easy to hate but hard to care. Be respectful to any software/work done by other people rather than making fun of them. Do not compare software (In a bad way). I'm grateful to even be able to use NeoVim! But I still cannot be fully happy when I know that there are people who barely have any food to eat, starve for weeks, don't have access to proper education, computers, basic health care facilities and more. Here are some charities and gofundme links you can donate to instead:
- https://www.gofundme.com/f/WeCareAboutSyria
- https://www.gofundme.com/f/Burundi-Nutrition
- https://charity.gofundme.com/o/en/campaign/feedingyemen
- https://www.gofundme.com/f/6p8ea-give-ghanaian-orphans-the-gift-of-a-ride-to-school
- https://www.isupportmyanmar.com
- https://www.justgiving.com/campaign/somaliawater
- https://www.justgiving.com/crowdfunding/acaappeal
- https://www.justgiving.com/fundraising/muslim-chat
- https://www.gofundme.com/f/help-kids-in-mali-have-warm-clothing-in-winter
- https://www.justgiving.com/crowdfunding/carevenezuela
- https://www.justgiving.com/campaign/yemen
-31
View File
@@ -1,31 +0,0 @@
name: Super-Linter
# Run this workflow every time a new commit pushed to your repository
on: push
jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
super-lint:
# Name the Job
name: Lint code base
# Set the type of machine to run on
runs-on: ubuntu-latest
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
# Runs the Super-Linter action
- name: Run Super-Linter
uses: github/super-linter@v3
env:
VALIDATE_YAML: true
VALIDATE_BASH_EXEC: true
#VALIDATE_LUA: true #removed because the lua gets caught with all the vim
OUTPUT_FOLDER: super-linter.report
OUTPUT_DETAILS: detailed
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+2
View File
@@ -1 +1,3 @@
plugin
custom
spell
-161
View File
@@ -1,161 +0,0 @@
<h1 align="center">NvChad</h1>
<div align="center">
<a href="https://nvchad.netlify.app/">Home</a>
<span> • </span>
<a href="https://nvchad.netlify.app/docs/Getting%20started/Setup">Install</a>
<span> • </span>
<a href="https://nvchad.netlify.app/docs/Contribute">Contribute</a>
<span> • </span>
<a href="https://github.com/siduck76/NvChad#gift_heart-support">Support</a>
<span> • </span>
<a href="https://github.com/siduck76/NvChad/wiki/Chad-user-configs">Extras</a>
<p></p>
</div>
<div align="center">
[![Lua](https://img.shields.io/badge/Made%20with%20Lua-blueviolet.svg?style=for-the-badge&logo=lua)]()
</div>
<div align="center">
[![Super Linter](https://img.shields.io/github/workflow/status/siduck76/NvChad/Super-Linter/main?style=flat-square&logo=github&label=Build&color=green)]()
<a href="https://github.com/siduck76/NvChad"
><img
src="https://img.shields.io/github/repo-size/siduck76/NvChad?style=flat-square&label=Repo"
alt="GitHub repository size"
/></a>
<a href="https://github.com/siduck76/NvChad/blob/main/LICENSE"
><img
src="https://img.shields.io/github/license/siduck76/NvChad?style=flat-square&logo=GNU&label=License"
alt="License"
/>
[![Discord](https://img.shields.io/discord/869557815780470834?color=738adb&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/gADmkJb9Fb)
[![Neovim Minimum Version](https://img.shields.io/badge/Neovim-0.5+-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=white)](https://github.com/neovim/neovim)
[![GitHub Issues](https://img.shields.io/github/issues/siduck76/NvChad.svg?style=flat-square&label=Issues&color=fc0330)](https://github.com/siduck76/NvChad/issues)
[![Last Commit](https://img.shields.io/github/last-commit/siduck76/NvChad.svg?style=flat-square&label=Last%20Commit&color=58eb34)](https://github.com/siduck76/NvChad/pulse)
</div>
# Showcase
<img src ="https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/dashboard-nvim.png"><hr>
<img src ="https://cdn.discordapp.com/attachments/610012460828852229/853933487295299584/unknown.png"><hr>
<img src ="https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/initialNvim1.png"><hr>
<img src ="https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/initialNvim.png"><hr>
# Very Very Useful lua plugins used in my config
#### Lspkind-nvim
This tiny plugin adds vscode-like pictograms to neovim built-in lsp completion items:
<kbd><img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/lspkind.png"></kbd><hr>
#### Nvim-tree.lua
fast file tree:
<kbd><img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/nvimtree.png"></kbd><hr>
### Telescope-nvim
A fuzzy file finder, picker, sorter, previewer and much more:
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/tel.png"></kbd>
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/telmedia.png"></kbd><hr>
### Indent-blankline.nvim
adds indentline:
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/blanklineNvim.png"></kbd>
### Galaxyline
fastest statusline plugin I've used so far:
<kbd><img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/statusline.png"></kbd><hr>
### Nvim-bufferline.lua
As a top tabline like thing which lets me handle tabs and buffers like switching , sorting and closing them etc.
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/bufferline.png"></kbd>
### Nvim-web-devicons
Lua fork of vim devicons which lets me change icons of filetypes:
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/image.png"></kbd>
### Nvim-treesitter
Better syntax highlighting for programming languages ( NvChad by default comes with lua/bash treesitter parsers ).
without / with Treesitter:
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/woTree.png"></kbd>
# Credits
- [Elianiva](https://github.com/elianiva) helped me with neovim lua related issues many times, NvChad wouldnt exist without his help at all!
- @lorvethe for making NvChad logo!
# Features
- File navigation with Nvimtree
- Using plugins that are mouse friendly
- Beautiful inbuilt themes
- lazy loading 100% of plugins
- managing tabs, buffers with bufferline
- autosave
- icons on nvimtree, telescope, bufferline/statusline and almost everywhere! with nvim-web-devicons
- minimal status line (galaxyline)
- gitsigns (colored bars for git in my config)
- nvim-lspconfig for nvim-lsp configuration
- lspInstall for installing lsp servers easily
- nvim-compe for autocompletion
- lspkind to show pictograms on autocompletion items
- telescope for file finding, picking, previewing (files and even images)
- nvim-treesitter for syntax highlighting
- nvim-autopairs for autolosing braces and stuffs
- neoformat for prettifying/formatting code
- packer.nvim as package manager
- indent-blankline.Nvim for indentlines
- smooth scrolling
- luasnip for snippet plugin and snip support from VSCode through vsnip supporting custom and predefined snips (friendly-snippets)
- Distraction free modes (modes in which statusline, tabline etc. stuff get disabled so its just the text visible in the buffer similar to goyo.vim)
- Code formatting/prettifying
- gitsigns for git diffs
# Bloat
- To all those who think this is probably bloated, sure it is. Bloat means different to everyone. NvChad has like 30 ~ plugins but that doesn't mean those plugins are compromising neovim's speed, snappiness, or making it slow. No matter how many plugins I'd add on NvChad, it wouldn't compromise speed/snappiness/make it slow or whatever since it uses packer.nvim as plugin manager. packer.nvim lets you lazy load plugins i.e. loading plugins on certain events, mappings, sequentially loading them, etc, thus loading them only when needed. I have lazy loaded all the plugins so most plugins aren't loaded by default, hence not affecting neovim's startup/launch time.
<img src = "https://chadpaste.com/f/kdmxdabxbk.png">
# TODO
It would be nice if NvChad focuses on existing plugins and config before adding new things. Some plugins like whichkey, telescope and treesitter still have basic configs! Also adding new features that'd make NvChad slow or its startup time slow wouldn't be encouraged. If that feature is really needed then it'll be mentioned in the wiki with its config.
- Debloat the config.
- Make NvChad more and more faster (reduce startup time as low as possible).
- Add more themes.
# Chad contributors
<a href = "https://github.com/NvChad/NvChad/graphs/contributors">
<img src = "https://contrib.rocks/image?repo=siduck76/NvChad"/>
</a>
## :gift_heart: Support
If you enjoy using NvChad and would like to show your appreciation, you may want to tip me here.
It is never required but always appreciated.
<p align="center">
<a href="https://www.buymeacoffee.com/siduck7" target="_blank"><img alt="undefined" width="48px" src="https://raw.githubusercontent.com/adi1090x/files/master/other/1.png"></a>
<a href="https://ko-fi.com/siduck76" target="_blank"><img alt="undefined" width="48px" src="https://raw.githubusercontent.com/adi1090x/files/master/other/2.png"></a>
<a href="https://www.paypal.com/paypalme/siduck76" target="_blank"><img alt="undefined" width="48px" src="https://raw.githubusercontent.com/adi1090x/files/master/other/3.png"></a>
</p>
## Warning
I get hearings from some plugin devs that nvchad users bring issues on discourse/reddit/matrix/gh repos etc. Please dont do that :/ . Bring NvChad related issues here ONLY and dont ever bother plugin devs, THIS IS A CLEAR WARNING! 😠
+12
View File
@@ -0,0 +1,12 @@
-- Just an example, supposed to be placed in /lua/custom/
local M = {}
-- make sure you maintain the structure of `core/default_config.lua` here,
-- example of changing theme:
M.ui = {
theme = "gruvchad",
}
return M
+11
View File
@@ -0,0 +1,11 @@
-- Please check NvChad docs if you're totally new to nvchad + dont know lua!!
-- This is an example init file in /lua/custom/
-- this init.lua can load stuffs etc too so treat it like your ~/.config/nvim/
-- MAPPINGS
local map = require("core.utils").map
map("n", "<leader>cc", ":Telescope <CR>")
map("n", "<leader>q", ":q <CR>")
-- NOTE: the 4th argument in the map function is be a table i.e options but its most likely un-needed so dont worry about it
+26 -7
View File
@@ -1,12 +1,31 @@
local chad_modules = {
"options",
"mappings",
local present, impatient = pcall(require, "impatient")
if present then
impatient.enable_profile()
end
local core_modules = {
"core.options",
"core.autocmds",
"core.mappings",
}
for i = 1, #chad_modules, 1 do
if not pcall(require, chad_modules[i]) then
error("Error loading " .. chad_modules[i] .. "\n")
for _, module in ipairs(core_modules) do
local ok, err = pcall(require, module)
if not ok then
error("Error loading " .. module .. "\n\n" .. err)
end
end
require("mappings").misc()
-- non plugin mappings
require("core.mappings").misc()
-- check if custom init.lua file exists
if vim.fn.filereadable(vim.fn.stdpath "config" .. "/lua/custom/init.lua") == 1 then
-- try to call custom init, if not successful, show error
local ok, err = pcall(require, "custom")
if not ok then
vim.notify("Error loading custom/init.lua\n\n" .. err)
end
return
end
-158
View File
@@ -1,158 +0,0 @@
-- IMPORTANT NOTE : This is user config
local M = {}
M.ui = {
theme = "onedark",
-- theme toggle
theme_toggler = false,
fav_themes = {
"onedark",
"gruvchad",
},
italic_comments = false,
-- Enable this only if your terminal has the colorscheme set which nvchad uses
-- For Ex : if you have onedark set in nvchad , set onedark's bg color on your terminal
transparency = false,
hidden_statusline = {
-- these are filetypes, not pattern matched
"NvimTree",
-- "terminal",
},
statusline_style = "default", -- default, round , slant , block , arrow
}
M.options = {
permanent_undo = true,
ruler = false,
hidden = true,
ignorecase = true,
mouse = "a",
cmdheight = 1,
updatetime = 250,
timeoutlen = 400,
clipboard = "unnamedplus",
number = true,
-- relative numbers in normal mode tool at the bottom of options.lua
relativenumber = false,
numberwidth = 2,
expandtab = true,
shiftwidth = 2,
smartindent = true,
mapleader = " ",
autosave = false,
enable_insertNav = true, -- navigation in insertmode
-- used for updater
update_url = "https://github.com/NvChad/NvChad",
update_branch = "main",
}
-- enable and disable plugins (false for disable)
M.plugin_status = {
-- UI
nvim_bufferline = true,
galaxyline = true,
nvim_colorizer = true,
dashboard_nvim = true,
blankline = true,
truezen_nvim = true,
better_esc = true,
-- lsp stuff
lspkind = true,
lspsignature = true,
-- git stuff
gitsigns = true,
vim_fugitive = true,
-- misc
neoformat = true,
vim_matchup = true,
autosave_nvim = true,
nvim_comment = true,
neoscroll_nvim = true,
telescope_media = true,
cheatsheet = true,
}
-- make sure you dont use same keys twice
M.mappings = {
-- plugin specific
truezen = {
ataraxisMode = "<leader>zz",
minimalisticmode = "<leader>zm",
focusmode = "<leader>zf",
},
comment_nvim = {
comment_toggle = "<leader>/",
},
nvimtree = {
treetoggle = "<C-n>", -- file manager
},
neoformat = {
format = "<leader>fm",
},
dashboard = {
open = "<leader>db",
newfile = "<leader>fn",
bookmarks = "<leader>bm",
sessionload = "<leader>l",
sessionsave = "<leader>s",
},
telescope = {
live_grep = "<leader>fw",
git_status = "<leader>gt",
git_commits = "<leader>cm",
find_files = "<leader>ff",
buffers = "<leader>fb",
help_tags = "<leader>fh",
oldfiles = "<leader>fo",
themes = "<leader>th",
},
telescope_media = {
media_files = "<leader>fp",
},
chadsheet = {
default_keys = "<leader>dk",
user_keys = "<leader>uk",
},
bufferline = {
new_buffer = "<S-t>",
newtab = "<C-t>b",
close = "<S-x>", -- close a buffer with custom func in utils.lua
cycleNext = "<TAB>", -- next buffer
cyclePrev = "<S-Tab>", -- previous buffer
},
fugitive = {
Git = "<leader>gs",
diffget_2 = "<leader>gh",
diffget_3 = "<leader>gl",
git_blame = "<leader>gb",
},
terms = { -- below are NvChad mappings, not plugin mappings
esc_termmode = "jk",
esc_hide_termmode = "JK",
pick_term = "<leader>W", -- note: this is a telescope extension
new_wind = "<leader>w",
new_vert = "<leader>v",
new_hori = "<leader>h",
},
-- navigation in insert mode
insert_nav = {
forward = "<C-l>",
backward = "<C-h>",
top_of_line = "<C-a>",
end_of_line = "<C-e>",
prev_line = "<C-j>",
next_line = "<C-k>",
},
misc = {
copywhole_file = "<C-a>",
toggle_linenr = "<leader>n", -- show or hide line number
theme_toggle = "<leader>x",
update_nvchad = "<leader>uu",
},
}
return M
+168
View File
@@ -0,0 +1,168 @@
local cmd = vim.cmd
local colors = require("colors").get()
local ui = require("core.utils").load_config().ui
local black = colors.black
local black2 = colors.black2
local blue = colors.blue
local darker_black = colors.darker_black
local folder_bg = colors.folder_bg
local green = colors.green
local grey = colors.grey
local grey_fg = colors.grey_fg
local light_grey = colors.light_grey
local line = colors.line
local nord_blue = colors.nord_blue
local one_bg = colors.one_bg
local one_bg2 = colors.one_bg2
local pmenu_bg = colors.pmenu_bg
local purple = colors.purple
local red = colors.red
local white = colors.white
local yellow = colors.yellow
local orange = colors.orange
local one_bg3 = colors.one_bg3
-- functions for setting highlights
local fg = require("core.utils").fg
local fg_bg = require("core.utils").fg_bg
local bg = require("core.utils").bg
-- Comments
if ui.italic_comments then
fg("Comment", grey_fg .. " gui=italic")
else
fg("Comment", grey_fg)
end
-- Disable cursor line
cmd "hi clear CursorLine"
-- Line number
fg("cursorlinenr", white)
-- same it bg, so it doesn't appear
fg("EndOfBuffer", black)
-- For floating windows
fg("FloatBorder", blue)
bg("NormalFloat", darker_black)
-- Pmenu
bg("Pmenu", one_bg)
bg("PmenuSbar", one_bg2)
bg("PmenuSel", pmenu_bg)
bg("PmenuThumb", nord_blue)
fg("CmpItemAbbr", white)
fg("CmpItemAbbrMatch", white)
fg("CmpItemKind", white)
fg("CmpItemMenu", white)
-- misc
-- inactive statuslines as thin lines
fg("StatusLineNC", one_bg3 .. " gui=underline")
fg("LineNr", grey)
fg("NvimInternalError", red)
fg("VertSplit", one_bg2)
if ui.transparency then
bg("Normal", "NONE")
bg("Folded", "NONE")
fg("Folded", "NONE")
fg("Comment", grey)
end
-- [[ Plugin Highlights
-- Dashboard
fg("AlphaHeader", grey_fg)
fg("AlphaButtons", light_grey)
-- Git signs
fg_bg("DiffAdd", blue, "NONE")
fg_bg("DiffChange", grey_fg, "NONE")
fg_bg("DiffChangeDelete", red, "NONE")
fg_bg("DiffModified", red, "NONE")
fg_bg("DiffDelete", red, "NONE")
-- Indent blankline plugin
fg("IndentBlanklineChar", line)
fg("IndentBlanklineSpaceChar", line)
-- Lsp diagnostics
fg("DiagnosticHint", purple)
fg("DiagnosticError", red)
fg("DiagnosticWarn", yellow)
fg("DiagnosticInformation", green)
-- NvimTree
fg("NvimTreeEmptyFolderName", folder_bg)
fg("NvimTreeEndOfBuffer", darker_black)
fg("NvimTreeFolderIcon", folder_bg)
fg("NvimTreeFolderName", folder_bg)
fg("NvimTreeGitDirty", red)
fg("NvimTreeIndentMarker", one_bg2)
bg("NvimTreeNormal", darker_black)
bg("NvimTreeNormalNC", darker_black)
fg("NvimTreeOpenedFolderName", folder_bg)
fg("NvimTreeRootFolder", red .. " gui=underline") -- enable underline for root folder in nvim tree
fg_bg("NvimTreeStatuslineNc", darker_black, darker_black)
fg_bg("NvimTreeVertSplit", darker_black, darker_black)
fg_bg("NvimTreeWindowPicker", red, black2)
-- Telescope
fg_bg("TelescopeBorder", darker_black, darker_black)
fg_bg("TelescopePromptBorder", black2, black2)
fg_bg("TelescopePromptNormal", white, black2)
fg_bg("TelescopePromptPrefix", red, black2)
bg("TelescopeNormal", darker_black)
fg_bg("TelescopePreviewTitle", black, green)
fg_bg("TelescopePromptTitle", black, red)
fg_bg("TelescopeResultsTitle", darker_black, darker_black)
bg("TelescopeSelection", black2)
-- keybinds cheatsheet
fg_bg("CheatsheetBorder", black, black)
bg("CheatsheetSectionContent", black)
fg("CheatsheetHeading", white)
local section_title_colors = {
white,
blue,
red,
green,
yellow,
purple,
orange,
}
for i, color in ipairs(section_title_colors) do
vim.cmd("highlight CheatsheetTitle" .. i .. " guibg = " .. color .. " guifg=" .. black)
end
-- Disable some highlight in nvim tree if transparency enabled
if ui.transparency then
bg("NormalFloat", "NONE")
bg("NvimTreeNormal", "NONE")
bg("NvimTreeNormalNC", "NONE")
bg("NvimTreeStatusLineNC", "NONE")
fg_bg("NvimTreeVertSplit", grey, "NONE")
-- telescope
bg("TelescopeBorder", "NONE")
bg("TelescopePrompt", "NONE")
bg("TelescopeResults", "NONE")
bg("TelescopePromptBorder", "NONE")
bg("TelescopePromptNormal", "NONE")
bg("TelescopeNormal", "NONE")
bg("TelescopePromptPrefix", "NONE")
fg("TelescopeBorder", one_bg)
fg_bg("TelescopeResultsTitle", black, blue)
end
+52
View File
@@ -0,0 +1,52 @@
local colors = require("core.utils").load_config().ui.colors
local override = require("core.utils").load_config().ui.hl_override
local M = {}
-- if theme given, load given theme if given, otherwise nvchad_theme
M.init = function(theme)
if not theme then
theme = require("core.utils").load_config().ui.theme
end
-- set the global theme, used at various places like theme switcher, highlights
vim.g.nvchad_theme = theme
local present, base16 = pcall(require, "base16")
if present then
-- first load the base16 theme
local ok, array = pcall(base16.themes, theme)
if ok then
base16(array, true)
-- unload to force reload
package.loaded["colors.highlights" or false] = nil
-- then load the highlights
require "colors.highlights"
else
pcall(vim.cmd, "colo " .. theme)
end
else
pcall(vim.cmd, "colo " .. theme)
end
if #override ~= 0 then
package.loaded[override] = nil
require(override)
end
end
-- returns a table of colors for given or current theme
M.get = function(theme)
if #colors ~= 0 then
return require(colors)
else
if not theme then
theme = vim.g.nvchad_theme
end
return require("hl_themes." .. theme)
end
end
return M
+22
View File
@@ -0,0 +1,22 @@
local settings=require("core.utils").load_config().options.nvChad
-- uncomment this if you want to open nvim with a dir
-- vim.cmd [[ autocmd BufEnter * if &buftype != "terminal" | lcd %:p:h | endif ]]
-- Use relative & absolute line numbers in 'n' & 'i' modes respectively
-- vim.cmd[[ au InsertEnter * set norelativenumber ]]
-- vim.cmd[[ au InsertLeave * set relativenumber ]]
-- Don't show any numbers inside terminals
if not settings.terminal_numbers then
vim.cmd [[ au TermOpen term://* setlocal nonumber norelativenumber | setfiletype terminal ]]
end
-- Don't show status line on certain windows
if not require("core.utils").load_config().plugins.options.statusline.hide_disable then
vim.cmd [[ autocmd BufEnter,BufRead,BufWinEnter,FileType,WinEnter * lua require("core.utils").hide_statusline() ]]
end
-- Open a file from its last left off position
-- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]
-- File extension specific tabbing
-- vim.cmd [[ autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 ]]
+279
View File
@@ -0,0 +1,279 @@
-- IMPORTANT NOTE : This is default config, so dont change anything here.
-- use custom/chadrc.lua instead
local M = {}
M.options = {
-- custom = {}
-- general nvim/vim options , check :h optionname to know more about an option
clipboard = "unnamedplus",
cmdheight = 1,
ruler = false,
hidden = true,
ignorecase = true,
smartcase = true,
mapleader = " ",
mouse = "a",
number = true,
numberwidth = 2,
relativenumber = false,
expandtab = true,
shiftwidth = 2,
smartindent = true,
tabstop = 8,
timeoutlen = 400,
updatetime = 250,
undofile = true,
fillchars = { eob = " " },
shadafile = vim.opt.shadafile,
-- NvChad options
nvChad = {
copy_cut = true, -- copy cut text ( x key ), visual and normal mode
copy_del = true, -- copy deleted text ( dd key ), visual and normal mode
insert_nav = true, -- navigation in insertmode
window_nav = true,
terminal_numbers = false,
-- updater
update_url = "https://github.com/NvChad/NvChad",
update_branch = "main",
},
terminal = {
behavior = {
close_on_exit = true,
},
window = {
vsplit_ratio = 0.5,
split_ratio = 0.4,
},
location = {
horizontal = "rightbelow",
vertical = "rightbelow",
float = {
relative = 'editor',
row = 0.3,
col = 0.25,
width = 0.5,
height = 0.4,
border = "single",
}
},
},
}
---- UI -----
M.ui = {
hl_override = "", -- path of your file that contains highlights
colors = "", -- path of your file that contains colors
italic_comments = false,
theme = "onedark", -- default theme
-- Change terminal bg to nvim theme's bg color so it'll match well
-- For Ex : if you have onedark set in nvchad, set onedark's bg color on your terminal
transparency = false,
}
---- PLUGIN OPTIONS ----
M.plugins = {
-- builtin nvim plugins are disabled
builtins = {
"2html_plugin",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
},
-- enable/disable plugins (false for disable)
status = {
blankline = true, -- indentline stuff
bufferline = true, -- manage and preview opened buffers
colorizer = false, -- color RGB, HEX, CSS, NAME color codes
comment = true, -- easily (un)comment code, language aware
alpha = false, -- dashboard
better_escape = true, -- map to <ESC> with no lag
feline = true, -- statusline
gitsigns = true,
lspsignature = true, -- lsp enhancements
vim_matchup = true, -- improved matchit
cmp = true,
nvimtree = true,
autopairs = true,
},
options = {
packer = {
init_file = "plugins.packerInit",
},
autopairs = { loadAfter = "nvim-cmp" },
cmp = {
lazy_load = true,
},
lspconfig = {
setup_lspconf = "", -- path of file containing setups of different lsps
},
nvimtree = {
-- packerCompile required after changing lazy_load
lazy_load = true,
},
luasnip = {
snippet_path = {},
},
statusline = {
hide_disable = false,
-- hide, show on specific filetypes
hidden = {
"help",
"NvimTree",
"terminal",
"alpha",
},
shown = {},
-- truncate statusline on small screens
shortline = true,
style = "default", -- default, round , slant , block , arrow
},
esc_insertmode_timeout = 300,
},
default_plugin_config_replace = {},
default_plugin_remove = {},
install = nil,
}
-- Don't use a single keymap twice
--- MAPPINGS ----
-- non plugin
M.mappings = {
-- custom = {}, -- custom user mappings
misc = {
cheatsheet = "<leader>ch",
close_buffer = "<leader>x",
cp_whole_file = "<C-c>", -- copy all contents of current buffer
lineNR_toggle = "<leader>n", -- toggle line number
lineNR_rel_toggle = "<leader>rn",
update_nvchad = "<leader>uu",
new_buffer = "<S-t>",
new_tab = "<C-t>b",
save_file = "<C-s>", -- save file using :w
},
-- navigation in insert mode, only if enabled in options
insert_nav = {
backward = "<C-h>",
end_of_line = "<C-e>",
forward = "<C-l>",
next_line = "<C-j>",
prev_line = "<C-k>",
beginning_of_line = "<C-a>",
},
-- better window movement
window_nav = {
moveLeft = "<C-h>",
moveRight = "<C-l>",
moveUp = "<C-k>",
moveDown = "<C-j>",
},
-- terminal related mappings
terminal = {
-- multiple mappings can be given for esc_termmode, esc_hide_termmode
-- get out of terminal mode
esc_termmode = { "jk" },
-- get out of terminal mode and hide it
esc_hide_termmode = { "JK" },
-- show & recover hidden terminal buffers in a telescope picker
pick_term = "<leader>W",
-- spawn a single terminal and toggle it
-- this just works like toggleterm kinda
new_horizontal = "<leader>h",
new_vertical = "<leader>v",
new_float = "<A-i>",
-- spawn new terminals
spawn_horizontal = "<A-h>",
spawn_vertical = "<A-v>",
spawn_window = "<leader>w",
},
}
-- plugins related mappings
-- To disable a mapping, equate the variable to "" or false or nil in chadrc
M.mappings.plugins = {
bufferline = {
next_buffer = "<TAB>",
prev_buffer = "<S-Tab>",
},
comment = {
toggle = "<leader>/",
},
-- map to <ESC> with no lag
better_escape = { -- <ESC> will still work
esc_insertmode = { "jk" }, -- multiple mappings allowed
},
lspconfig = {
declaration = "gD",
definition = "gd",
hover = "K",
implementation = "gi",
signature_help = "gk",
add_workspace_folder = "<leader>wa",
remove_workspace_folder = "<leader>wr",
list_workspace_folders = "<leader>wl",
type_definition = "<leader>D",
rename = "<leader>ra",
code_action = "<leader>ca",
references = "gr",
float_diagnostics = "ge",
goto_prev = "[d",
goto_next = "]d",
set_loclist = "<leader>q",
formatting = "<leader>fm",
},
nvimtree = {
toggle = "<C-n>",
focus = "<leader>e",
},
telescope = {
buffers = "<leader>fb",
find_files = "<leader>ff",
find_hiddenfiles = "<leader>fa",
git_commits = "<leader>cm",
git_status = "<leader>gt",
help_tags = "<leader>fh",
live_grep = "<leader>fw",
oldfiles = "<leader>fo",
themes = "<leader>th", -- NvChad theme picker
},
}
return M
+207
View File
@@ -0,0 +1,207 @@
local utils = require "core.utils"
local config = utils.load_config()
local map_wrapper = utils.map
local maps = config.mappings
local plugin_maps = maps.plugins
local nvChad_options = config.options.nvChad
local terminal_options = config.options.terminal
local cmd = vim.cmd
-- This is a wrapper function made to disable a plugin mapping from chadrc
-- If keys are nil, false or empty string, then the mapping will be not applied
-- Useful when one wants to use that keymap for any other purpose
local map = function(...)
local keys = select(2, ...)
if not keys or keys == "" then
return
end
map_wrapper(...)
end
local M = {}
-- these mappings will only be called during initialization
M.misc = function()
local function non_config_mappings()
-- Don't copy the replaced text after pasting in visual mode
map_wrapper("v", "p", "p:let @+=@0<CR>")
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using :map
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
map_wrapper({ "n", "x", "o" }, "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
map_wrapper({ "n", "x", "o" }, "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
map_wrapper("", "<Down>", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
map_wrapper("", "<Up>", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
-- use ESC to turn off search highlighting
map_wrapper("n", "<Esc>", ":noh <CR>")
-- center cursor when moving (goto_definition)
end
local function optional_mappings()
-- don't yank text on cut ( x )
if not nvChad_options.copy_cut then
map_wrapper({ "n", "v" }, "x", '"_x')
end
-- don't yank text on delete ( dd )
if not nvChad_options.copy_del then
map_wrapper({ "n", "v" }, "d", '"_d')
end
-- navigation within insert mode
if nvChad_options.insert_nav then
local inav = maps.insert_nav
map("i", inav.backward, "<Left>")
map("i", inav.end_of_line, "<End>")
map("i", inav.forward, "<Right>")
map("i", inav.next_line, "<Down>")
map("i", inav.prev_line, "<Up>")
map("i", inav.beginning_of_line, "<ESC>^i")
end
-- easier navigation between windows
if nvChad_options.window_nav then
local wnav = maps.window_nav
map("n", wnav.moveLeft, "<C-w>h")
map("n", wnav.moveRight, "<C-w>l")
map("n", wnav.moveUp, "<C-w>k")
map("n", wnav.moveDown, "<C-w>j")
end
end
local function required_mappings()
map("n", maps.misc.cheatsheet, ":lua require('nvchad.cheatsheet').show() <CR>") -- show keybinds
map("n", maps.misc.close_buffer, ":lua require('core.utils').close_buffer() <CR>") -- close buffer
map("n", maps.misc.cp_whole_file, ":%y+ <CR>") -- copy whole file content
map("n", maps.misc.new_buffer, ":enew <CR>") -- new buffer
map("n", maps.misc.new_tab, ":tabnew <CR>") -- new tabs
map("n", maps.misc.lineNR_toggle, ":set nu! <CR>")
map("n", maps.misc.lineNR_rel_toggle, ":set rnu! <CR>") -- relative line numbers
map("n", maps.misc.save_file, ":w <CR>") -- ctrl + s to save file
-- terminal mappings --
local term_maps = maps.terminal
-- get out of terminal mode
map("t", term_maps.esc_termmode, "<C-\\><C-n>")
-- hide a term from within terminal mode
map("t", term_maps.esc_hide_termmode, "<CMD>lua require('nvchad.terminal').hide() <CR>")
-- pick a hidden term
map("n", term_maps.pick_term, ":Telescope terms <CR>")
-- Open terminals
-- TODO this opens on top of an existing vert/hori term, fixme
map(
{ "n", "t" },
term_maps.new_horizontal,
"<CMD>lua require('nvchad.terminal').new_or_toggle('horizontal', "
.. tostring(terminal_options.window.split_height)
.. ")<CR>"
)
map(
{ "n", "t" },
term_maps.new_vertical,
"<CMD>lua require('nvchad.terminal').new_or_toggle('vertical', "
.. tostring(terminal_options.window.vsplit_width)
.. ")<CR>"
)
map(
{ "n", "t" },
term_maps.new_float,
"<CMD>lua require('nvchad.terminal').new_or_toggle('float')<CR>"
)
-- spawns terminals
map(
"n",
term_maps.spawn_horizontal,
":execute 15 .. 'new +terminal' | let b:term_type = 'hori' | startinsert <CR>"
)
map("n", term_maps.spawn_vertical, ":execute 'vnew +terminal' | let b:term_type = 'vert' | startinsert <CR>")
map("n", term_maps.spawn_window, ":execute 'terminal' | let b:term_type = 'wind' | startinsert <CR>")
-- terminal mappings end --
-- Add Packer commands because we are not loading it at startup
cmd "silent! command PackerClean lua require 'plugins' require('packer').clean()"
cmd "silent! command PackerCompile lua require 'plugins' require('packer').compile()"
cmd "silent! command PackerInstall lua require 'plugins' require('packer').install()"
cmd "silent! command PackerStatus lua require 'plugins' require('packer').status()"
cmd "silent! command PackerSync lua require 'plugins' require('packer').sync()"
cmd "silent! command PackerUpdate lua require 'plugins' require('packer').update()"
-- add NvChadUpdate command and mapping
cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
map("n", maps.misc.update_nvchad, ":NvChadUpdate <CR>")
end
non_config_mappings()
optional_mappings()
required_mappings()
end
-- below are all plugin related mappings
M.bufferline = function()
local m = plugin_maps.bufferline
map("n", m.next_buffer, ":BufferLineCycleNext <CR>")
map("n", m.prev_buffer, ":BufferLineCyclePrev <CR>")
end
M.comment = function()
local m = plugin_maps.comment.toggle
map("n", m, ":lua require('Comment.api').toggle_current_linewise()<CR>")
map("v", m, ":lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>")
end
M.lspconfig = function()
local m = plugin_maps.lspconfig
-- See `:help vim.lsp.*` for documentation on any of the below functions
map("n", m.declaration, "<cmd>lua vim.lsp.buf.declaration()<CR>")
map("n", m.definition, "<cmd>lua vim.lsp.buf.definition()<CR>")
map("n", m.hover, "<cmd>lua vim.lsp.buf.hover()<CR>")
map("n", m.implementation, "<cmd>lua vim.lsp.buf.implementation()<CR>")
map("n", m.signature_help, "<cmd>lua vim.lsp.buf.signature_help()<CR>")
map("n", m.add_workspace_folder, "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
map("n", m.remove_workspace_folder, "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>")
map("n", m.list_workspace_folders, "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>")
map("n", m.type_definition, "<cmd>lua vim.lsp.buf.type_definition()<CR>")
map("n", m.rename, "<cmd>lua vim.lsp.buf.rename()<CR>")
map("n", m.code_action, "<cmd>lua vim.lsp.buf.code_action()<CR>")
map("n", m.references, "<cmd>lua vim.lsp.buf.references()<CR>")
map("n", m.float_diagnostics, "<cmd>lua vim.diagnostic.open_float()<CR>")
map("n", m.goto_prev, "<cmd>lua vim.diagnostic.goto_prev()<CR>")
map("n", m.goto_next, "<cmd>lua vim.diagnostic.goto_next()<CR>")
map("n", m.set_loclist, "<cmd>lua vim.diagnostic.setloclist()<CR>")
map("n", m.formatting, "<cmd>lua vim.lsp.buf.formatting()<CR>")
end
M.nvimtree = function()
map("n", plugin_maps.nvimtree.toggle, ":NvimTreeToggle <CR>")
map("n", plugin_maps.nvimtree.focus, ":NvimTreeFocus <CR>")
end
M.telescope = function()
local m = plugin_maps.telescope
map("n", m.buffers, ":Telescope buffers <CR>")
map("n", m.find_files, ":Telescope find_files <CR>")
map("n", m.find_hiddenfiles, ":Telescope find_files follow=true no_ignore=true hidden=true <CR>")
map("n", m.git_commits, ":Telescope git_commits <CR>")
map("n", m.git_status, ":Telescope git_status <CR>")
map("n", m.help_tags, ":Telescope help_tags <CR>")
map("n", m.live_grep, ":Telescope live_grep <CR>")
map("n", m.oldfiles, ":Telescope oldfiles <CR>")
map("n", m.themes, ":Telescope themes <CR>")
end
return M
+63
View File
@@ -0,0 +1,63 @@
local opt = vim.opt
local g = vim.g
local options = require("core.utils").load_config().options
opt.title = true
opt.clipboard = options.clipboard
opt.cmdheight = options.cmdheight
opt.cul = true -- cursor line
-- Indentline
opt.expandtab = options.expandtab
opt.shiftwidth = options.shiftwidth
opt.smartindent = options.smartindent
-- disable tilde on end of buffer: https://github.com/neovim/neovim/pull/8546#issuecomment-643643758
opt.fillchars = options.fillchars
opt.hidden = options.hidden
opt.ignorecase = options.ignorecase
opt.smartcase = options.smartcase
opt.mouse = options.mouse
-- Numbers
opt.number = options.number
opt.numberwidth = options.numberwidth
opt.relativenumber = options.relativenumber
opt.ruler = options.ruler
-- disable nvim intro
opt.shortmess:append "sI"
opt.signcolumn = "yes"
opt.splitbelow = true
opt.splitright = true
opt.tabstop = options.tabstop
opt.termguicolors = true
opt.timeoutlen = options.timeoutlen
opt.undofile = options.undofile
-- interval for writing swap file to disk, also used by gitsigns
opt.updatetime = options.updatetime
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
opt.whichwrap:append "<>[]hl"
g.mapleader = options.mapleader
-- disable some builtin vim plugins
local disabled_built_ins = require("core.utils").load_config().plugins.builtins
for _, plugin in pairs(disabled_built_ins) do
g["loaded_" .. plugin] = 1
end
--Defer loading shada until after startup_
vim.opt.shadafile = "NONE"
vim.schedule(function()
vim.opt.shadafile = require("core.utils").load_config().options.shadafile
vim.cmd [[ silent! rsh ]]
end)
+321
View File
@@ -0,0 +1,321 @@
local M = {}
local cmd = vim.cmd
M.close_buffer = function(force)
-- This is a modification of a NeoVim plugin from
-- Author: ojroques - Olivier Roques
-- Src: https://github.com/ojroques/nvim-bufdel
-- (Author has okayed copy-paste)
-- Options
local opts = {
next = "cycle", -- how to retrieve the next buffer
quit = false, -- exit when last buffer is deleted
--TODO make this a chadrc flag/option
}
-- ----------------
-- Helper functions
-- ----------------
-- Switch to buffer 'buf' on each window from list 'windows'
local function switch_buffer(windows, buf)
local cur_win = vim.fn.winnr()
for _, winid in ipairs(windows) do
winid = tonumber(winid) or 0
vim.cmd(string.format("%d wincmd w", vim.fn.win_id2win(winid)))
vim.cmd(string.format("buffer %d", buf))
end
vim.cmd(string.format("%d wincmd w", cur_win)) -- return to original window
end
-- Select the first buffer with a number greater than given buffer
local function get_next_buf(buf)
local next = vim.fn.bufnr "#"
if opts.next == "alternate" and vim.fn.buflisted(next) == 1 then
return next
end
for i = 0, vim.fn.bufnr "$" - 1 do
next = (buf + i) % vim.fn.bufnr "$" + 1 -- will loop back to 1
if vim.fn.buflisted(next) == 1 then
return next
end
end
end
-- ----------------
-- End helper functions
-- ----------------
local buf = vim.fn.bufnr()
if vim.fn.buflisted(buf) == 0 then -- exit if buffer number is invalid
vim.cmd "close"
return
end
if #vim.fn.getbufinfo { buflisted = 1 } < 2 then
if opts.quit then
-- exit when there is only one buffer left
if force then
vim.cmd "qall!"
else
vim.cmd "confirm qall"
end
return
end
local chad_term, _ = pcall(function()
return vim.api.nvim_buf_get_var(buf, "term_type")
end)
if chad_term then
-- Must be a window type
vim.cmd(string.format("setlocal nobl", buf))
vim.cmd "enew"
return
end
-- don't exit and create a new empty buffer
vim.cmd "enew"
vim.cmd "bp"
end
local next_buf = get_next_buf(buf)
local windows = vim.fn.getbufinfo(buf)[1].windows
-- force deletion of terminal buffers to avoid the prompt
if force or vim.fn.getbufvar(buf, "&buftype") == "terminal" then
local chad_term, type = pcall(function()
return vim.api.nvim_buf_get_var(buf, "term_type")
end)
-- TODO this scope is error prone, make resilient
if chad_term then
if type == "wind" then
-- hide from bufferline
vim.cmd(string.format("%d bufdo setlocal nobl", buf))
-- switch to another buff
-- TODO switch to next buffer, this works too
vim.cmd "BufferLineCycleNext"
else
local cur_win = vim.fn.winnr()
-- we can close this window
vim.cmd(string.format("%d wincmd c", cur_win))
return
end
else
switch_buffer(windows, next_buf)
vim.cmd(string.format("bd! %d", buf))
end
else
switch_buffer(windows, next_buf)
vim.cmd(string.format("silent! confirm bd %d", buf))
end
-- revert buffer switches if user has canceled deletion
if vim.fn.buflisted(buf) == 1 then
switch_buffer(windows, buf)
end
end
-- hide statusline
-- tables fetched from load_config function
M.hide_statusline = function()
local hidden = require("core.utils").load_config().plugins.options.statusline.hidden
local shown = require("core.utils").load_config().plugins.options.statusline.shown
local api = vim.api
local buftype = api.nvim_buf_get_option(0, "ft")
-- shown table from config has the highest priority
if vim.tbl_contains(shown, buftype) then
api.nvim_set_option("laststatus", 2)
return
end
if vim.tbl_contains(hidden, buftype) then
api.nvim_set_option("laststatus", 0)
return
end
api.nvim_set_option("laststatus", 2)
end
M.load_config = function()
local conf = require "core.default_config"
-- attempt to load and merge a user config
local chadrc_exists = vim.fn.filereadable(vim.fn.stdpath "config" .. "/lua/custom/chadrc.lua") == 1
if chadrc_exists then
-- merge user config if it exists and is a table; otherwise display an error
local user_config = require "custom.chadrc"
if type(user_config) == 'table' then
conf = vim.tbl_deep_extend("force", conf, user_config)
else
error("User config (chadrc.lua) *must* return a table!")
end
end
return conf
end
M.map = function(mode, keys, command, opt)
local options = { noremap = true, silent = true }
if opt then
options = vim.tbl_extend("force", options, opt)
end
-- all valid modes allowed for mappings
-- :h map-modes
local valid_modes = {
[""] = true,
["n"] = true,
["v"] = true,
["s"] = true,
["x"] = true,
["o"] = true,
["!"] = true,
["i"] = true,
["l"] = true,
["c"] = true,
["t"] = true,
}
-- helper function for M.map
-- can gives multiple modes and keys
local function map_wrapper(sub_mode, lhs, rhs, sub_options)
if type(lhs) == "table" then
for _, key in ipairs(lhs) do
map_wrapper(sub_mode, key, rhs, sub_options)
end
else
if type(sub_mode) == "table" then
for _, m in ipairs(sub_mode) do
map_wrapper(m, lhs, rhs, sub_options)
end
else
if valid_modes[sub_mode] and lhs and rhs then
vim.api.nvim_set_keymap(sub_mode, lhs, rhs, sub_options)
else
sub_mode, lhs, rhs = sub_mode or "", lhs or "", rhs or ""
print(
"Cannot set mapping [ mode = '" .. sub_mode .. "' | key = '" .. lhs .. "' | cmd = '" .. rhs .. "' ]"
)
end
end
end
end
map_wrapper(mode, keys, command, options)
end
-- load plugin after entering vim ui
M.packer_lazy_load = function(plugin, timer)
if plugin then
timer = timer or 0
vim.defer_fn(function()
require("packer").loader(plugin)
end, timer)
end
end
-- Highlights functions
-- Define bg color
-- @param group Group
-- @param color Color
M.bg = function(group, col)
cmd("hi " .. group .. " guibg=" .. col)
end
-- Define fg color
-- @param group Group
-- @param color Color
M.fg = function(group, col)
cmd("hi " .. group .. " guifg=" .. col)
end
-- Define bg and fg color
-- @param group Group
-- @param fgcol Fg Color
-- @param bgcol Bg Color
M.fg_bg = function(group, fgcol, bgcol)
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
end
-- Override default config of a plugin based on the path provided in the chadrc
-- Arguments:
-- 1st - name of plugin
-- 2nd - default config path
-- 3rd - optional function name which will called from default_config path
-- e.g: if given args - "telescope", "plugins.configs.telescope", "setup"
-- then return "require('plugins.configs.telescope').setup()"
-- if 3rd arg not given, then return "require('plugins.configs.telescope')"
-- if override is a table, mark set the override flag for the default config to true
-- override flag being true tells the plugin to call tbl_override_req as part of configuration
M.override_req = function(name, default_config, config_function)
local override, apply_table_override =
require("core.utils").load_config().plugins.default_plugin_config_replace[name], "false"
local result = default_config
if type(override) == "string" and override ~= "" then
return "require('" .. override .. "')"
elseif type(override) == "table" then
apply_table_override = "true"
elseif type(override) == "function" then
return override
end
result = "('" .. result .. "')"
if type(config_function) == "string" and config_function ~= "" then
-- add the . to call the functions and concatenate true or false as argument
result = result .. "." .. config_function .. "(" .. apply_table_override .. ")"
end
return "require" .. result
end
-- Override parts of default config of a plugin based on the table provided in the chadrc
-- FUNCTION: tbl_override_req, use `chadrc` plugin config override to modify default config if present
-- name = name inside `default_config` / `chadrc`
-- default_table = the default configuration table of the plugin
-- returns the modified configuration table
M.tbl_override_req = function(name, default_table)
local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name] or {}
return vim.tbl_deep_extend("force", default_table, override)
end
--provide labels to plugins instead of integers
M.label_plugins = function(plugins)
local plugins_labeled = {}
for _, plugin in ipairs(plugins) do
plugins_labeled[plugin[1]] = plugin
end
return plugins_labeled
end
-- remove plugins specified by user from the plugins table
M.remove_default_plugins = function(plugins)
local removals = require("core.utils").load_config().plugins.default_plugin_remove or {}
if not vim.tbl_isempty(removals) then
for _, plugin in pairs(removals) do
plugins[plugin] = nil
end
end
return plugins
end
-- append user plugins to default plugins
M.add_user_plugins = function(plugins)
local user_Plugins = require("core.utils").load_config().plugins.install or {}
if type(user_Plugins) == "string"
then user_Plugins=require(user_Plugins)
end
if not vim.tbl_isempty(user_Plugins) then
for _, v in pairs(user_Plugins) do
plugins[v[1]] = v
end
end
return plugins
end
return M
-159
View File
@@ -1,159 +0,0 @@
-- IMPORTANT NOTE : This is default config, so dont change anything here. (check chadrc.lua instead)
local M = {}
M.ui = {
theme = "onedark",
-- theme toggle
theme_toggler = false,
fav_themes = {
"onedark",
"gruvchad",
},
italic_comments = false,
-- Enable this only if your terminal has the colorscheme set which nvchad uses
-- For Ex : if you have onedark set in nvchad , set onedark's bg color on your terminal
transparency = false,
hidden_statusline = {
-- these are filetypes, not pattern matched
"NvimTree",
"terminal",
},
statusline_style = "default", -- default, round , slant , block , arrow
}
M.options = {
permanent_undo = true,
ruler = false,
hidden = true,
ignorecase = true,
mouse = "a",
cmdheight = 1,
updatetime = 250,
timeoutlen = 400,
clipboard = "unnamedplus",
number = true,
relativenumber = false,
numberwidth = 2,
expandtab = true,
shiftwidth = 2,
smartindent = true,
mapleader = " ",
autosave = false,
enable_insertNav = true, -- navigation in insertmode
-- used for updater
update_url = "https://github.com/NvChad/NvChad",
update_branch = "main",
}
-- enable and disable plugins (false for disable)
M.plugin_status = {
-- UI
nvim_bufferline = true,
galaxyline = true,
nvim_colorizer = true,
dashboard_nvim = true,
blankline = true,
truezen_nvim = true,
better_esc = true,
-- lsp stuff
lspkind = true,
lspsignature = true,
-- git stuff
gitsigns = true,
vim_fugitive = true,
-- misc
neoformat = true,
vim_matchup = true,
autosave_nvim = true,
nvim_comment = true,
neoscroll_nvim = true,
telescope_media = true,
cheatsheet = true,
}
-- make sure you dont use same keys twice
M.mappings = {
-- plugin specific
truezen = {
ataraxisMode = "<leader>zz",
minimalisticmode = "<leader>zm",
focusmode = "<leader>zf",
},
comment_nvim = {
comment_toggle = "<leader>/",
},
nvimtree = {
treetoggle = "<C-n>", -- file manager
},
neoformat = {
format = "<leader>fm",
},
dashboard = {
open = "<leader>db",
newfile = "<leader>fn",
bookmarks = "<leader>bm",
sessionload = "<leader>l",
sessionsave = "<leader>s",
},
telescope = {
live_grep = "<leader>fw",
git_status = "<leader>gt",
git_commits = "<leader>cm",
find_files = "<leader>ff",
buffers = "<leader>fb",
help_tags = "<leader>fh",
oldfiles = "<leader>fo",
themes = "<leader>th",
},
telescope_media = {
media_files = "<leader>fp",
},
chadsheet = {
default_keys = "<leader>dk",
user_keys = "<leader>uk",
},
bufferline = {
new_buffer = "<S-t>",
newtab = "<C-t>b",
close = "<S-x>", -- close a buffer with custom func in utils.lua
cycleNext = "<TAB>", -- next buffer
cyclePrev = "<S-Tab>", -- previous buffer
},
fugitive = {
Git = "<leader>gs",
diffget_2 = "<leader>gh",
diffget_3 = "<leader>gl",
git_blame = "<leader>gb",
},
terms = { -- below are NvChad mappings, not plugin mappings
esc_termmode = "jk",
esc_hide_termmode = "JK",
pick_term = "<leader>W", -- note: this is a telescope extension
new_wind = "<leader>w",
new_vert = "<leader>v",
new_hori = "<leader>h",
}, -- navigation in insert mode
insert_nav = {
forward = "<C-l>",
backward = "<C-h>",
top_of_line = "<C-a>",
end_of_line = "<C-e>",
prev_line = "<C-j>",
next_line = "<C-k>",
},
-- non plugin
misc = {
esc_Termmode = "jk", -- get out of terminal mode
close_buffer = "<S-x>", -- close current focused buffer
copywhole_file = "<C-a>",
toggle_linenr = "<leader>n", -- show or hide line number
theme_toggle = "<leader>x",
update_nvchad = "<leader>uu",
},
}
return M
-135
View File
@@ -1,135 +0,0 @@
local cmd = vim.cmd
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
local white = colors.white
local darker_black = colors.darker_black
local black = colors.black
local black2 = colors.black2
local one_bg = colors.one_bg
local one_bg2 = colors.one_bg2
local grey = colors.grey
local grey_fg = colors.grey_fg
local red = colors.red
local line = colors.line
local green = colors.green
local nord_blue = colors.nord_blue
local blue = colors.blue
local yellow = colors.yellow
local purple = colors.purple
local pmenu_bg = colors.pmenu_bg
local folder_bg = colors.folder_bg
-- for guifg , bg
local function fg(group, color)
cmd("hi " .. group .. " guifg=" .. color)
end
local function bg(group, color)
cmd("hi " .. group .. " guibg=" .. color)
end
local function fg_bg(group, fgcol, bgcol)
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
end
-- blankline
fg("IndentBlanklineChar", line)
-- misc --
fg("LineNr", grey)
-- Comments
local ui = require("utils").load_config().ui
if ui.italic_comments then
cmd("hi Comment gui=italic guifg=" .. grey_fg)
else
fg("Comment", grey_fg)
end
fg("NvimInternalError", red)
fg("VertSplit", line)
fg("EndOfBuffer", black)
-- fg_bg("Visual",light_grey, colors.lightbg)
-- Pmenu
bg("Pmenu", one_bg)
bg("PmenuSbar", one_bg2)
bg("PmenuSel", pmenu_bg)
bg("PmenuThumb", nord_blue)
-- inactive statuslines as thin splitlines
cmd("hi! StatusLineNC gui=underline guifg=" .. line)
-- line n.o
cmd "hi clear CursorLine"
fg("cursorlinenr", white)
-- git signs ---
fg_bg("DiffAdd", nord_blue, "none")
fg_bg("DiffChange", grey_fg, "none")
fg_bg("DiffModified", nord_blue, "none")
-- NvimTree
fg("NvimTreeFolderIcon", folder_bg)
fg("NvimTreeFolderName", folder_bg)
fg("NvimTreeGitDirty", red)
fg("NvimTreeOpenedFolderName", blue)
fg("NvimTreeEmptyFolderName", blue)
fg("NvimTreeIndentMarker", one_bg2)
fg("NvimTreeVertSplit", darker_black)
bg("NvimTreeVertSplit", darker_black)
fg("NvimTreeEndOfBuffer", darker_black)
cmd("hi NvimTreeRootFolder gui=underline guifg=" .. red)
bg("NvimTreeNormal", darker_black)
fg_bg("NvimTreeStatuslineNc", darker_black, darker_black)
fg_bg("NvimTreeWindowPicker", red, black2)
-- telescope
fg("TelescopeBorder", line)
fg("TelescopePromptBorder", line)
fg("TelescopeResultsBorder", line)
fg("TelescopePreviewBorder", grey)
-- LspDiagnostics ---
-- error / warnings
fg("LspDiagnosticsSignError", red)
fg("LspDiagnosticsVirtualTextError", red)
fg("LspDiagnosticsSignWarning", yellow)
fg("LspDiagnosticsVirtualTextWarning", yellow)
-- info
fg("LspDiagnosticsSignInformation", green)
fg("LspDiagnosticsVirtualTextInformation", green)
-- hint
fg("LspDiagnosticsSignHint", purple)
fg("LspDiagnosticsVirtualTextHint", purple)
-- dashboard
fg("DashboardHeader", grey_fg)
fg("DashboardCenter", grey_fg)
fg("DashboardShortcut", grey_fg)
fg("DashboardFooter", grey_fg)
if require("utils").load_config().ui.transparency then
bg("Normal", "NONE")
bg("Folded", "NONE")
fg("Folded", "NONE")
bg("NvimTreeNormal", "NONE")
bg("NvimTreeVertSplit", "NONE")
fg("NvimTreeVertSplit", grey)
bg("NvimTreeStatusLineNC", "NONE")
fg("Comment", grey)
end
-- For floating windows
bg("NormalFloat", one_bg)
fg("FloatBorder", blue)
-188
View File
@@ -1,188 +0,0 @@
local user_map = require("utils").load_config().mappings
local miscMap = user_map.misc
local cmd = vim.cmd
local function map(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
local M = {}
local opt = {}
-- these mappings will only be called during initialization
M.misc = function()
-- dont copy any deleted text , this is disabled by default so uncomment the below mappings if you want them
-- map("n", "dd", [=[ "_dd ]=], opt)
-- map("v", "dd", [=[ "_dd ]=], opt)
-- map("v", "x", [=[ "_x ]=], opt)
-- todo: this should be configurable via chadrc
-- Don't copy the replaced text after pasting in visual mode
map("v", "p", '"_dP', opt)
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using :map
map("", "j", 'v:count ? "j" : "gj"', { expr = true })
map("", "k", 'v:count ? "k" : "gk"', { expr = true })
map("", "<Down>", 'v:count ? "j" : "gj"', { expr = true })
map("", "<Up>", 'v:count ? "k" : "gk"', { expr = true })
-- copy whole file content
map("n", miscMap.copywhole_file, ":%y+<CR>", opt)
-- toggle numbers
map("n", miscMap.toggle_linenr, ":set nu!<CR>", opt)
-- terminals
local function terms()
local m = user_map.terms
-- get out of terminal mode
map("t", m.esc_termmode, "<C-\\><C-n>", opt)
-- hide a term from within terminal mode
map("t", m.esc_hide_termmode, "<C-\\><C-n> :lua require('utils').close_buffer() <CR>", opt)
-- pick a hidden term
map("n", m.pick_term, ":Telescope terms <CR>", opt)
-- Open terminals
-- TODO this opens on top of an existing vert/hori term, fixme
map("n", m.new_wind, ":execute 'terminal' | let b:term_type = 'wind' | startinsert <CR>", opt)
map("n", m.new_vert, ":execute 'vnew +terminal' | let b:term_type = 'vert' | startinsert <CR>", opt)
map("n", m.new_hori, ":execute 15 .. 'new +terminal' | let b:term_type = 'hori' | startinsert <CR>", opt)
end
terms()
-- ctrl + s to save file
map("n", "<C-s>", ":w <CR>", opt)
-- use ESC to turn off search highlighting
map("n", "<Esc>", ":noh<CR>", opt)
-- navigation within insert mode
local check_insertNav = require("utils").load_config().options.enable_insertNav
if check_insertNav == true then
local m = user_map.insert_nav
map("i", m.forward, "<Right>", opt)
map("i", m.backward, "<Left>", opt)
map("i", m.top_of_line, "<ESC>^i", opt)
map("i", m.end_of_line, "<End>", opt)
map("i", m.next_line, "<Up>", opt)
map("i", m.prev_line, "<Down>", opt)
end
-- check the theme toggler
local theme_toggler = require("utils").load_config().ui.theme_toggler
if theme_toggler == true then
local m = user_map.misc.theme_toggle
map("n", m, ":lua require('utils').toggle_theme(require('utils').load_config().ui.fav_themes)<CR>", opt)
end
-- Packer commands till because we are not loading it at startup
cmd "silent! command PackerCompile lua require 'pluginList' require('packer').compile()"
cmd "silent! command PackerInstall lua require 'pluginList' require('packer').install()"
cmd "silent! command PackerStatus lua require 'pluginList' require('packer').status()"
cmd "silent! command PackerSync lua require 'pluginList' require('packer').sync()"
cmd "silent! command PackerUpdate lua require 'pluginList' require('packer').update()"
-- add NvChadUpdate command and mapping
cmd "silent! command! NvChadUpdate lua require('utils').update_nvchad()"
map("n", user_map.misc.update_nvchad, ":NvChadUpdate<CR>", opt)
end
M.bufferline = function()
local m = user_map.bufferline
map("n", m.new_buffer, ":enew<CR>", opt) -- new buffer
map("n", m.newtab, ":tabnew<CR>", opt) -- new tab
map("n", m.close, ":lua require('utils').close_buffer() <CR>", opt) -- close buffer
-- move between tabs
map("n", m.cycleNext, ":BufferLineCycleNext<CR>", opt)
map("n", m.cyclePrev, ":BufferLineCyclePrev<CR>", opt)
end
M.chadsheet = function()
local m = user_map.chadsheet
map("n", m.default_keys, ":lua require('cheatsheet').show_cheatsheet_telescope()<CR>", opt)
map(
"n",
m.user_keys,
":lua require('cheatsheet').show_cheatsheet_telescope{bundled_cheatsheets = false, bundled_plugin_cheatsheets = false }<CR>",
opt
)
end
M.comment_nvim = function()
local m = user_map.comment_nvim.comment_toggle
map("n", m, ":CommentToggle<CR>", opt)
map("v", m, ":CommentToggle<CR>", opt)
end
M.dashboard = function()
local m = user_map.dashboard
map("n", m.open, ":Dashboard<CR>", opt)
map("n", m.newfile, ":DashboardNewFile<CR>", opt)
map("n", m.bookmarks, ":DashboardJumpMarks<CR>", opt)
map("n", m.sessionload, ":SessionLoad<CR>", opt)
map("n", m.sessionsave, ":SessionSave<CR>", opt)
end
M.fugitive = function()
local m = user_map.fugitive
map("n", m.Git, ":Git<CR>", opt)
map("n", m.diffget_2, ":diffget //2<CR>", opt)
map("n", m.diffget_3, ":diffget //3<CR>", opt)
map("n", m.git_blame, ":Git blame<CR>", opt)
end
M.nvimtree = function()
local m = user_map.nvimtree.treetoggle
map("n", m, ":NvimTreeToggle<CR>", opt)
end
M.neoformat = function()
local m = user_map.neoformat.format
map("n", m, ":Neoformat<CR>", opt)
end
M.truezen = function()
local m = user_map.truezen
map("n", m.ataraxisMode, ":TZAtaraxis<CR>", opt)
map("n", m.minimalisticmode, ":TZMinimalist<CR>", opt)
map("n", m.focusmode, ":TZFocus<CR>", opt)
end
M.telescope = function()
local m = user_map.telescope
map("n", m.live_grep, ":Telescope live_grep<CR>", opt)
map("n", m.git_status, ":Telescope git_status <CR>", opt)
map("n", m.git_commits, ":Telescope git_commits <CR>", opt)
map("n", m.find_files, ":Telescope find_files <CR>", opt)
map("n", m.buffers, ":Telescope buffers<CR>", opt)
map("n", m.help_tags, ":Telescope help_tags<CR>", opt)
map("n", m.oldfiles, ":Telescope oldfiles<CR>", opt)
map("n", m.themes, ":Telescope themes<CR>", opt)
end
M.telescope_media = function()
local m = user_map.telescope_media
map("n", m.media_files, ":Telescope media_files <CR>", opt)
end
return M
-88
View File
@@ -1,88 +0,0 @@
local opt = vim.opt
local g = vim.g
-- export user config as a global varibale
g.nvchad_user_config = "chadrc"
local options = require("utils").load_config().options
opt.completeopt = { "menuone", "noselect" }
opt.undofile = options.permanent_undo
opt.ruler = options.ruler
opt.hidden = options.hidden
opt.ignorecase = options.ignorecase
opt.splitbelow = true
opt.splitright = true
opt.termguicolors = true
opt.cul = true
opt.mouse = options.mouse
opt.signcolumn = "yes"
opt.cmdheight = options.cmdheight
opt.updatetime = options.updatetime -- update interval for gitsigns
opt.timeoutlen = options.timeoutlen
opt.clipboard = options.clipboard
-- disable nvim intro
opt.shortmess:append "sI"
-- disable tilde on end of buffer: https://github.com/ neovim/neovim/pull/8546#issuecomment-643643758
opt.fillchars = { eob = " " }
-- Numbers
opt.number = options.number
opt.numberwidth = options.numberwidth
opt.relativenumber = options.relativenumber
-- Indenline
opt.expandtab = options.expandtab
opt.shiftwidth = options.shiftwidth
opt.smartindent = options.smartindent
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
opt.whichwrap:append "<>hl"
g.mapleader = options.mapleader
g.auto_save = options.autosave
-- disable builtin vim plugins
local disabled_built_ins = {
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"gzip",
"zip",
"zipPlugin",
"tar",
"tarPlugin",
"getscript",
"getscriptPlugin",
"vimball",
"vimballPlugin",
"2html_plugin",
"logipat",
"rrhelper",
"spellfile_plugin",
"matchit",
}
for _, plugin in pairs(disabled_built_ins) do
g["loaded_" .. plugin] = 1
end
-- Use relative & absolute line numbers in 'n' & 'i' modes respectively
-- vim.cmd[[ au InsertEnter * set norelativenumber ]]
-- vim.cmd[[ au InsertLeave * set relativenumber ]]
-- Don't show any numbers inside terminals
vim.cmd [[ au TermOpen term://* setlocal nonumber norelativenumber ]]
-- Don't show status line on certain windows
vim.cmd [[ au TermOpen term://* setfiletype terminal ]]
vim.cmd [[ let hidden_statusline = luaeval('require("utils").load_config().ui.hidden_statusline') | autocmd BufEnter,BufWinEnter,WinEnter,CmdwinEnter,TermEnter * nested if index(hidden_statusline, &ft) >= 0 | set laststatus=0 | else | set laststatus=2 | endif ]]
-- Open a file from its last left off position
-- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]
-- File extension specific tabbing
-- vim.cmd [[ autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 ]]
-317
View File
@@ -1,317 +0,0 @@
local plugin_status = require("utils").load_config().plugin_status
local present, _ = pcall(require, "packerInit")
local packer
if present then
packer = require "packer"
else
return false
end
local use = packer.use
return packer.startup(function()
use {
"wbthomason/packer.nvim",
event = "VimEnter",
}
use {
"jdhao/better-escape.vim",
disable = not plugin_status.better_esc,
event = "InsertEnter",
config = function()
require("plugins.others").escape()
end,
}
use {
"glepnir/galaxyline.nvim",
disable = not plugin_status.galaxyline,
after = "nvim-web-devicons",
config = function()
require "plugins.statusline"
end,
}
use {
"akinsho/nvim-bufferline.lua",
disable = not plugin_status.nvim_bufferline,
after = "galaxyline.nvim",
config = function()
require "plugins.bufferline"
end,
setup = function()
require("mappings").bufferline()
end,
}
-- color related stuff
use {
"NvChad/nvim-base16.lua",
after = "packer.nvim",
config = function()
require "theme"
end,
}
use {
"norcalli/nvim-colorizer.lua",
disable = not plugin_status.nvim_colorizer,
event = "BufRead",
config = function()
require("plugins.others").colorizer()
end,
}
-- lsp stuff
use {
"nvim-treesitter/nvim-treesitter",
event = "BufRead",
config = function()
require "plugins.treesitter"
end,
}
use {
"kabouzeid/nvim-lspinstall",
event = "BufRead",
}
use {
"neovim/nvim-lspconfig",
after = "nvim-lspinstall",
config = function()
require "plugins.lspconfig"
end,
}
use {
"onsails/lspkind-nvim",
disable = not plugin_status.lspkind,
event = "BufEnter",
config = function()
require("plugins.others").lspkind()
end,
}
use {
"ray-x/lsp_signature.nvim",
disable = not plugin_status.lspsignature,
after = "nvim-lspconfig",
config = function()
require("plugins.others").signature()
end,
}
-- load compe in insert mode only
use {
"hrsh7th/nvim-compe",
event = "InsertEnter",
config = function()
require "plugins.compe"
end,
wants = "LuaSnip",
requires = {
{
"L3MON4D3/LuaSnip",
wants = "friendly-snippets",
event = "InsertCharPre",
config = function()
require "plugins.luasnip"
end,
},
{
"rafamadriz/friendly-snippets",
event = "InsertCharPre",
},
},
}
use {
"sbdchd/neoformat",
disable = not plugin_status.neoformat,
cmd = "Neoformat",
setup = function()
require("mappings").neoformat()
end,
}
-- file managing , picker etc
use {
"kyazdani42/nvim-tree.lua",
cmd = "NvimTreeToggle",
config = function()
require "plugins.nvimtree"
end,
setup = function()
require("mappings").nvimtree()
end,
}
use {
"kyazdani42/nvim-web-devicons",
after = "nvim-base16.lua",
config = function()
require "plugins.icons"
end,
}
use {
"nvim-lua/plenary.nvim",
after = "nvim-bufferline.lua",
}
use {
"nvim-lua/popup.nvim",
after = "plenary.nvim",
}
use {
"nvim-telescope/telescope.nvim",
after = "plenary.nvim",
requires = {
{
"nvim-telescope/telescope-fzf-native.nvim",
run = "make",
},
{
"nvim-telescope/telescope-media-files.nvim",
disable = not plugin_status.telescope_media,
setup = function()
require("mappings").telescope_media()
end,
},
{
"sudormrfbin/cheatsheet.nvim",
disable = not plugin_status.cheatsheet,
event = "VimEnter",
after = "telescope.nvim",
config = function()
require "plugins.chadsheet"
end,
setup = function()
require("mappings").chadsheet()
end,
},
},
config = function()
require "plugins.telescope"
end,
setup = function()
require("mappings").telescope()
end,
}
-- git stuff
use {
"lewis6991/gitsigns.nvim",
disable = not plugin_status.gitsigns,
after = "plenary.nvim",
config = function()
require "plugins.gitsigns"
end,
}
-- misc plugins
use {
"windwp/nvim-autopairs",
after = "nvim-compe",
config = function()
require "plugins.autopairs"
end,
}
use {
"andymass/vim-matchup",
disable = not plugin_status.vim_matchup,
event = "CursorMoved",
}
use {
"terrortylor/nvim-comment",
disable = not plugin_status.nvim_comment,
cmd = "CommentToggle",
config = function()
require("plugins.others").comment()
end,
setup = function()
require("mappings").comment_nvim()
end,
}
use {
"glepnir/dashboard-nvim",
disable = not plugin_status.dashboard_nvim,
cmd = {
"Dashboard",
"DashboardNewFile",
"DashboardJumpMarks",
"SessionLoad",
"SessionSave",
},
setup = function()
require "plugins.dashboard"
require("mappings").dashboard()
end,
}
-- load autosave only if its globally enabled
use {
disable = not plugin_status.autosave_nvim,
"Pocco81/AutoSave.nvim",
config = function()
require "plugins.autosave"
end,
cond = function()
return vim.g.auto_save == true
end,
}
-- smooth scroll
use {
"karb94/neoscroll.nvim",
disable = not plugin_status.neoscroll_nvim,
event = "WinScrolled",
config = function()
require("plugins.others").neoscroll()
end,
}
use {
"Pocco81/TrueZen.nvim",
disable = not plugin_status.truezen_nvim,
cmd = {
"TZAtaraxis",
"TZMinimalist",
"TZFocus",
},
config = function()
require "plugins.zenmode"
end,
setup = function()
require("mappings").truezen()
end,
}
-- use "alvan/vim-closetag" -- for html autoclosing tag
use {
"lukas-reineke/indent-blankline.nvim",
disable = not plugin_status.blankline,
event = "BufRead",
setup = function()
require("plugins.others").blankline()
end,
}
use {
"tpope/vim-fugitive",
disable = not plugin_status.vim_fugitive,
cmd = {
"Git",
},
setup = function()
require("mappings").fugitive()
end,
}
end)
-12
View File
@@ -1,12 +0,0 @@
local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, autopairs_completion = pcall(require, "nvim-autopairs.completion.compe")
if not (present1 or present2) then
return
end
autopairs.setup()
autopairs_completion.setup {
map_cr = true,
map_complete = true, -- insert () func completion
}
-19
View File
@@ -1,19 +0,0 @@
-- autosave.nvim plugin disabled by default
local present, autosave = pcall(require, "autosave")
if not present then
return
end
autosave.setup {
enabled = vim.g.auto_save, -- takes boolean value from init.lua
execution_message = "autosaved at : " .. vim.fn.strftime "%H:%M:%S",
events = { "InsertLeave", "TextChanged" },
conditions = {
exists = true,
filetype_is_not = {},
modifiable = true,
},
write_all_buffers = false,
on_off_commands = true,
clean_command_line_interval = 2500,
}
-123
View File
@@ -1,123 +0,0 @@
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
local present, bufferline = pcall(require, "bufferline")
if not present then
return
end
bufferline.setup {
options = {
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
buffer_close_icon = "",
modified_icon = "",
close_icon = "",
left_trunc_marker = "",
right_trunc_marker = "",
max_name_length = 14,
max_prefix_length = 13,
tab_size = 20,
show_tab_indicators = true,
enforce_regular_tabs = false,
view = "multiwindow",
show_buffer_close_icons = true,
separator_style = "thin",
mappings = true,
always_show_bufferline = true,
custom_filter = function(buf_number)
-- Func to filter out our managed/persistent split terms
local present_type, type = pcall(function()
return vim.api.nvim_buf_get_var(buf_number, "term_type")
end)
if present_type then
if type == "vert" then
return false
elseif type == "hori" then
return false
else
return true
end
else
return true
end
end,
},
highlights = {
fill = {
guifg = colors.grey_fg,
guibg = colors.black2,
},
background = {
guifg = colors.grey_fg,
guibg = colors.black2,
},
-- buffers
buffer_visible = {
guifg = colors.light_grey,
guibg = colors.black2,
},
buffer_selected = {
guifg = colors.white,
guibg = colors.black,
gui = "bold",
},
-- tabs
tab = {
guifg = colors.light_grey,
guibg = colors.one_bg3,
},
tab_selected = {
guifg = colors.black2,
guibg = colors.nord_blue,
},
tab_close = {
guifg = colors.red,
guibg = colors.black,
},
indicator_selected = {
guifg = colors.black,
guibg = colors.black,
},
-- separators
separator = {
guifg = colors.black2,
guibg = colors.black2,
},
separator_visible = {
guifg = colors.black2,
guibg = colors.black2,
},
separator_selected = {
guifg = colors.black2,
guibg = colors.black2,
},
-- modified
modified = {
guifg = colors.red,
guibg = colors.black2,
},
modified_visible = {
guifg = colors.red,
guibg = colors.black2,
},
modified_selected = {
guifg = colors.green,
guibg = colors.black,
},
-- close buttons
close_button = {
guifg = colors.light_grey,
guibg = colors.black2,
},
close_button_visible = {
guifg = colors.light_grey,
guibg = colors.black2,
},
close_button_selected = {
guifg = colors.red,
guibg = colors.black,
},
},
}
-25
View File
@@ -1,25 +0,0 @@
local present, chadsheet = pcall(require, "cheatsheet")
if not present then
return
end
local mappings = require("utils").load_config().mappings
-- add user mappings to the cheetsheet
for section, data in pairs(mappings) do
for description, keymap in pairs(data) do
chadsheet.add_cheat(description, keymap, section)
end
end
require("cheatsheet").setup {
bundled_cheatsheets = {
enabled = { "default" },
disabled = { "unicode", "nerd-fonts" },
},
bundled_plugin_cheatsheets = false,
include_only_installed_plugins = true,
}
-25
View File
@@ -1,25 +0,0 @@
local present, compe = pcall(require, "compe")
if not present then
return
end
compe.setup {
enabled = true,
autocomplete = true,
debug = false,
min_length = 1,
preselect = "enable",
throttle_time = 80,
source_timeout = 200,
incomplete_delay = 400,
max_abbr_width = 100,
max_kind_width = 100,
max_menu_width = 100,
documentation = true,
source = {
buffer = { kind = "﬘", true },
luasnip = { kind = "﬌", true },
nvim_lsp = true,
nvim_lua = true,
},
}
+92
View File
@@ -0,0 +1,92 @@
local present, alpha = pcall(require, "alpha")
if not present then
return
end
local function button(sc, txt, keybind)
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
local opts = {
position = "center",
text = txt,
shortcut = sc,
cursor = 5,
width = 36,
align_shortcut = "right",
hl = "AlphaButtons",
}
if keybind then
opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } }
end
return {
type = "button",
val = txt,
on_press = function()
local key = vim.api.nvim_replace_termcodes(sc_, true, false, true)
vim.api.nvim_feedkeys(key, "normal", false)
end,
opts = opts,
}
end
local default = {}
default.ascii = {
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
}
default.header = {
type = "text",
val = default.ascii,
opts = {
position = "center",
hl = "AlphaHeader",
},
}
default.buttons = {
type = "group",
val = {
button("SPC f f", " Find File ", ":Telescope find_files<CR>"),
button("SPC f o", " Recent File ", ":Telescope oldfiles<CR>"),
button("SPC f w", " Find Word ", ":Telescope live_grep<CR>"),
button("SPC b m", " Bookmarks ", ":Telescope marks<CR>"),
button("SPC t h", " Themes ", ":Telescope themes<CR>"),
button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h <CR>"),
},
opts = {
spacing = 1,
},
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("alpha", default)
end
alpha.setup {
layout = {
{ type = "padding", val = 9 },
default.header,
{ type = "padding", val = 2 },
default.buttons,
},
opts = {},
}
end
return M
+148
View File
@@ -0,0 +1,148 @@
local present, bufferline = pcall(require, "bufferline")
if not present then
return
end
local default = {
colors = require("colors").get(),
}
default = {
options = {
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
buffer_close_icon = "",
modified_icon = "",
close_icon = "",
show_close_icon = true,
left_trunc_marker = "",
right_trunc_marker = "",
max_name_length = 14,
max_prefix_length = 13,
tab_size = 20,
show_tab_indicators = true,
enforce_regular_tabs = false,
view = "multiwindow",
show_buffer_close_icons = true,
separator_style = "thin",
always_show_bufferline = true,
diagnostics = false,
custom_filter = function(buf_number)
-- Func to filter out our managed/persistent split terms
local present_type, type = pcall(function()
return vim.api.nvim_buf_get_var(buf_number, "term_type")
end)
if present_type then
if type == "vert" then
return false
elseif type == "hori" then
return false
end
return true
end
return true
end,
},
highlights = {
background = {
guifg = default.colors.grey_fg,
guibg = default.colors.black2,
},
-- buffers
buffer_selected = {
guifg = default.colors.white,
guibg = default.colors.black,
gui = "bold",
},
buffer_visible = {
guifg = default.colors.light_grey,
guibg = default.colors.black2,
},
-- for diagnostics = "nvim_lsp"
error = {
guifg = default.colors.light_grey,
guibg = default.colors.black2,
},
error_diagnostic = {
guifg = default.colors.light_grey,
guibg = default.colors.black2,
},
-- close buttons
close_button = {
guifg = default.colors.light_grey,
guibg = default.colors.black2,
},
close_button_visible = {
guifg = default.colors.light_grey,
guibg = default.colors.black2,
},
close_button_selected = {
guifg = default.colors.red,
guibg = default.colors.black,
},
fill = {
guifg = default.colors.grey_fg,
guibg = default.colors.black2,
},
indicator_selected = {
guifg = default.colors.black,
guibg = default.colors.black,
},
-- modified
modified = {
guifg = default.colors.red,
guibg = default.colors.black2,
},
modified_visible = {
guifg = default.colors.red,
guibg = default.colors.black2,
},
modified_selected = {
guifg = default.colors.green,
guibg = default.colors.black,
},
-- separators
separator = {
guifg = default.colors.black2,
guibg = default.colors.black2,
},
separator_visible = {
guifg = default.colors.black2,
guibg = default.colors.black2,
},
separator_selected = {
guifg = default.colors.black2,
guibg = default.colors.black2,
},
-- tabs
tab = {
guifg = default.colors.light_grey,
guibg = default.colors.one_bg3,
},
tab_selected = {
guifg = default.colors.black2,
guibg = default.colors.nord_blue,
},
tab_close = {
guifg = default.colors.red,
guibg = default.colors.black,
},
},
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("bufferline", default)
end
bufferline.setup(default)
end
return M
+76
View File
@@ -0,0 +1,76 @@
local present, cmp = pcall(require, "cmp")
if not present then
return
end
vim.opt.completeopt = "menuone,noselect"
local default = {
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
formatting = {
format = function(entry, vim_item)
local icons = require "plugins.configs.lspkind_icons"
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
vim_item.menu = ({
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
buffer = "[BUF]",
})[entry.source.name]
return vim_item
end,
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end, { "i", "s" }),
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "path" },
},
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("nvim_cmp", default)
end
cmp.setup(default)
end
return M
+158
View File
@@ -0,0 +1,158 @@
local present, icons = pcall(require, "nvim-web-devicons")
if not present then
return
end
local default = {
colors = require("colors").get(),
}
default = {
override = {
c = {
icon = "",
color = default.colors.blue,
name = "c",
},
css = {
icon = "",
color = default.colors.blue,
name = "css",
},
deb = {
icon = "",
color = default.colors.cyan,
name = "deb",
},
Dockerfile = {
icon = "",
color = default.colors.cyan,
name = "Dockerfile",
},
html = {
icon = "",
color = default.colors.baby_pink,
name = "html",
},
jpeg = {
icon = "",
color = default.colors.dark_purple,
name = "jpeg",
},
jpg = {
icon = "",
color = default.colors.dark_purple,
name = "jpg",
},
js = {
icon = "",
color = default.colors.sun,
name = "js",
},
kt = {
icon = "󱈙",
color = default.colors.orange,
name = "kt",
},
lock = {
icon = "",
color = default.colors.red,
name = "lock",
},
lua = {
icon = "",
color = default.colors.blue,
name = "lua",
},
mp3 = {
icon = "",
color = default.colors.white,
name = "mp3",
},
mp4 = {
icon = "",
color = default.colors.white,
name = "mp4",
},
out = {
icon = "",
color = default.colors.white,
name = "out",
},
png = {
icon = "",
color = default.colors.dark_purple,
name = "png",
},
py = {
icon = "",
color = default.colors.cyan,
name = "py",
},
["robots.txt"] = {
icon = "ﮧ",
color = default.colors.red,
name = "robots",
},
toml = {
icon = "",
color = default.colors.blue,
name = "toml",
},
ts = {
icon = "ﯤ",
color = default.colors.teal,
name = "ts",
},
ttf = {
icon = "",
color = default.colors.white,
name = "TrueTypeFont",
},
rb = {
icon = "",
color = default.colors.pink,
name = "rb",
},
rpm = {
icon = "",
color = default.colors.orange,
name = "rpm",
},
vue = {
icon = "﵂",
color = default.colors.vibrant_green,
name = "vue",
},
woff = {
icon = "",
color = default.colors.white,
name = "WebOpenFontFormat",
},
woff2 = {
icon = "",
color = default.colors.white,
name = "WebOpenFontFormat2",
},
xz = {
icon = "",
color = default.colors.sun,
name = "xz",
},
zip = {
icon = "",
color = default.colors.sun,
name = "zip",
},
},
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("nvim_web_devicons", default)
end
icons.setup(default)
end
return M
+41
View File
@@ -0,0 +1,41 @@
local M = {}
require("plugins.configs.others").lsp_handlers()
function M.on_attach(client, bufnr)
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
-- Enable completion triggered by <c-x><c-o>
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
require("core.mappings").lspconfig()
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" }
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.preselectSupport = true
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
}
-- requires a file containing user's lspconfigs
local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf
if #addlsp_confs ~= 0 then
require(addlsp_confs).setup_lsp(M.on_attach, capabilities)
end
return M
+29
View File
@@ -0,0 +1,29 @@
local icons = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "ﰠ",
Variable = "",
Class = "ﴯ",
Interface = "",
Module = "",
Property = "ﰠ",
Unit = "塞",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "פּ",
Event = "",
Operator = "",
TypeParameter = "",
}
return icons
+90
View File
@@ -0,0 +1,90 @@
-- globals must be set prior to requiring nvim-tree to function
local g = vim.g
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
g.nvim_tree_git_hl = 0
g.nvim_tree_highlight_opened_files = 0
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
g.nvim_tree_show_icons = {
folders = 1,
files = 1,
git = 1,
}
g.nvim_tree_icons = {
default = "",
symlink = "",
git = {
deleted = "",
ignored = "◌",
renamed = "➜",
staged = "✓",
unmerged = "",
unstaged = "✗",
untracked = "★",
},
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
},
}
local present, nvimtree = pcall(require, "nvim-tree")
if not present then
return
end
local default = {
filters = {
dotfiles = false,
},
disable_netrw = true,
hijack_netrw = true,
ignore_ft_on_setup = { "dashboard" },
auto_close = false,
open_on_tab = false,
hijack_cursor = true,
hijack_unnamed_buffer_when_opening = false,
update_cwd = true,
update_focused_file = {
enable = true,
update_cwd = false,
},
view = {
allow_resize = true,
side = "left",
width = 25,
hide_root_folder = true,
},
git = {
enable = false,
ignore = false,
},
actions = {
open_file = {
resize_window = true,
},
},
renderer = {
indent_markers = {
enable = true,
}
}
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("nvim_tree", default)
end
nvimtree.setup(default)
end
return M
+196
View File
@@ -0,0 +1,196 @@
local M = {}
local chadrc_config = require("core.utils").load_config()
M.autopairs = function(override_flag)
local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
if present1 and present2 then
local default = { fast_wrap = {} }
if override_flag then
default = require("core.utils").tbl_override_req("nvim_autopairs", default)
end
autopairs.setup(default)
local cmp = require "cmp"
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end
end
M.better_escape = function()
require("better_escape").setup {
mapping = chadrc_config.mappings.plugins.better_escape.esc_insertmode,
timeout = chadrc_config.plugins.options.esc_insertmode_timeout,
}
end
M.blankline = function(override_flag)
local default = {
indentLine_enabled = 1,
char = "▏",
filetype_exclude = {
"help",
"terminal",
"alpha",
"packer",
"lspinfo",
"TelescopePrompt",
"TelescopeResults",
"nvchad_cheatsheet",
"lsp-installer",
"",
},
buftype_exclude = { "terminal" },
show_trailing_blankline_indent = false,
show_first_indent_level = false,
}
if override_flag then
default = require("core.utils").tbl_override_req("indent_blankline", default)
end
require("indent_blankline").setup(default)
end
M.colorizer = function(override_flag)
local present, colorizer = pcall(require, "colorizer")
if present then
local default = {
filetypes = {
"*",
},
user_default_options = {
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
names = false, -- "Name" codes like Blue
RRGGBBAA = false, -- #RRGGBBAA hex codes
rgb_fn = false, -- CSS rgb() and rgba() functions
hsl_fn = false, -- CSS hsl() and hsla() functions
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
-- Available modes: foreground, background
mode = "background", -- Set the display mode.
},
}
if override_flag then
default = require("core.utils").tbl_override_req("nvim_colorizer", default)
end
colorizer.setup(default["filetypes"], default["user_default_options"])
vim.cmd "ColorizerReloadAllBuffers"
end
end
M.comment = function(override_flag)
local present, nvim_comment = pcall(require, "Comment")
if present then
local default = {}
if override_flag then
default = require("core.utils").tbl_override_req("nvim_comment", default)
end
nvim_comment.setup(default)
end
end
M.luasnip = function(override_flag)
local present, luasnip = pcall(require, "luasnip")
if present then
local default = {
history = true,
updateevents = "TextChanged,TextChangedI",
}
if override_flag then
default = require("core.utils").tbl_override_req("luasnip", default)
end
luasnip.config.set_config(default)
require("luasnip/loaders/from_vscode").load { paths = chadrc_config.plugins.options.luasnip.snippet_path }
require("luasnip/loaders/from_vscode").load()
end
end
M.signature = function(override_flag)
local present, lspsignature = pcall(require, "lsp_signature")
if present then
local default = {
bind = true,
doc_lines = 0,
floating_window = true,
fix_pos = true,
hint_enable = true,
hint_prefix = "",
hint_scheme = "String",
hi_parameter = "Search",
max_height = 22,
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
handler_opts = {
border = "single", -- double, single, shadow, none
},
zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
}
if override_flag then
default = require("core.utils").tbl_override_req("signature", default)
end
lspsignature.setup(default)
end
end
M.lsp_handlers = function()
local function lspSymbol(name, icon)
local hl = "DiagnosticSign" .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
end
lspSymbol("Error", "")
lspSymbol("Info", "")
lspSymbol("Hint", "")
lspSymbol("Warn", "")
vim.diagnostic.config {
virtual_text = {
prefix = "",
},
signs = true,
underline = true,
update_in_insert = false,
}
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "single",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "single",
})
-- suppress error messages from lang servers
vim.notify = function(msg, log_level)
if msg:match "exit code" then
return
end
if log_level == vim.log.levels.ERROR then
vim.api.nvim_err_writeln(msg)
else
vim.api.nvim_echo({ { msg } }, true, {})
end
end
end
M.gitsigns = function(override_flag)
local present, gitsigns = pcall(require, "gitsigns")
if present then
local default = {
signs = {
add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" },
delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" },
changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
},
}
if override_flag then
default = require("core.utils").tbl_override_req("gitsigns", default)
end
gitsigns.setup(default)
end
end
return M
+438
View File
@@ -0,0 +1,438 @@
local present, feline = pcall(require, "feline")
if not present then
return
end
local default = {
colors = require("colors").get(),
lsp = require "feline.providers.lsp",
lsp_severity = vim.diagnostic.severity,
config = require("core.utils").load_config().plugins.options.statusline,
}
default.icon_styles = {
default = {
left = "",
right = "",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
arrow = {
left = "",
right = "",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
block = {
left = " ",
right = " ",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
round = {
left = "",
right = "",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
slant = {
left = "",
right = "",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
}
-- statusline style
default.statusline_style = default.icon_styles[default.config.style]
-- show short statusline on small screens
default.shortline = default.config.shortline == false and true
-- Initialize the components table
default.components = {
active = {},
}
default.main_icon = {
provider = default.statusline_style.main_icon,
hl = {
fg = default.colors.statusline_bg,
bg = default.colors.nord_blue,
},
right_sep = {
str = default.statusline_style.right,
hl = {
fg = default.colors.nord_blue,
bg = default.colors.lightbg,
},
},
}
default.file_name = {
provider = function()
local filename = vim.fn.expand "%:t"
local extension = vim.fn.expand "%:e"
local icon = require("nvim-web-devicons").get_icon(filename, extension)
if icon == nil then
icon = ""
return icon
end
return " " .. icon .. " " .. filename .. " "
end,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
end,
hl = {
fg = default.colors.white,
bg = default.colors.lightbg,
},
right_sep = {
str = default.statusline_style.right,
hl = { fg = default.colors.lightbg, bg = default.colors.lightbg2 },
},
}
default.dir_name = {
provider = function()
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
return "" .. dir_name .. " "
end,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
end,
hl = {
fg = default.colors.grey_fg2,
bg = default.colors.lightbg2,
},
right_sep = {
str = default.statusline_style.right,
hi = {
fg = default.colors.lightbg2,
bg = default.colors.statusline_bg,
},
},
}
default.diff = {
add = {
provider = "git_diff_added",
hl = {
fg = default.colors.grey_fg2,
bg = default.colors.statusline_bg,
},
icon = "",
},
change = {
provider = "git_diff_changed",
hl = {
fg = default.colors.grey_fg2,
bg = default.colors.statusline_bg,
},
icon = "",
},
remove = {
provider = "git_diff_removed",
hl = {
fg = default.colors.grey_fg2,
bg = default.colors.statusline_bg,
},
icon = "",
},
}
default.git_branch = {
provider = "git_branch",
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
end,
hl = {
fg = default.colors.grey_fg2,
bg = default.colors.statusline_bg,
},
icon = "",
}
default.diagnostic = {
error = {
provider = "diagnostic_errors",
enabled = function()
return default.lsp.diagnostics_exist(default.lsp_severity.ERROR)
end,
hl = { fg = default.colors.red },
icon = "",
},
warning = {
provider = "diagnostic_warnings",
enabled = function()
return default.lsp.diagnostics_exist(default.lsp_severity.WARN)
end,
hl = { fg = default.colors.yellow },
icon = "",
},
hint = {
provider = "diagnostic_hints",
enabled = function()
return default.lsp.diagnostics_exist(default.lsp_severity.HINT)
end,
hl = { fg = default.colors.grey_fg2 },
icon = "",
},
info = {
provider = "diagnostic_info",
enabled = function()
return default.lsp.diagnostics_exist(default.lsp_severity.INFO)
end,
hl = { fg = default.colors.green },
icon = "",
},
}
default.lsp_progress = {
provider = function()
local Lsp = vim.lsp.util.get_progress_messages()[1]
if Lsp then
local msg = Lsp.message or ""
local percentage = Lsp.percentage or 0
local title = Lsp.title or ""
local spinners = {
"",
"",
"",
}
local success_icon = {
"",
"",
"",
}
local ms = vim.loop.hrtime() / 1000000
local frame = math.floor(ms / 120) % #spinners
if percentage >= 70 then
return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
end
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
end
return ""
end,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
end,
hl = { fg = default.colors.green },
}
default.lsp_icon = {
provider = function()
if next(vim.lsp.buf_get_clients()) ~= nil then
return " LSP"
else
return ""
end
end,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
end,
hl = { fg = default.colors.grey_fg2, bg = default.colors.statusline_bg },
}
default.mode_colors = {
["n"] = { "NORMAL", default.colors.red },
["no"] = { "N-PENDING", default.colors.red },
["i"] = { "INSERT", default.colors.dark_purple },
["ic"] = { "INSERT", default.colors.dark_purple },
["t"] = { "TERMINAL", default.colors.green },
["v"] = { "VISUAL", default.colors.cyan },
["V"] = { "V-LINE", default.colors.cyan },
[""] = { "V-BLOCK", default.colors.cyan },
["R"] = { "REPLACE", default.colors.orange },
["Rv"] = { "V-REPLACE", default.colors.orange },
["s"] = { "SELECT", default.colors.nord_blue },
["S"] = { "S-LINE", default.colors.nord_blue },
[""] = { "S-BLOCK", default.colors.nord_blue },
["c"] = { "COMMAND", default.colors.pink },
["cv"] = { "COMMAND", default.colors.pink },
["ce"] = { "COMMAND", default.colors.pink },
["r"] = { "PROMPT", default.colors.teal },
["rm"] = { "MORE", default.colors.teal },
["r?"] = { "CONFIRM", default.colors.teal },
["!"] = { "SHELL", default.colors.green },
}
default.chad_mode_hl = function()
return {
fg = default.mode_colors[vim.fn.mode()][2],
bg = default.colors.one_bg,
}
end
default.empty_space = {
provider = " " .. default.statusline_style.left,
hl = {
fg = default.colors.one_bg2,
bg = default.colors.statusline_bg,
},
}
-- this matches the vi mode color
default.empty_spaceColored = {
provider = default.statusline_style.left,
hl = function()
return {
fg = default.mode_colors[vim.fn.mode()][2],
bg = default.colors.one_bg2,
}
end,
}
default.mode_icon = {
provider = default.statusline_style.vi_mode_icon,
hl = function()
return {
fg = default.colors.statusline_bg,
bg = default.mode_colors[vim.fn.mode()][2],
}
end,
}
default.empty_space2 = {
provider = function()
return " " .. default.mode_colors[vim.fn.mode()][1] .. " "
end,
hl = default.chad_mode_hl,
}
default.separator_right = {
provider = default.statusline_style.left,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
end,
hl = {
fg = default.colors.grey,
bg = default.colors.one_bg,
},
}
default.separator_right2 = {
provider = default.statusline_style.left,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
end,
hl = {
fg = default.colors.green,
bg = default.colors.grey,
},
}
default.position_icon = {
provider = default.statusline_style.position_icon,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
end,
hl = {
fg = default.colors.black,
bg = default.colors.green,
},
}
default.current_line = {
provider = function()
local current_line = vim.fn.line "."
local total_line = vim.fn.line "$"
if current_line == 1 then
return " Top "
elseif current_line == vim.fn.line "$" then
return " Bot "
end
local result, _ = math.modf((current_line / total_line) * 100)
return " " .. result .. "%% "
end,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
end,
hl = {
fg = default.colors.green,
bg = default.colors.one_bg,
},
}
local function add_table(a, b)
table.insert(a, b)
end
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("feline", default)
end
-- components are divided in 3 sections
default.left = {}
default.middle = {}
default.right = {}
-- left
add_table(default.left, default.main_icon)
add_table(default.left, default.file_name)
add_table(default.left, default.dir_name)
add_table(default.left, default.diff.add)
add_table(default.left, default.diff.change)
add_table(default.left, default.diff.remove)
add_table(default.left, default.diagnostic.error)
add_table(default.left, default.diagnostic.warning)
add_table(default.left, default.diagnostic.hint)
add_table(default.left, default.diagnostic.info)
add_table(default.middle, default.lsp_progress)
-- right
add_table(default.right, default.lsp_icon)
add_table(default.right, default.git_branch)
add_table(default.right, default.empty_space)
add_table(default.right, default.empty_spaceColored)
add_table(default.right, default.mode_icon)
add_table(default.right, default.empty_space2)
add_table(default.right, default.separator_right)
add_table(default.right, default.separator_right2)
add_table(default.right, default.position_icon)
add_table(default.right, default.current_line)
default.components.active[1] = default.left
default.components.active[2] = default.middle
default.components.active[3] = default.right
feline.setup {
theme = {
bg = default.colors.statusline_bg,
fg = default.colors.fg,
},
components = default.components,
}
end
return M
@@ -1,9 +1,10 @@
local present, telescope = pcall(require, "telescope")
if not present then
return
end
telescope.setup {
local default = {
defaults = {
vimgrep_arguments = {
"rg",
@@ -19,7 +20,7 @@ telescope.setup {
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "descending",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
@@ -35,9 +36,9 @@ telescope.setup {
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = {},
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "absolute" },
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
@@ -50,36 +51,23 @@ telescope.setup {
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = false, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
},
media_files = {
filetypes = { "png", "webp", "jpg", "jpeg" },
find_cmd = "rg", -- find command (defaults to `fd`)
},
},
}
-- NvChad pickers
-- load the theme_switcher extension
require("telescope").load_extension "themes"
-- load the term_picker extension
require("telescope").load_extension "terms"
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("telescope", default)
end
if not pcall(function()
telescope.load_extension "fzf"
telescope.load_extension "media_files"
end) then
-- This should only trigger when in need of PackerSync, so better do it
print "After completion of PackerCompile, restart neovim."
-- Trigger packer compile on PackerComplete, so it properly waits for PackerSync
vim.cmd 'autocmd User PackerComplete ++once lua print "Waiting for PackerCompile.." require("packer").compile()'
vim.cmd 'autocmd User PackerCompileDone ++once echo "Packer Compile done, restart neovim."'
require "pluginList"
require("packer").update("telescope-fzf-native.nvim", "telescope-media-files.nvim")
telescope.setup(default)
local extensions = { "themes", "terms" }
pcall(function()
for _, ext in ipairs(extensions) do
telescope.load_extension(ext)
end
end)
end
return M
+26
View File
@@ -0,0 +1,26 @@
local present, ts_config = pcall(require, "nvim-treesitter.configs")
if not present then
return
end
local default = {
ensure_installed = {
"lua",
"vim",
},
highlight = {
enable = true,
use_languagetree = true,
},
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("nvim_treesitter", default)
end
ts_config.setup(default)
end
return M
-40
View File
@@ -1,40 +0,0 @@
local g = vim.g
local fn = vim.fn
local plugins_count = fn.len(fn.globpath("~/.local/share/nvim/site/pack/packer/start", "*", 0, 1))
g.dashboard_disable_at_vimenter = 1 -- dashboard is disabled by default
g.dashboard_disable_statusline = 1
g.dashboard_default_executive = "telescope"
g.dashboard_custom_header = {
" ",
" ",
" ",
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
" ",
}
g.dashboard_custom_section = {
a = { description = { " Find File SPC f f" }, command = "Telescope find_files" },
b = { description = { " Recents SPC f o" }, command = "Telescope oldfiles" },
c = { description = { " Find Word SPC f w" }, command = "Telescope live_grep" },
d = { description = { "洛 New File SPC f n" }, command = "DashboardNewFile" },
e = { description = { " Bookmarks SPC b m" }, command = "Telescope marks" },
f = { description = { " Load Last Session SPC s l" }, command = "SessionLoad" },
}
g.dashboard_custom_footer = {
" ",
-- "NvChad Loaded " .. plugins_count .. " plugins",
"NvChad v0.5",
}
-32
View File
@@ -1,32 +0,0 @@
local present, gitsigns = pcall(require, "gitsigns")
if not present then
return
end
gitsigns.setup {
signs = {
add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" },
delete = { hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr" },
topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" },
changedelete = { hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr" },
},
numhl = false,
keymaps = {
-- Default keymap options
noremap = true,
buffer = true,
["n ]c"] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'" },
["n [c"] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'" },
["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
["n <leader>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>',
},
watch_index = {
interval = 100,
},
sign_priority = 5,
status_formatter = nil, -- Use default
}
-122
View File
@@ -1,122 +0,0 @@
local present, icons = pcall(require, "nvim-web-devicons")
if not present then
return
end
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
icons.setup {
override = {
html = {
icon = "",
color = colors.baby_pink,
name = "html",
},
css = {
icon = "",
color = colors.blue,
name = "css",
},
js = {
icon = "",
color = colors.sun,
name = "js",
},
ts = {
icon = "ﯤ",
color = colors.teal,
name = "ts",
},
kt = {
icon = "󱈙",
color = colors.orange,
name = "kt",
},
png = {
icon = "",
color = colors.dark_purple,
name = "png",
},
jpg = {
icon = "",
color = colors.dark_purple,
name = "jpg",
},
jpeg = {
icon = "",
color = colors.dark_purple,
name = "jpeg",
},
mp3 = {
icon = "",
color = colors.white,
name = "mp3",
},
mp4 = {
icon = "",
color = colors.white,
name = "mp4",
},
out = {
icon = "",
color = colors.white,
name = "out",
},
Dockerfile = {
icon = "",
color = colors.cyan,
name = "Dockerfile",
},
rb = {
icon = "",
color = colors.pink,
name = "rb",
},
vue = {
icon = "﵂",
color = colors.vibrant_green,
name = "vue",
},
py = {
icon = "",
color = colors.cyan,
name = "py",
},
toml = {
icon = "",
color = colors.blue,
name = "toml",
},
lock = {
icon = "",
color = colors.red,
name = "lock",
},
zip = {
icon = "",
color = colors.sun,
name = "zip",
},
xz = {
icon = "",
color = colors.sun,
name = "xz",
},
deb = {
icon = "",
color = colors.cyan,
name = "deb",
},
rpm = {
icon = "",
color = colors.orange,
name = "rpm",
},
lua = {
icon = "",
color = colors.blue,
name = "lua",
},
},
}
+244
View File
@@ -0,0 +1,244 @@
local plugin_settings = require("core.utils").load_config().plugins
local present, packer = pcall(require, plugin_settings.options.packer.init_file)
if not present then
return false
end
local override_req = require("core.utils").override_req
local plugins = {
{ "nvim-lua/plenary.nvim" },
{ "lewis6991/impatient.nvim" },
{ "nathom/filetype.nvim" },
{
"wbthomason/packer.nvim",
event = "VimEnter",
},
{
"NvChad/extensions",
config = function ()
vim.schedule_wrap(require("nvchad.terminal").init())
end
},
{
"NvChad/nvim-base16.lua",
after = "packer.nvim",
config = function()
require("colors").init()
end,
},
{
"kyazdani42/nvim-web-devicons",
after = "nvim-base16.lua",
config = override_req("nvim_web_devicons", "plugins.configs.icons", "setup"),
},
{
"feline-nvim/feline.nvim",
disable = not plugin_settings.status.feline,
after = "nvim-web-devicons",
config = override_req("feline", "plugins.configs.statusline", "setup"),
},
{
"akinsho/bufferline.nvim",
branch = "main",
disable = not plugin_settings.status.bufferline,
after = "nvim-web-devicons",
config = override_req("bufferline", "plugins.configs.bufferline", "setup"),
setup = function()
require("core.mappings").bufferline()
end,
},
{
"lukas-reineke/indent-blankline.nvim",
disable = not plugin_settings.status.blankline,
event = "BufRead",
config = override_req("indent_blankline", "plugins.configs.others", "blankline"),
},
{
"NvChad/nvim-colorizer.lua",
disable = not plugin_settings.status.colorizer,
event = "BufRead",
config = override_req("nvim_colorizer", "plugins.configs.others", "colorizer"),
},
{
"nvim-treesitter/nvim-treesitter",
event = { "BufRead", "BufNewFile" },
config = override_req("nvim_treesitter", "plugins.configs.treesitter", "setup"),
run = ":TSUpdate",
},
-- git stuff
{
"lewis6991/gitsigns.nvim",
disable = not plugin_settings.status.gitsigns,
opt = true,
config = override_req("gitsigns", "plugins.configs.others", "gitsigns"),
setup = function()
require("core.utils").packer_lazy_load "gitsigns.nvim"
end,
},
-- lsp stuff
{
"neovim/nvim-lspconfig",
module = "lspconfig",
opt = true,
setup = function()
require("core.utils").packer_lazy_load "nvim-lspconfig"
-- reload the current file so lsp actually starts for it
vim.defer_fn(function()
vim.cmd 'if &ft == "packer" | echo "" | else | silent! e %'
end, 0)
end,
config = override_req("lspconfig", "plugins.configs.lspconfig"),
},
{
"ray-x/lsp_signature.nvim",
disable = not plugin_settings.status.lspsignature,
after = "nvim-lspconfig",
config = override_req("signature", "plugins.configs.others", "signature"),
},
{
"andymass/vim-matchup",
disable = not plugin_settings.status.vim_matchup,
opt = true,
setup = function()
require("core.utils").packer_lazy_load "vim-matchup"
end,
},
{
"max397574/better-escape.nvim",
disable = not plugin_settings.status.better_escape,
event = "InsertCharPre",
config = override_req("better_escape", "plugins.configs.others", "better_escape"),
},
-- load luasnips + cmp related in insert mode only
{
"rafamadriz/friendly-snippets",
module = "cmp_nvim_lsp",
disable = not plugin_settings.status.cmp,
event = "InsertEnter",
},
{
"hrsh7th/nvim-cmp",
disable = not plugin_settings.status.cmp,
after = "friendly-snippets",
config = override_req("nvim_cmp", "plugins.configs.cmp", "setup"),
},
{
"L3MON4D3/LuaSnip",
disable = not plugin_settings.status.cmp,
wants = "friendly-snippets",
after = "nvim-cmp",
config = override_req("luasnip", "plugins.configs.others", "luasnip"),
},
{
"saadparwaiz1/cmp_luasnip",
disable = not plugin_settings.status.cmp,
after = plugin_settings.options.cmp.lazy_load and "LuaSnip",
},
{
"hrsh7th/cmp-nvim-lua",
disable = not plugin_settings.status.cmp,
after = "cmp_luasnip",
},
{
"hrsh7th/cmp-nvim-lsp",
disable = not plugin_settings.status.cmp,
after = "cmp-nvim-lua",
},
{
"hrsh7th/cmp-buffer",
disable = not plugin_settings.status.cmp,
after = "cmp-nvim-lsp",
},
{
"hrsh7th/cmp-path",
disable = not plugin_settings.status.cmp,
after = "cmp-buffer",
},
-- misc plugins
{
"windwp/nvim-autopairs",
disable = not plugin_settings.status.autopairs,
after = plugin_settings.options.autopairs.loadAfter,
config = override_req("nvim_autopairs", "plugins.configs.others", "autopairs"),
},
{
disable = not plugin_settings.status.alpha,
"goolord/alpha-nvim",
config = override_req("alpha", "plugins.configs.alpha", "setup"),
},
{
"numToStr/Comment.nvim",
disable = not plugin_settings.status.comment,
module = "Comment",
keys = { "gcc" },
config = override_req("nvim_comment", "plugins.configs.others", "comment"),
setup = function()
require("core.mappings").comment()
end,
},
-- file managing , picker etc
{
"kyazdani42/nvim-tree.lua",
disable = not plugin_settings.status.nvimtree,
-- only set "after" if lazy load is disabled and vice versa for "cmd"
after = not plugin_settings.options.nvimtree.lazy_load and "nvim-web-devicons",
cmd = plugin_settings.options.nvimtree.lazy_load and { "NvimTreeToggle", "NvimTreeFocus" },
config = override_req("nvim_tree", "plugins.configs.nvimtree", "setup"),
setup = function()
require("core.mappings").nvimtree()
end,
},
{
"nvim-telescope/telescope.nvim",
module = "telescope",
cmd = "Telescope",
config = override_req("telescope", "plugins.configs.telescope", "setup"),
setup = function()
require("core.mappings").telescope()
end,
},
}
--label plugins for operational assistance
plugins = require("core.utils").label_plugins(plugins)
--remove plugins specified in chadrc
plugins = require("core.utils").remove_default_plugins(plugins)
--add plugins specified in chadrc
plugins = require("core.utils").add_user_plugins(plugins)
return packer.startup(function(use)
for _, v in pairs(plugins) do
use(v)
end
end)
-123
View File
@@ -1,123 +0,0 @@
local present1, lspconfig = pcall(require, "lspconfig")
local present2, lspinstall = pcall(require, "lspinstall")
if not (present1 or present2) then
return
end
local function on_attach(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
local opts = { noremap = true, silent = true }
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
end
-- Mappings.
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
-- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- lspInstall + lspconfig stuff
local function setup_servers()
lspinstall.setup()
local servers = lspinstall.installed_servers()
for _, lang in pairs(servers) do
if lang ~= "lua" then
lspconfig[lang].setup {
on_attach = on_attach,
capabilities = capabilities,
root_dir = vim.loop.cwd,
}
elseif lang == "lua" then
lspconfig[lang].setup {
root_dir = vim.loop.cwd,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
telemetry = {
enable = false,
},
},
},
}
end
end
end
setup_servers()
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
lspinstall.post_install_hook = function()
setup_servers() -- reload installed servers
vim.cmd "bufdo e"
end
-- replace the default lsp diagnostic symbols
function lspSymbol(name, icon)
vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefaul" .. name })
end
lspSymbol("Error", "")
lspSymbol("Warning", "")
lspSymbol("Information", "")
lspSymbol("Hint", "")
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = {
prefix = "",
spacing = 0,
},
signs = true,
underline = true,
-- set this to true if you want diagnostics to show in insert mode
update_in_insert = false,
})
-- suppress error messages from lang servers
vim.notify = function(msg, log_level, _opts)
if msg:match "exit code" then
return
end
if log_level == vim.log.levels.ERROR then
vim.api.nvim_err_writeln(msg)
else
vim.api.nvim_echo({ { msg } }, true, {})
end
end
-66
View File
@@ -1,66 +0,0 @@
local present, luasnip = pcall(require, "luasnip")
if not present then
return
end
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
local check_back_space = function()
local col = vim.fn.col "." - 1
if col == 0 or vim.fn.getline("."):sub(col, col):match "%s" then
return true
else
return false
end
end
_G.tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-n>"
elseif luasnip and luasnip.expand_or_jumpable() then
return t "<Plug>luasnip-expand-or-jump"
elseif check_back_space() then
return t "<Tab>"
else
return vim.fn["compe#complete"]()
end
end
_G.s_tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-p>"
elseif luasnip and luasnip.jumpable(-1) then
return t "<Plug>luasnip-jump-prev"
else
return t "<S-Tab>"
end
end
_G.completions = function()
local npairs
if not pcall(function()
npairs = require "nvim-autopairs"
end) then
return
end
if vim.fn.pumvisible() == 1 then
if vim.fn.complete_info()["selected"] ~= -1 then
return vim.fn["compe#confirm"] "<CR>"
end
end
return npairs.check_break_line_char()
end
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", { expr = true })
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", { expr = true })
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true })
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true })
vim.api.nvim_set_keymap("i", "<CR>", "v:lua.completions()", { expr = true })
luasnip.config.set_config {
history = true,
updateevents = "TextChanged,TextChangedI",
}
require("luasnip/loaders/from_vscode").load()
-95
View File
@@ -1,95 +0,0 @@
local present, tree_c = pcall(require, "nvim-tree.config")
if not present then
return
end
local tree_cb = tree_c.nvim_tree_callback
local g = vim.g
vim.o.termguicolors = true
g.nvim_tree_side = "left"
g.nvim_tree_width = 25
g.nvim_tree_ignore = { ".git", "node_modules", ".cache" }
g.nvim_tree_gitignore = 1
g.nvim_tree_auto_ignore_ft = { "dashboard" } -- don't open tree on specific fiypes.
g.nvim_tree_auto_open = 0
g.nvim_tree_auto_close = 0 -- closes tree when it's the last window
g.nvim_tree_quit_on_open = 0 -- closes tree when file's opened
g.nvim_tree_follow = 1
g.nvim_tree_indent_markers = 1
g.nvim_tree_hide_dotfiles = 1
g.nvim_tree_git_hl = 1
g.nvim_tree_highlight_opened_files = 0
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
g.nvim_tree_tab_open = 0
g.nvim_tree_allow_resize = 1
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
g.nvim_tree_disable_netrw = 1
g.nvim_tree_hijack_netrw = 0
g.nvim_tree_update_cwd = 1
g.nvim_tree_show_icons = {
git = 1,
folders = 1,
files = 1,
-- folder_arrows= 1
}
g.nvim_tree_icons = {
default = "",
symlink = "",
git = {
unstaged = "✗",
staged = "✓",
unmerged = "",
renamed = "➜",
untracked = "★",
deleted = "",
ignored = "◌",
},
folder = {
-- disable indent_markers option to get arrows working or if you want both arrows and indent then just add the arrow icons in front ofthe default and opened folders below!
-- arrow_open = "",
-- arrow_closed = "",
default = "",
open = "",
empty = "", -- 
empty_open = "",
symlink = "",
symlink_open = "",
},
}
g.nvim_tree_bindings = {
{ key = { "<CR>", "o", "<2-LeftMouse>" }, cb = tree_cb "edit" },
{ key = { "<2-RightMouse>", "<C-]>" }, cb = tree_cb "cd" },
{ key = "<C-v>", cb = tree_cb "vsplit" },
{ key = "<C-x>", cb = tree_cb "split" },
{ key = "<C-t>", cb = tree_cb "tabnew" },
{ key = "<", cb = tree_cb "prev_sibling" },
{ key = ">", cb = tree_cb "next_sibling" },
{ key = "P", cb = tree_cb "parent_node" },
{ key = "<BS>", cb = tree_cb "close_node" },
{ key = "<S-CR>", cb = tree_cb "close_node" },
{ key = "<Tab>", cb = tree_cb "preview" },
{ key = "K", cb = tree_cb "first_sibling" },
{ key = "J", cb = tree_cb "last_sibling" },
{ key = "I", cb = tree_cb "toggle_ignored" },
{ key = "H", cb = tree_cb "toggle_dotfiles" },
{ key = "R", cb = tree_cb "refresh" },
{ key = "a", cb = tree_cb "create" },
{ key = "d", cb = tree_cb "remove" },
{ key = "r", cb = tree_cb "rename" },
{ key = "<C->", cb = tree_cb "full_rename" },
{ key = "x", cb = tree_cb "cut" },
{ key = "c", cb = tree_cb "copy" },
{ key = "p", cb = tree_cb "paste" },
{ key = "y", cb = tree_cb "copy_name" },
{ key = "Y", cb = tree_cb "copy_path" },
{ key = "gy", cb = tree_cb "copy_absolute_path" },
{ key = "[c", cb = tree_cb "prev_git_item" },
{ key = "}c", cb = tree_cb "next_git_item" },
{ key = "-", cb = tree_cb "dir_up" },
{ key = "q", cb = tree_cb "close" },
{ key = "g?", cb = tree_cb "toggle_help" },
}
-71
View File
@@ -1,71 +0,0 @@
local M = {}
M.colorizer = function()
local present, colorizer = pcall(require, "colorizer")
if present then
colorizer.setup()
vim.cmd "ColorizerReloadAllBuffers"
end
end
M.comment = function()
local present, nvim_comment = pcall(require, "nvim_comment")
if present then
nvim_comment.setup()
end
end
M.escape = function()
vim.g.better_escape_interval = 300
vim.g.better_escape_shortcut = { "jk" }
end
M.lspkind = function()
local present, lspkind = pcall(require, "lspkind")
if present then
lspkind.init()
end
end
M.neoscroll = function()
pcall(function()
require("neoscroll").setup()
end)
end
M.blankline = function()
vim.g.indentLine_enabled = 1
vim.g.indent_blankline_char = "▏"
vim.g.indent_blankline_filetype_exclude = { "help", "terminal", "dashboard", "packer" }
vim.g.indent_blankline_buftype_exclude = { "terminal" }
vim.g.indent_blankline_show_trailing_blankline_indent = false
vim.g.indent_blankline_show_first_indent_level = false
end
M.signature = function()
local present, lspsignature = pcall(require, "lsp_signature")
if present then
lspsignature.setup {
bind = true,
doc_lines = 2,
floating_window = true,
fix_pos = true,
hint_enable = true,
hint_prefix = "",
hint_scheme = "String",
use_lspsaga = false,
hi_parameter = "Search",
max_height = 22,
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
handler_opts = {
border = "single", -- double, single, shadow, none
},
zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
}
end
end
return M
@@ -1,6 +1,4 @@
local cmd = vim.cmd
cmd "packadd packer.nvim"
vim.cmd "packadd packer.nvim"
local present, packer = pcall(require, "packer")
@@ -19,17 +17,17 @@ if not present then
packer_path,
}
cmd "packadd packer.nvim"
vim.cmd "packadd packer.nvim"
present, packer = pcall(require, "packer")
if present then
print "Packer cloned successfully."
else
error("Couldn't clone packer !\nPacker path: " .. packer_path)
error("Couldn't clone packer !\nPacker path: " .. packer_path .. "\n" .. packer)
end
end
return packer.init {
packer.init {
display = {
open_fn = function()
return require("packer.util").float { border = "single" }
@@ -37,9 +35,10 @@ return packer.init {
prompt_border = "single",
},
git = {
clone_timeout = 600, -- Timeout, in seconds, for git clones
clone_timeout = 6000, -- seconds
},
auto_clean = true,
compile_on_sync = true,
-- auto_reload_compiled = true
}
return packer
-309
View File
@@ -1,309 +0,0 @@
local global_theme = "themes/" .. require("utils").load_config().ui.theme
local colors = require(global_theme)
local present1, gl = pcall(require, "galaxyline")
local present2, condition = pcall(require, "galaxyline.condition")
if not (present1 or present2) then
return
end
local gls = gl.section
gl.short_line_list = { " " }
local icon_styles = {
default = {
left = "",
right = "",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
round = {
left = "",
right = "",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
slant = {
left = "",
right = "",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
block = {
left = " ",
right = " ",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
arrow = {
left = "",
right = "",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
}
local user_statusline_style = require("utils").load_config().ui.statusline_style
local statusline_style = icon_styles[user_statusline_style]
local left_separator = statusline_style.left
local right_separator = statusline_style.right
gls.left[1] = {
FirstElement = {
provider = function()
return "▋"
end,
highlight = { colors.nord_blue, colors.nord_blue },
},
}
gls.left[2] = {
statusIcon = {
provider = function()
return statusline_style.main_icon
end,
highlight = { colors.statusline_bg, colors.nord_blue },
separator = right_separator,
separator_highlight = { colors.nord_blue, colors.one_bg2 },
},
}
gls.left[3] = {
left_arow2 = {
provider = function() end,
separator = right_separator .. " ",
separator_highlight = { colors.one_bg2, colors.lightbg },
},
}
gls.left[4] = {
FileIcon = {
provider = "FileIcon",
condition = condition.buffer_not_empty,
highlight = { colors.white, colors.lightbg },
},
}
gls.left[5] = {
FileName = {
provider = function()
local fileinfo = require "galaxyline.provider_fileinfo"
if vim.api.nvim_buf_get_name(0):len() == 0 then
return ""
end
return fileinfo.get_current_file_name("", "")
end,
highlight = { colors.white, colors.lightbg },
separator = right_separator,
separator_highlight = { colors.lightbg, colors.lightbg2 },
},
}
gls.left[6] = {
current_dir = {
provider = function()
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
return "" .. dir_name .. " "
end,
highlight = { colors.grey_fg2, colors.lightbg2 },
separator = right_separator,
separator_highlight = { colors.lightbg2, colors.statusline_bg },
},
}
local checkwidth = function()
local squeeze_width = vim.fn.winwidth(0) / 2
if squeeze_width > 30 then
return true
end
return false
end
gls.left[7] = {
DiffAdd = {
provider = "DiffAdd",
condition = checkwidth,
icon = "",
highlight = { colors.white, colors.statusline_bg },
},
}
gls.left[8] = {
DiffModified = {
provider = "DiffModified",
condition = checkwidth,
icon = "",
highlight = { colors.grey_fg2, colors.statusline_bg },
},
}
gls.left[9] = {
DiffRemove = {
provider = "DiffRemove",
condition = checkwidth,
icon = "",
highlight = { colors.grey_fg2, colors.statusline_bg },
},
}
gls.left[10] = {
DiagnosticError = {
provider = "DiagnosticError",
icon = "",
highlight = { colors.red, colors.statusline_bg },
},
}
gls.left[11] = {
DiagnosticWarn = {
provider = "DiagnosticWarn",
icon = "",
highlight = { colors.yellow, colors.statusline_bg },
},
}
gls.right[1] = {
lsp_status = {
provider = function()
local clients = vim.lsp.get_active_clients()
if next(clients) ~= nil then
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return " " .. "" .. " LSP"
end
end
return ""
else
return ""
end
end,
highlight = { colors.grey_fg2, colors.statusline_bg },
},
}
gls.right[2] = {
GitIcon = {
provider = function()
return ""
end,
condition = require("galaxyline.condition").check_git_workspace,
highlight = { colors.grey_fg2, colors.statusline_bg },
separator = " ",
separator_highlight = { colors.statusline_bg, colors.statusline_bg },
},
}
gls.right[3] = {
GitBranch = {
provider = "GitBranch",
condition = require("galaxyline.condition").check_git_workspace,
highlight = { colors.grey_fg2, colors.statusline_bg },
},
}
local mode_colors = {
[110] = { "NORMAL", colors.red },
[105] = { "INSERT", colors.dark_purple },
[99] = { "COMMAND", colors.pink },
[116] = { "TERMINAL", colors.green },
[118] = { "VISUAL", colors.cyan },
[22] = { "V-BLOCK", colors.cyan },
[86] = { "V_LINE", colors.cyan },
[82] = { "REPLACE", colors.orange },
[115] = { "SELECT", colors.nord_blue },
[83] = { "S-LINE", colors.nord_blue },
}
local mode = function(n)
return mode_colors[vim.fn.mode():byte()][n]
end
gls.right[4] = {
left_arrow = {
provider = function() end,
separator = " " .. left_separator,
separator_highlight = { colors.one_bg2, colors.statusline_bg },
},
}
gls.right[5] = {
left_round = {
provider = function()
vim.cmd("hi Galaxyleft_round guifg=" .. mode(2))
return left_separator
end,
highlight = { "GalaxyViMode", colors.one_bg2 },
},
}
gls.right[6] = {
viMode_icon = {
provider = function()
vim.cmd("hi GalaxyviMode_icon guibg=" .. mode(2))
return statusline_style.vi_mode_icon
end,
highlight = { colors.statusline_bg, colors.red },
},
}
gls.right[7] = {
ViMode = {
provider = function()
vim.cmd("hi GalaxyViMode guifg=" .. mode(2))
return " " .. mode(1) .. " "
end,
highlight = { "GalaxyViMode", colors.lightbg },
},
}
gls.right[8] = {
left_arrow2 = {
provider = function() end,
separator = left_separator,
separator_highlight = { colors.grey, colors.lightbg },
},
}
gls.right[9] = {
some_RoundIcon = {
provider = function()
return statusline_style.position_icon
end,
separator = left_separator,
separator_highlight = { colors.green, colors.grey },
highlight = { colors.lightbg, colors.green },
},
}
gls.right[10] = {
line_percentage = {
provider = function()
local current_line = vim.fn.line "."
local total_line = vim.fn.line "$"
if current_line == 1 then
return " Top "
elseif current_line == vim.fn.line "$" then
return " Bot "
end
local result, _ = math.modf((current_line / total_line) * 100)
return " " .. result .. "% "
end,
highlight = { colors.green, colors.lightbg },
},
}
-15
View File
@@ -1,15 +0,0 @@
local present, ts_config = pcall(require, "nvim-treesitter.configs")
if not present then
return
end
ts_config.setup {
ensure_installed = {
"bash",
"lua",
},
highlight = {
enable = true,
use_languagetree = true,
},
}
-68
View File
@@ -1,68 +0,0 @@
local present, true_zen = pcall(require, "true-zen")
if not present then
return
end
true_zen.setup {
ui = {
bottom = {
laststatus = 0,
ruler = false,
showmode = false,
showcmd = false,
cmdheight = 1,
},
top = {
showtabline = 0,
},
left = {
number = false,
relativenumber = false,
signcolumn = "no",
},
},
modes = {
ataraxis = {
left_padding = 32,
right_padding = 32,
top_padding = 1,
bottom_padding = 1,
ideal_writing_area_width = { 0 },
auto_padding = true,
keep_default_fold_fillchars = true,
custome_bg = "",
bg_configuration = true,
affected_higroups = {
NonText = {},
FoldColumn = {},
ColorColumn = {},
VertSplit = {},
StatusLine = {},
StatusLineNC = {},
SignColumn = {},
},
},
focus = {
margin_of_error = 5,
focus_method = "experimental",
},
},
integrations = {
vim_gitgutter = false,
galaxyline = true,
tmux = false,
gitsigns = false,
nvim_bufferline = true,
limelight = false,
vim_airline = false,
vim_powerline = false,
vim_signify = false,
express_line = false,
lualine = false,
},
misc = {
on_off_commands = false,
ui_elements_commands = false,
cursor_by_mode = false,
},
}
-143
View File
@@ -1,143 +0,0 @@
-- This file can be loaded as a telescope extension
local M = {}
-- Custom theme picker
-- Most of the code is copied from telescope buffer builtin
-- Src: https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/builtin/internal.lua
M.term_picker = function(opts)
local pickers, finders, previewers, make_entry, actions, action_state, utils, conf
if pcall(require, "telescope") then
pickers = require "telescope.pickers"
finders = require "telescope.finders"
previewers = require "telescope.previewers"
make_entry = require "telescope.make_entry"
actions = require "telescope.actions"
action_state = require "telescope.actions.state"
utils = require "telescope.utils"
conf = require("telescope.config").values
else
error "Cannot find telescope!"
end
local filter = vim.tbl_filter
local local_utils = require "utils"
-- buffer number and name
local bufnr = vim.api.nvim_get_current_buf()
local bufname = vim.api.nvim_buf_get_name(bufnr)
local bufnrs = filter(function(b)
local present_type, type = pcall(function()
return vim.api.nvim_buf_get_var(b, "term_type")
end)
if not present_type then
-- let's only terms that we created
return false
end
-- if 1 ~= vim.fn.buflisted(b) then
-- return false
-- end
-- only hide unloaded buffers if opts.show_all_buffers is false, keep them listed if true or nil
if opts.show_all_buffers == false and not vim.api.nvim_buf_is_loaded(b) then
return false
end
if opts.ignore_current_buffer and b == vim.api.nvim_get_current_buf() then
return false
end
return true
end, vim.api.nvim_list_bufs())
if not next(bufnrs) then
return
end
if opts.sort_mru then
table.sort(bufnrs, function(a, b)
return vim.fn.getbufinfo(a)[1].lastused > vim.fn.getbufinfo(b)[1].lastused
end)
end
local buffers = {}
local default_selection_idx = 1
for _, bufnr in ipairs(bufnrs) do
local flag = bufnr == vim.fn.bufnr "" and "%" or (bufnr == vim.fn.bufnr "#" and "#" or " ")
if opts.sort_lastused and not opts.ignore_current_buffer and flag == "#" then
default_selection_idx = 2
end
local element = {
bufnr = bufnr,
flag = flag,
info = vim.fn.getbufinfo(bufnr)[1],
}
if opts.sort_lastused and (flag == "#" or flag == "%") then
local idx = ((buffers[1] ~= nil and buffers[1].flag == "%") and 2 or 1)
table.insert(buffers, idx, element)
else
table.insert(buffers, element)
end
end
if not opts.bufnr_width then
local max_bufnr = math.max(unpack(bufnrs))
opts.bufnr_width = #tostring(max_bufnr)
end
pickers.new(opts, {
prompt_title = "Terminal buffers",
finder = finders.new_table {
results = buffers,
entry_maker = opts.entry_maker or make_entry.gen_from_buffer(opts),
},
previewer = conf.grep_previewer(opts),
sorter = conf.generic_sorter(opts),
default_selection_index = default_selection_idx,
attach_mappings = function(prompt_bufnr)
actions.select_default:replace(function()
local entry = action_state.get_selected_entry()
actions.close(prompt_bufnr)
local buf = entry.bufnr
local chad_term, type = pcall(function()
return vim.api.nvim_buf_get_var(buf, "term_type")
end)
-- TODO buffer checks/error detection (make sure we do get a buf)
if chad_term then
if type == "wind" then
-- swtich to term buff & show in bufferline
vim.cmd(string.format("b %d | setlocal bl", buf))
-- vim.cmd('startinsert') TODO fix this
elseif type == "vert" then
vim.cmd(string.format("vsp #%d", buf))
-- vim.cmd('startinsert') TODO fix this
elseif type == "hori" then
-- TODO change 15 to a chad config var number
vim.cmd(string.format("15 sp #%d ", buf))
-- vim.cmd('startinsert') TODO fix this
end
end
end)
return true
end,
}):find()
end
-- register term picker as terms to telescope
local present, telescope = pcall(require, "telescope")
if present then
return telescope.register_extension {
exports = {
terms = M.term_picker,
},
}
else
error "Cannot find telescope!"
end
-142
View File
@@ -1,142 +0,0 @@
-- This file can be loaded as a telescope extension
local M = {}
-- Custom theme picker
-- Most of the code is copied from telescope colorscheme plugin, mostly for preview creation
M.theme_switcher = function(opts)
local pickers, finders, previewers, actions, action_state, utils, conf
if pcall(require, "telescope") then
pickers = require "telescope.pickers"
finders = require "telescope.finders"
previewers = require "telescope.previewers"
actions = require "telescope.actions"
action_state = require "telescope.actions.state"
utils = require "telescope.utils"
conf = require("telescope.config").values
else
error "Cannot find telescope!"
end
local local_utils = require "utils"
local reload_theme = local_utils.reload_theme
-- get a table of available themes
local themes = local_utils.list_themes()
if next(themes) ~= nil then
-- save this to use it for later to restore if theme not changed
local current_theme = vim.g.nvchad_theme
local new_theme = ""
local change = false
-- buffer number and name
local bufnr = vim.api.nvim_get_current_buf()
local bufname = vim.api.nvim_buf_get_name(bufnr)
local previewer
-- in case its not a normal buffer
if vim.fn.buflisted(bufnr) ~= 1 then
local deleted = false
local function del_win(win_id)
if win_id and vim.api.nvim_win_is_valid(win_id) then
utils.buf_delete(vim.api.nvim_win_get_buf(win_id))
pcall(vim.api.nvim_win_close, win_id, true)
end
end
previewer = previewers.new {
preview_fn = function(_, entry, status)
if not deleted then
deleted = true
del_win(status.preview_win)
del_win(status.preview_border_win)
end
reload_theme(entry.value)
end,
}
else
-- show current buffer content in previewer
previewer = previewers.new_buffer_previewer {
get_buffer_by_name = function()
return bufname
end,
define_preview = function(self, entry)
if vim.loop.fs_stat(bufname) then
conf.buffer_previewer_maker(bufname, self.state.bufnr, { bufname = self.state.bufname })
else
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
end
reload_theme(entry.value)
end,
}
end
local picker = pickers.new {
prompt_title = "Set NvChad color",
finder = finders.new_table(themes),
previewer = previewer,
sorter = conf.generic_sorter(opts),
attach_mappings = function()
actions.select_default:replace(
-- if a entry is selected, change current_theme to that
function(prompt_bufnr)
local selection = action_state.get_selected_entry()
new_theme = selection.value
change = true
actions.close(prompt_bufnr)
end
)
return true
end,
}
-- rewrite picker.close_windows
local close_windows = picker.close_windows
picker.close_windows = function(status)
close_windows(status)
-- now apply the theme, if success, then ask for default theme change
local final_theme
if change then
final_theme = new_theme
else
final_theme = current_theme
end
if reload_theme(final_theme) then
if change then
-- ask for confirmation to set as default theme
local ans = string.lower(vim.fn.input("Set " .. new_theme .. " as default theme ? [y/N] ")) == "y"
local_utils.clear_cmdline()
if ans then
local_utils.change_theme(current_theme, final_theme)
else
-- will be used in restoring nvchad theme var
final_theme = current_theme
end
end
else
final_theme = current_theme
end
-- set nvchad_theme global var
vim.g.nvchad_theme = final_theme
end
-- launch the telescope picker
picker:find()
else
print("No themes found in " .. vim.fn.stdpath "config" .. "/lua/themes")
end
end
-- register theme swticher as themes to telescope
local present, telescope = pcall(require, "telescope")
if present then
return telescope.register_extension {
exports = {
themes = M.theme_switcher,
},
}
else
error "Cannot find telescope!"
end
-12
View File
@@ -1,12 +0,0 @@
local chad_theme = require("utils").load_config().ui.theme
vim.g.nvchad_theme = chad_theme
local present, base16 = pcall(require, "base16")
if present then
base16(base16.themes(chad_theme), true)
require "highlights"
return true
else
return false
end
-35
View File
@@ -1,35 +0,0 @@
local colors = {
white = "#F8F8F2",
darker_black = "#232531",
black = "#282A36", -- nvim bg
black2 = "#303341",
one_bg = "#373844", -- real bg of onedark
one_bg2 = "#44475a",
one_bg3 = "#565761",
grey = "#41434f",
grey_fg = "#5a5c68",
grey_fg2 = "#5a5c68",
light_grey = "#636571",
red = "#E95678",
baby_pink = "#DE8C92",
pink = "#FF79C6",
line = "#373844", -- for lines like vertsplit
green = "#69ff94",
vibrant_green = "#69FF94",
nord_blue = "#b389ef",
blue = "#BD93F9",
yellow = "#F1FA8C",
sun = "#FFFFA5",
purple = "#BD93F9",
dark_purple = "#BD93F9",
teal = "#0088cc",
orange = "#FFB86C",
cyan = "#8BE9FD",
statusline_bg = "#2b2d39",
lightbg = "#343642",
lightbg2 = "#2f313d",
pmenu_bg = "#b389ef",
folder_bg = "#BD93F9",
}
return colors
-35
View File
@@ -1,35 +0,0 @@
local colors = {
white = "#fff9e8",
darker_black = "#272f35",
black = "#2b3339", -- nvim bg
black2 = "#323a40",
one_bg = "#333b41",
one_bg2 = "#363e44",
one_bg3 = "#3a4248",
grey = "#4a5258",
grey_fg = "#50585e",
grey_fg2 = "#545c62",
light_grey = "#586066",
red = "#e67e80",
baby_pink = "#ce8196",
pink = "#ff75a0",
line = "#3a4248", -- for lines like vertsplit
green = "#83c092",
vibrant_green = "#a7c080",
nord_blue = "#78b4ac",
blue = "#7fbbb3",
yellow = "#dbbc7f",
sun = "#d1b171",
purple = "#b4bbc8",
dark_purple = "#d699b6",
teal = "#69a59d",
orange = "#e69875",
cyan = "#95d1c9",
statusline_bg = "#2e363c",
lightbg = "#3d454b",
lightbg2 = "#333b41",
pmenu_bg = "#83c092",
folder_bg = "#7fbbb3",
}
return colors
-35
View File
@@ -1,35 +0,0 @@
local colors = {
white = "#c7b89d",
darker_black = "#1e2122",
black = "#222526", -- nvim bg
black2 = "#26292a",
one_bg = "#2b2e2f",
one_bg2 = "#2f3233",
one_bg3 = "#313435",
grey = "#46494a",
grey_fg = "#5d6061",
grey_fg2 = "#5b5e5f",
light_grey = "#585b5c",
red = "#ec6b64",
baby_pink = "#ce8196",
pink = "#ff75a0",
line = "#2c2f30", -- for lines like vertsplit
green = "#89b482",
vibrant_green = "#a9b665",
nord_blue = "#6f8faf",
blue = "#6d8dad",
yellow = "#d6b676",
sun = "#d1b171",
purple = "#b4bbc8",
dark_purple = "#cc7f94",
teal = "#749689",
orange = "#e78a4e",
cyan = "#82b3a8",
statusline_bg = "#252829",
lightbg = "#2d3139",
lightbg2 = "#262a32",
pmenu_bg = "#89b482",
folder_bg = "#6d8dad",
}
return colors
-35
View File
@@ -1,35 +0,0 @@
local colors = {
white = "#b5bcc9",
darker_black = "#10171e",
black = "#131a21", -- nvim bg
black2 = "#1a2128",
one_bg = "#1e252c",
one_bg2 = "#272e35",
one_bg3 = "#2a3138",
grey = "#363d44",
grey_fg = "#4e555c",
grey_fg2 = "#51585f",
light_grey = "#545b62",
red = "#ef8891",
baby_pink = "#fca2aa",
pink = "#fca2af",
line = "#20272e", -- for lines like vertsplit
green = "#9ce5c0",
vibrant_green = "#a5d4af",
blue = "#99aee5",
nord_blue = "#9aa8cf",
yellow = "#fbdf90",
sun = "#fbdf9a",
purple = "#d7c1ed",
dark_purple = "#ccaced",
teal = "#92dbb6",
orange = "#EDA685",
cyan = "#b5c3ea",
statusline_bg = "#181f26",
lightbg = "#222930",
lightbg2 = "#1d242b",
pmenu_bg = "#ef8891",
folder_bg = "#99aee5",
}
return colors
-35
View File
@@ -1,35 +0,0 @@
local colors = {
white = "#b0b0b0",
darker_black = "#171d23",
black = "#1a2026", -- nvim bg
black2 = "#20262c",
one_bg = "#242a30",
one_bg2 = "#292f35",
one_bg3 = "#2e343a",
grey = "#42484e",
grey_fg = "#474d53",
grey_fg2 = "#50565c",
light_grey = "#565c62",
red = "#ac8a8c",
baby_pink = "#de878f",
pink = "#e89199",
line = "#2d3339", -- for lines like vertsplit
green = "#8aac8b",
vibrant_green = "#9ec49f",
blue = "#6b8bab",
nord_blue = "#7797b7",
yellow = "#c4c19e",
sun = "#aca98a",
purple = "#a39ec4",
dark_purple = "#8f8aac",
teal = "#7c9cbc",
orange = "#e39a83",
cyan = "#9aafe6",
statusline_bg = "#1e242a",
lightbg = "#2d3339",
lightbg2 = "#252b31",
pmenu_bg = "#8aac8b",
folder_bg = "#6b8bab",
}
return colors
-35
View File
@@ -1,35 +0,0 @@
local colors = {
white = "#abb2bf",
darker_black = "#2a303c",
black = "#2E3440", -- nvim bg
black2 = "#343a46",
one_bg = "#373d49",
one_bg2 = "#464c58",
one_bg3 = "#494f5b",
grey = "#4b515d",
grey_fg = "#565c68",
grey_fg2 = "#606672",
light_grey = "#646a76",
red = "#BF616A",
baby_pink = "#de878f",
pink = "#d57780",
line = "#3a404c", -- for lines like vertsplit
green = "#A3BE8C",
vibrant_green = "#afca98",
blue = "#7797b7",
nord_blue = "#81A1C1",
yellow = "#EBCB8B",
sun = "#e1c181",
purple = "#aab1be",
dark_purple = "#B48EAD",
teal = "#6484a4",
orange = "#e39a83",
cyan = "#9aafe6",
statusline_bg = "#333945",
lightbg = "#3f4551",
lightbg2 = "#393f4b",
pmenu_bg = "#A3BE8C",
folder_bg = "#7797b7",
}
return colors
-35
View File
@@ -1,35 +0,0 @@
local colors = {
white = "#54555b",
darker_black = "#f5f5f5",
black = "#fafafa", -- nvim bg
black2 = "#f1f1f1",
one_bg = "#f0f0f0", -- real bg of onedark
one_bg2 = "#ececec",
one_bg3 = "#e7e7e7",
grey = "#cbcbcb",
grey_fg = "#c6c6c6",
grey_fg2 = "#b7b7b7",
light_grey = "#b7b7b7",
red = "#e6676e",
baby_pink = "#F07178",
pink = "#ff75a0",
line = "#e9e9e9", -- for lines like vertsplit
green = "#7b90c7",
vibrant_green = "#7eca9c",
nord_blue = "#5e5f65",
blue = "#28a2f4",
yellow = "#7e7e7e",
sun = "#dea95f",
purple = "#a28dcd",
dark_purple = "#8e79b9",
teal = "#519ABA",
orange = "#FF6A00",
cyan = "#a3b8ef",
statusline_bg = "#f0f0f0",
lightbg = "#d6d6d6",
lightbg2 = "#5e5f65",
pmenu_bg = "#5e5f65",
folder_bg = "#6C6C6C",
}
return colors
-35
View File
@@ -1,35 +0,0 @@
local colors = {
white = "#abb2bf",
darker_black = "#1b1f27",
black = "#1e222a", -- nvim bg
black2 = "#252931",
one_bg = "#282c34", -- real bg of onedark
one_bg2 = "#353b45",
one_bg3 = "#30343c",
grey = "#42464e",
grey_fg = "#565c64",
grey_fg2 = "#6f737b",
light_grey = "#6f737b",
red = "#d47d85",
baby_pink = "#DE8C92",
pink = "#ff75a0",
line = "#2a2e36", -- for lines like vertsplit
green = "#A3BE8C",
vibrant_green = "#7eca9c",
nord_blue = "#81A1C1",
blue = "#61afef",
yellow = "#e7c787",
sun = "#EBCB8B",
purple = "#b4bbc8",
dark_purple = "#c882e7",
teal = "#519ABA",
orange = "#fca2aa",
cyan = "#a3b8ef",
statusline_bg = "#22262e",
lightbg = "#2d3139",
lightbg2 = "#262a32",
pmenu_bg = "#A3BE8C",
folder_bg = "#61afef",
}
return colors
-35
View File
@@ -1,35 +0,0 @@
local colors = {
white = "#c0caf5",
darker_black = "#151621",
black = "#171823", -- nvim bg
black2 = "#20212c",
one_bg = "#242530",
one_bg2 = "#292a35",
one_bg3 = "#353b45",
grey = "#40486a",
grey_fg = "#4a5274",
grey_fg2 = "#4f5779",
light_grey = "#545c7e",
red = "#f7768e",
baby_pink = "#DE8C92",
pink = "#ff75a0",
line = "#242530", -- for lines like vertsplit
green = "#9ece6a",
vibrant_green = "#73daca",
nord_blue = "#80a8fd",
blue = "#7aa2f7",
yellow = "#e7c787",
sun = "#EBCB8B",
purple = "#bb9af7",
dark_purple = "#9d7cd8",
teal = "#0db9d7",
orange = "#ff9e64",
cyan = "#7dcfff",
statusline_bg = "#1d1e29",
lightbg = "#252631",
lightbg2 = "#22232e",
pmenu_bg = "#7aa2f7",
folder_bg = "#7aa2f7",
}
return colors
-35
View File
@@ -1,35 +0,0 @@
local colors = {
white = "#C5C8C2",
darker_black = "#191b1d",
black = "#1d1f21", -- nvim bg
black2 = "#232527",
one_bg = "#363a41",
one_bg2 = "#353b45",
one_bg3 = "#30343c",
grey = "#434547",
grey_fg = "#545B68",
grey_fg2 = "#616875",
light_grey = "#676e7b",
red = "#cc6666",
baby_pink = "#FF6E79",
pink = "#ff9ca3",
line = "#27292b", -- for lines like vertsplit
green = "#a4b595",
vibrant_green = "#a3b991",
nord_blue = "#728da8",
blue = "#6f8dab",
yellow = "#d7bd8d",
sun = "#e4c180",
purple = "#b4bbc8",
dark_purple = "#b290ac",
teal = "#8abdb6",
orange = "#DE935F",
cyan = "#70c0b1",
statusline_bg = "#212326",
lightbg = "#373B41",
lightbg2 = "#2D3035",
pmenu_bg = "#a4b595",
folder_bg = "#6f8dab",
}
return colors
-500
View File
@@ -1,500 +0,0 @@
local M = {}
-- 1st arg as current theme, 2nd as new theme
M.change_theme = function(current_theme, new_theme)
if current_theme == nil or new_theme == nil then
print "Error: Provide current and new theme name"
return false
end
if current_theme == new_theme then
return
end
local user_config = vim.g.nvchad_user_config
local file = vim.fn.stdpath "config" .. "/lua/" .. user_config .. ".lua"
-- store in data variable
local data = assert(M.file("r", file))
-- escape characters which can be parsed as magic chars
current_theme = current_theme:gsub("%p", "%%%0")
new_theme = new_theme:gsub("%p", "%%%0")
local find = "theme = .?" .. current_theme .. ".?"
local replace = 'theme = "' .. new_theme .. '"'
local content = string.gsub(data, find, replace)
-- see if the find string exists in file
if content == data then
print("Error: Cannot change default theme with " .. new_theme .. ", edit " .. file .. " manually")
return false
else
assert(M.file("w", file, content))
end
end
M.clear_cmdline = function()
vim.defer_fn(function()
vim.cmd "echo"
end, 0)
end
M.close_buffer = function(bufexpr, force)
-- This is a modification of a NeoVim plugin from
-- Author: ojroques - Olivier Roques
-- Src: https://github.com/ojroques/nvim-bufdel
-- (Author has okayed copy-paste)
-- Options
local opts = {
next = "cycle", -- how to retrieve the next buffer
quit = false, -- exit when last buffer is deleted
--TODO make this a chadrc flag/option
}
-- ----------------
-- Helper functions
-- ----------------
-- Switch to buffer 'buf' on each window from list 'windows'
local function switch_buffer(windows, buf)
local cur_win = vim.fn.winnr()
for _, winid in ipairs(windows) do
vim.cmd(string.format("%d wincmd w", vim.fn.win_id2win(winid)))
vim.cmd(string.format("buffer %d", buf))
end
vim.cmd(string.format("%d wincmd w", cur_win)) -- return to original window
end
-- Select the first buffer with a number greater than given buffer
local function get_next_buf(buf)
local next = vim.fn.bufnr "#"
if opts.next == "alternate" and vim.fn.buflisted(next) == 1 then
return next
end
for i = 0, vim.fn.bufnr "$" - 1 do
next = (buf + i) % vim.fn.bufnr "$" + 1 -- will loop back to 1
if vim.fn.buflisted(next) == 1 then
return next
end
end
end
-- ----------------
-- End helper functions
-- ----------------
local buf = vim.fn.bufnr()
if vim.fn.buflisted(buf) == 0 then -- exit if buffer number is invalid
return
end
if #vim.fn.getbufinfo { buflisted = 1 } < 2 then
if opts.quit then
-- exit when there is only one buffer left
if force then
vim.cmd "qall!"
else
vim.cmd "confirm qall"
end
return
end
local chad_term, type = pcall(function()
return vim.api.nvim_buf_get_var(buf, "term_type")
end)
if chad_term then
-- Must be a window type
vim.cmd(string.format("setlocal nobl", buf))
vim.cmd "enew"
return
end
-- don't exit and create a new empty buffer
vim.cmd "enew"
vim.cmd "bp"
end
local next_buf = get_next_buf(buf)
local windows = vim.fn.getbufinfo(buf)[1].windows
-- force deletion of terminal buffers to avoid the prompt
if force or vim.fn.getbufvar(buf, "&buftype") == "terminal" then
local chad_term, type = pcall(function()
return vim.api.nvim_buf_get_var(buf, "term_type")
end)
-- TODO this scope is error prone, make resilient
if chad_term then
if type == "wind" then
-- hide from bufferline
vim.cmd(string.format("%d bufdo setlocal nobl", buf))
-- swtich to another buff
-- TODO switch to next bufffer, this works too
vim.cmd "BufferLineCycleNext"
else
local cur_win = vim.fn.winnr()
-- we can close this window
vim.cmd(string.format("%d wincmd c", cur_win))
return
end
else
switch_buffer(windows, next_buf)
vim.cmd(string.format("bd! %d", buf))
end
else
switch_buffer(windows, next_buf)
vim.cmd(string.format("silent! confirm bd %d", buf))
end
-- revert buffer switches if user has canceled deletion
if vim.fn.buflisted(buf) == 1 then
switch_buffer(windows, buf)
end
end
-- wrapper to use vim.api.nvim_echo
-- table of {string, highlight}
-- e.g echo({{"Hello", "Title"}, {"World"}})
M.echo = function(opts)
if opts == nil or type(opts) ~= "table" then
return
end
vim.api.nvim_echo(opts, false, {})
end
-- 1st arg - r or w
-- 2nd arg - file path
-- 3rd arg - content if 1st arg is w
-- return file data on read, nothing on write
M.file = function(mode, filepath, content)
local data
local fd = assert(vim.loop.fs_open(filepath, mode, 438))
local stat = assert(vim.loop.fs_fstat(fd))
if stat.type ~= "file" then
data = false
else
if mode == "r" then
data = assert(vim.loop.fs_read(fd, stat.size, 0))
else
assert(vim.loop.fs_write(fd, content, 0))
data = true
end
end
assert(vim.loop.fs_close(fd))
return data
end
-- return a table of available themes
M.list_themes = function(return_type)
local themes = {}
-- folder where theme files are stored
local themes_folder = vim.fn.stdpath "config" .. "/lua/themes"
-- list all the contents of the folder and filter out files with .lua extension, then append to themes table
local fd = vim.loop.fs_scandir(themes_folder)
if fd then
while true do
local name, typ = vim.loop.fs_scandir_next(fd)
if name == nil then
break
end
if typ ~= "directory" and string.find(name, ".lua") then
-- return the table values as keys if specified
if return_type == "keys_as_value" then
themes[vim.fn.fnamemodify(name, ":r")] = true
else
table.insert(themes, vim.fn.fnamemodify(name, ":r"))
end
end
end
end
return themes
end
-- Base code: https://gist.github.com/revolucas/184aec7998a6be5d2f61b984fac1d7f7
-- Changes over it: preserving table 1 contents and also update with table b, without duplicating
-- 1st arg - base table, 2nd arg - table to merge
M.merge_table = function(into, from)
-- make sure both are table
if type(into) ~= "table" or type(from) ~= "table" then
return into
end
local stack, seen = {}, {}
local table1, table2 = into, from
while true do
for k, v in pairs(table2) do
if type(v) == "table" and type(table1[k]) == "table" then
table.insert(stack, { table1[k], table2[k] })
else
local present = seen[v] or false
if not present then
if type(k) == "number" then
-- add the value to seen table until value is found
-- only do when key is number we just want to append to subtables
-- todo: maybe improve this
for _, value in pairs(table1) do
if value == v then
present = true
break
end
end
seen[v] = true
if not present then
table1[#table1 + 1] = v
end
else
table1[k] = v
end
end
end
end
if #stack > 0 then
local t = stack[#stack]
table1, table2 = t[1], t[2]
stack[#stack] = nil
else
break
end
end
return into
end
-- load config
-- 1st arg = boolean - whether to force reload
-- Modifies _G._NVCHAD_CONFIG global variable
M.load_config = function(reload)
-- only do the stuff below one time, otherwise just return the set config
if _G._NVCHAD_CONFIG_CONTENTS ~= nil and not (reload or false) then
return _G._NVCHAD_CONFIG_CONTENTS
end
-- don't enclose in pcall, it better break when default config is faulty
_G._NVCHAD_CONFIG_CONTENTS = require "default_config"
-- user config is not required to run nvchad but a optional
-- Make sure the config doesn't break the whole system if user config is not present or in bad state or not a table
-- print warning texts if user config file is present
local config_name = vim.g.nvchad_user_config or "chadrc"
local config_file = vim.fn.stdpath "config" .. "/lua/" .. config_name .. ".lua"
-- check if the user config is present
if vim.fn.empty(vim.fn.glob(config_file)) < 1 then
local present, config = pcall(require, config_name)
if present then
-- make sure the returned value is table
if type(config) == "table" then
-- data = require(config_name)
_G._NVCHAD_CONFIG_CONTENTS = require("utils").merge_table(_G._NVCHAD_CONFIG_CONTENTS, config)
else
print("Warning: " .. config_name .. " sourced successfully but did not return a lua table.")
end
else
print("Warning: " .. config_file .. " is present but sourcing failed.")
end
end
return _G._NVCHAD_CONFIG_CONTENTS
end
-- reload a plugin ( will try to load even if not loaded)
-- can take a string or list ( table )
-- return true or false
M.reload_plugin = function(plugins)
local status = true
local function _reload_plugin(plugin)
local loaded = package.loaded[plugin]
if loaded then
package.loaded[plugin] = nil
end
if not pcall(require, plugin) then
print("Error: Cannot load " .. plugin .. " plugin!")
status = false
end
end
if type(plugins) == "string" then
_reload_plugin(plugins)
elseif type(plugins) == "table" then
for _, plugin in ipairs(plugins) do
_reload_plugin(plugin)
end
end
return status
end
-- reload themes without restarting vim
-- if no theme name given then reload the current theme
M.reload_theme = function(theme_name)
local reload_plugin = require("utils").reload_plugin
-- if theme name is empty or nil, then reload the current theme
if theme_name == nil or theme_name == "" then
theme_name = vim.g.nvchad_theme
end
if not pcall(require, "themes/" .. theme_name) then
print("No such theme ( " .. theme_name .. " )")
return false
end
vim.g.nvchad_theme = theme_name
-- reload the base16 theme
local ok, base16 = pcall(require, "base16")
if not ok then
print "Error: Cannot load base16 plugin!"
return false
end
base16(base16.themes(theme_name), true)
if
not reload_plugin {
"highlights",
"plugins.bufferline",
"galaxyline",
"plugins.statusline",
}
then
print "Error: Not able to reload all plugins."
return false
end
-- yes, this is very hacky, but due to new_async in
-- https://github.com/glepnir/galaxyline.nvim/blob/main/lua/galaxyline/provider.lua#L5-L36
-- it doesn't work properly and some statusline stuff dissapears
local vcs = require "galaxyline.provider_vcs"
local fileinfo = require "galaxyline.provider_fileinfo"
local buffer = require "galaxyline.provider_buffer"
local extension = require "galaxyline.provider_extensions"
local whitespace = require "galaxyline.provider_whitespace"
local lspclient = require "galaxyline.provider_lsp"
_G.galaxyline_providers = {
BufferIcon = buffer.get_buffer_type_icon,
BufferNumber = buffer.get_buffer_number,
FileTypeName = buffer.get_buffer_filetype,
GitBranch = vcs.get_git_branch,
DiffAdd = vcs.diff_add,
DiffModified = vcs.diff_modified,
DiffRemove = vcs.diff_remove,
LineColumn = fileinfo.line_column,
FileFormat = fileinfo.get_file_format,
FileEncode = fileinfo.get_file_encode,
FileSize = fileinfo.get_file_size,
FileIcon = fileinfo.get_file_icon,
FileName = fileinfo.get_current_file_name,
SFileName = fileinfo.filename_in_special_buffer,
LinePercent = fileinfo.current_line_percent,
ScrollBar = extension.scrollbar_instance,
VistaPlugin = extension.vista_nearest,
WhiteSpace = whitespace.get_item,
GetLspClient = lspclient.get_lsp_client,
}
local diagnostic = require "galaxyline.provider_diagnostic"
_G.galaxyline_providers.DiagnosticError = diagnostic.get_diagnostic_error
_G.galaxyline_providers.DiagnosticWarn = diagnostic.get_diagnostic_warn
_G.galaxyline_providers.DiagnosticHint = diagnostic.get_diagnostic_hint
_G.galaxyline_providers.DiagnosticInfo = diagnostic.get_diagnostic_info
return true
end
-- toggle between 2 themes
-- argument should be a table with 2 theme names
M.toggle_theme = function(themes)
local current_theme = vim.g.current_nvchad_theme or vim.g.nvchad_theme
for _, name in ipairs(themes) do
if name ~= current_theme then
if require("utils").reload_theme(name) then
-- open a buffer and close it to reload the statusline
vim.cmd "new|bwipeout"
vim.g.current_nvchad_theme = name
if M.change_theme(vim.g.nvchad_theme, name) then
vim.g.nvchad_theme = name
end
end
end
end
end
-- update nvchad
M.update_nvchad = function()
-- in all the comments below, config means user config
local config_path = vim.fn.stdpath "config"
local config_name = vim.g.nvchad_user_config or "chadrc"
local config_file = config_path .. "/lua/" .. config_name .. ".lua"
-- generate a random file name
local config_file_backup = config_path .. "/" .. config_name .. ".lua.bak." .. math.random()
local utils = require "utils"
local echo = utils.echo
local current_config = utils.load_config()
local update_url = current_config.options.update_url or "https://github.com/NvChad/NvChad"
local update_branch = current_config.options.update_branch or "main"
-- ask the user for confirmation to update because we are going to run git reset --hard
echo { { "Url: ", "Title" }, { update_url } }
echo { { "Branch: ", "Title" }, { update_branch } }
echo {
{ "\nUpdater will run", "WarningMsg" },
{ " git reset --hard " },
{
"in config folder, so changes to existing repo files except ",
"WarningMsg",
},
{ config_name },
{ " will be lost!\n\nUpdate NvChad ? [y/N]", "WarningMsg" },
}
local ans = string.lower(vim.fn.input "-> ") == "y"
utils.clear_cmdline()
if not ans then
echo { { "Update cancelled!", "Title" } }
return
end
-- first try to fetch contents of config, this will make sure it is readable and taking backup of its contents
local config_contents = utils.file("r", config_file)
-- also make a local backup in ~/.config/nvim, will be removed when config is succesfully restored
utils.file("w", config_file_backup, config_contents)
-- write original config file with its contents, will make sure charc is writable, this maybe overkill but a little precaution always helps
utils.file("w", config_file, config_contents)
-- function that will executed when git commands are done
local function update_exit(_, code)
-- restore config file irrespective of whether git commands were succesfull or not
if pcall(function()
utils.file("w", config_file, config_contents)
end) then
-- config restored succesfully, remove backup file that was created
if not pcall(os.remove, config_file_backup) then
echo { { "Warning: Failed to remove backup chadrc, remove manually.", "WarningMsg" } }
echo { { "Path: ", "WarningMsg" }, { config_file_backup } }
end
else
echo { { "Error: Restoring " .. config_name .. " failed.\n", "ErrorMsg" } }
echo { { "Backed up " .. config_name .. " path: " .. config_file_backup .. "\n\n", "None" } }
end
-- close the terminal buffer only if update was success, as in case of error, we need the error message
if code == 0 then
vim.cmd "bd!"
echo { { "NvChad succesfully updated.\n", "String" } }
else
echo { { "Error: NvChad Update failed.\n", "ErrorMsg" } }
end
end
-- git commands that will executed, reset in case config was modfied
-- use --ff-only to not mess up if the local repo is outdated
local update_script = table.concat({
"git reset --hard && git pull --set-upstream",
update_url,
update_branch,
"--ff-only",
}, " ")
-- open a new buffer
vim.cmd "new"
-- finally open the pseudo terminal buffer
vim.fn.termopen(update_script, {
-- change dir to config path so we don't need to move in script
cwd = config_path,
on_exit = update_exit,
})
end
return M