all repos

init.lua @ 57c788bdc142a470284dd826e18a97fdc93175b3

my nvim config
6 files changed, 48 insertions(+), 30 deletions(-)
feat(plugins): update way to setup simple plugin configs
Author: Smirnov Oleksandr ss2316544@gmail.com
Committed at: 2022-07-29 00:41:54 +0300
Parent: 9922b78
D

@@ -1,3 +0,0 @@

-require("nvim-autopairs").setup { - check_ts = true, -}
A lua/configs/other.lua

@@ -0,0 +1,39 @@

+local M = {} + +function M.autopairs() + require("nvim-autopairs").setup { + check_ts = true, + } +end + +function M.treesitter() + require("nvim-treesitter.configs").setup { + ensure_installed = { "lua", "go", "gomod", "python", "yaml", "comment" }, + indent = { enable = true, disable = { "python", "go", "yaml", "nix" } }, + highlight = { enable = true, additional_vim_regex_highlighting = false }, + context_commentstring = { enable = true, enable_autocmd = false }, + autopairs = { enable = true }, + endwise = { enable = true }, + } +end + +function M.project() + require("project_nvim").setup { + show_hidden = true, + patterns = { + ".git", + "Makefile", + "package.json", + "deno.json", + "go.mod", + "pyproject.toml", + "Cargo.toml", + }, + exclude_dirs = { + "~/.cargo", + "~/.golang", + }, + } +end + +return M
D

@@ -1,16 +0,0 @@

-require("project_nvim").setup { - show_hidden = true, - patterns = { - ".git", - "Makefile", - "package.json", - "deno.json", - "go.mod", - "pyproject.toml", - "Cargo.toml", - }, - exclude_dirs = { - "~/.cargo", - "~/.golang", - }, -}
D

@@ -1,8 +0,0 @@

-require("nvim-treesitter.configs").setup { - ensure_installed = { "lua", "go", "gomod", "python", "yaml", "comment" }, - indent = { enable = true, disable = { "python", "go", "yaml", "nix" } }, - highlight = { enable = true, additional_vim_regex_highlighting = false }, - context_commentstring = { enable = true, enable_autocmd = false }, - autopairs = { enable = true }, - endwise = { enable = true }, -}
M lua/core/utils.lua

@@ -25,5 +25,11 @@ ---@return string

setup = function(path) return string.format("require[[%s]].setup()", path) end, + + ---@param plug string + ---@return string + other = function(plug) + return string.format("require[[configs.other]].%s()", plug) + end, }, }
M lua/plugins.lua

@@ -19,7 +19,7 @@

use { "~/code/gopher.nvim", ft = "go" } use { "tpope/vim-surround", keys = { "c", "d", "y" } } use { "kyazdani42/nvim-web-devicons", module = "nvim-web-devicons" } - use { "ahmedkhalf/project.nvim", config = u.get.config "project" } + use { "ahmedkhalf/project.nvim", config = u.get.other "project" } use { "gpanders/editorconfig.nvim", event = "BufRead" } use { "ggandor/lightspeed.nvim", keys = { "s", "S", "f", "F" } }

@@ -33,7 +33,7 @@

use { -- auto pairs closer "windwp/nvim-autopairs", event = "InsertEnter", - config = u.get.config "autopairs", + config = u.get.other "autopairs", } use { -- status line

@@ -78,7 +78,7 @@

use { -- syntax "nvim-treesitter/nvim-treesitter", event = "BufRead", - config = u.get.config "treesitter", + config = u.get.other "treesitter", requires = { { "RRethy/nvim-treesitter-endwise", after = "nvim-treesitter" }, },