From 503dc5b1c8a511ebbfaecee96381af7bc70de7cf Mon Sep 17 00:00:00 2001 From: siduck76 Date: Wed, 5 May 2021 06:51:04 +0530 Subject: [PATCH] better config structure --- README.md | 16 +++++------- init.lua | 26 +++++++++---------- lua/{compe/lua.lua => compe-completion.lua} | 0 lua/{file-icons/lua.lua => file-icons.lua} | 0 lua/{gitsigns/lua.lua => gitsigns-nvim.lua} | 0 lua/{mappings/lua.lua => mappings.lua} | 0 lua/{misc-utils/lua.lua => misc-utils.lua} | 0 lua/{lspconfig/lua.lua => nvim-lspconfig.lua} | 0 lua/{nvimTree/lua.lua => nvimTree.lua} | 0 lua/{pluginsList/lua.lua => pluginList.lua} | 0 lua/{statusline/lua.lua => statusline.lua} | 0 lua/{telescope/lua.lua => telescope-nvim.lua} | 0 .../lua.lua => top-bufferline.lua} | 0 .../lua.lua => treesitter-nvim.lua} | 0 lua/{zenmode/lua.lua => zenmode.lua} | 0 15 files changed, 20 insertions(+), 22 deletions(-) rename lua/{compe/lua.lua => compe-completion.lua} (100%) rename lua/{file-icons/lua.lua => file-icons.lua} (100%) rename lua/{gitsigns/lua.lua => gitsigns-nvim.lua} (100%) rename lua/{mappings/lua.lua => mappings.lua} (100%) rename lua/{misc-utils/lua.lua => misc-utils.lua} (100%) rename lua/{lspconfig/lua.lua => nvim-lspconfig.lua} (100%) rename lua/{nvimTree/lua.lua => nvimTree.lua} (100%) rename lua/{pluginsList/lua.lua => pluginList.lua} (100%) rename lua/{statusline/lua.lua => statusline.lua} (100%) rename lua/{telescope/lua.lua => telescope-nvim.lua} (100%) rename lua/{bufferline/lua.lua => top-bufferline.lua} (100%) rename lua/{treesitter/lua.lua => treesitter-nvim.lua} (100%) rename lua/{zenmode/lua.lua => zenmode.lua} (100%) diff --git a/README.md b/README.md index 7b77f90..8cc96b0 100644 --- a/README.md +++ b/README.md @@ -79,15 +79,13 @@ nvim-base16 doesnt even take time to load unlike base16-vim which was eating hal nvim ├──init.lua └──lua - └──foo - └──lua.lua + └──anything.lua ``` - The init.lua is used instead of init.vim. - -- The lua folder contains modules ( config files ) , in the example above "foo" folder could be considered as a module and it contains a lua.lua. -- The lua.lua file is supposed to have any nvim config written in lua , its like splitting the overall config into small bits and make it more organized. -- To load or source that "foo" module (like making it load with init.lua ) , you need to load it in init.lua like this : require('foo.lua'). +- The lua folder contains modules ( config files ) , in the example above anything.lua file in lua folder could be considered as a module. +- The anything.lua file is supposed to have any neovim config written in lua , its like splitting the overall config into small bits and make it more organized , like one module for highlights and colors , another one for statusline and so on!. +- To load or source that "anything" module (like making it load with init.lua ) ,add this is in init.lua : require "anything". # Features @@ -110,7 +108,7 @@ nvim-base16 doesnt even take time to load unlike base16-vim which was eating hal - indent-blankline.Nvim for indentlines - smooth scrolling - Snip support from VSCode through vsnip supporting custom and predefined snips (friendly-snippets) - + # Guides to migrate your nvim configs to init.lua - - https://github.com/nanotee/nvim-lua-guide @@ -138,7 +136,7 @@ nvim-base16 doesnt even take time to load unlike base16-vim which was eating hal git clone https://github.com/wbthomason/packer.nvim\ ~/.local/share/nvim/site/pack/packer/start/packer.nvim - + ``` - copy lua folder and init.lua into ~/.config/nvim @@ -146,7 +144,7 @@ git clone https://github.com/wbthomason/packer.nvim\ - Install language servers and prettier ( for autocompletion etc and code formatting , nodejs should be installed too!) , this usually depends on the language support you want to add in your neovim config. ``` -npm config set prefix=~/.node_modules +npm config set prefix=~/.node_modules npm install -g vscode-html-languageserver-bin typescript typescript-language-server vscode-css-languageserver-bin prettier (ADD ~/.node_modules at your PATH) diff --git a/init.lua b/init.lua index 7554268..82b9bda 100644 --- a/init.lua +++ b/init.lua @@ -1,17 +1,17 @@ -- load all plugins -require "pluginsList.lua" -require "file-icons.lua" +require "pluginList" +require "file-icons" -require "misc-utils.lua" -require "bufferline.lua" -require "statusline.lua" +require "misc-utils" +require "top-bufferline" +require "statusline" require("colorizer").setup() require("neoscroll").setup() -- smooth scroll -- lsp -require "lspconfig.lua" -require "compe.lua" +require "nvim-lspconfig" +require "compe-completion" local cmd = vim.cmd local g = vim.g @@ -42,8 +42,8 @@ g.indent_blankline_buftype_exclude = {"terminal"} g.indent_blankline_show_trailing_blankline_indent = false g.indent_blankline_show_first_indent_level = false -require "treesitter.lua" -require "mappings.lua" +require "treesitter-nvim" +require "mappings" -- highlights -- cmd "hi LineNr guifg=#42464e guibg=NONE" @@ -58,11 +58,11 @@ cmd "hi Pmenu guibg=#282c34" cmd "hi Normal guibg=NONE ctermbg=NONE" -- cmd "hi Normal guibg=#1e222a" -require "telescope.lua" -require "nvimTree.lua" +require "telescope-nvim" +require "nvimTree" -- git signs , lsp symbols etc -require "gitsigns.lua" +require "gitsigns-nvim" require("nvim-autopairs").setup() require("lspkind").init() @@ -78,4 +78,4 @@ cmd "hi clear CursorLine" cmd "hi cursorlinenr guibg=NONE guifg=#abb2bf" -- setup for TrueZen.nvim -require "zenmode.lua" +require "zenmode" diff --git a/lua/compe/lua.lua b/lua/compe-completion.lua similarity index 100% rename from lua/compe/lua.lua rename to lua/compe-completion.lua diff --git a/lua/file-icons/lua.lua b/lua/file-icons.lua similarity index 100% rename from lua/file-icons/lua.lua rename to lua/file-icons.lua diff --git a/lua/gitsigns/lua.lua b/lua/gitsigns-nvim.lua similarity index 100% rename from lua/gitsigns/lua.lua rename to lua/gitsigns-nvim.lua diff --git a/lua/mappings/lua.lua b/lua/mappings.lua similarity index 100% rename from lua/mappings/lua.lua rename to lua/mappings.lua diff --git a/lua/misc-utils/lua.lua b/lua/misc-utils.lua similarity index 100% rename from lua/misc-utils/lua.lua rename to lua/misc-utils.lua diff --git a/lua/lspconfig/lua.lua b/lua/nvim-lspconfig.lua similarity index 100% rename from lua/lspconfig/lua.lua rename to lua/nvim-lspconfig.lua diff --git a/lua/nvimTree/lua.lua b/lua/nvimTree.lua similarity index 100% rename from lua/nvimTree/lua.lua rename to lua/nvimTree.lua diff --git a/lua/pluginsList/lua.lua b/lua/pluginList.lua similarity index 100% rename from lua/pluginsList/lua.lua rename to lua/pluginList.lua diff --git a/lua/statusline/lua.lua b/lua/statusline.lua similarity index 100% rename from lua/statusline/lua.lua rename to lua/statusline.lua diff --git a/lua/telescope/lua.lua b/lua/telescope-nvim.lua similarity index 100% rename from lua/telescope/lua.lua rename to lua/telescope-nvim.lua diff --git a/lua/bufferline/lua.lua b/lua/top-bufferline.lua similarity index 100% rename from lua/bufferline/lua.lua rename to lua/top-bufferline.lua diff --git a/lua/treesitter/lua.lua b/lua/treesitter-nvim.lua similarity index 100% rename from lua/treesitter/lua.lua rename to lua/treesitter-nvim.lua diff --git a/lua/zenmode/lua.lua b/lua/zenmode.lua similarity index 100% rename from lua/zenmode/lua.lua rename to lua/zenmode.lua