3 files changed,
37 insertions(+),
33 deletions(-)
Author:
Smirnov Olexander
ss2316544@gmail.com
Committed at:
2022-06-20 22:35:40 +0300
Parent:
d15629f
jump to
| M | lua/core/keymaps.lua |
| M | lua/core/utils.lua |
| M | lua/plugins.lua |
M
lua/core/keymaps.lua
@@ -1,4 +1,5 @@
-local map = require("core.utils").map +local u = require "core.utils" +local map, expr = u.map, u.expr -- general map("n", "<C-s>", "<cmd>write!<cr>")@@ -14,10 +15,10 @@ map("n", "<leader>q", "<cmd>quit!<cr>")
map("n", "<leader>w", "<cmd>write!<cr>") -- select in pupup by C-j & C-k -map("i", "<C-j>", 'pumvisible() ? "\\<down>" : "\\<C-j>"', true) -map("i", "<C-k>", 'pumvisible() ? "\\<up>" : "\\<C-k>"', true) -map("c", "<C-j>", 'pumvisible() ? "\\<C-n>" : "\\<C-j>"', true) -map("c", "<C-k>", 'pumvisible() ? "\\<C-p>" : "\\<C-k>"', true) +expr("i", "<C-j>", 'pumvisible() ? "\\<down>" : "\\<C-j>"') +expr("i", "<C-k>", 'pumvisible() ? "\\<up>" : "\\<C-k>"') +expr("c", "<C-j>", 'pumvisible() ? "\\<C-n>" : "\\<C-j>"') +expr("c", "<C-k>", 'pumvisible() ? "\\<C-p>" : "\\<C-k>"') -- window navigation and resize map("n", "<C-h>", "<cmd>wincmd h<cr>")
M
lua/core/utils.lua
@@ -2,25 +2,28 @@ return {
---@param mode string ---@param from string ---@param to string - ---@param expr boolean|nil - map = function(mode, from, to, expr) - if expr then - vim.keymap.set(mode, from, to, { noremap = true, expr = true }) - return - end - + map = function(mode, from, to) vim.keymap.set(mode, from, to, { noremap = true, silent = true }) end, - ---@param path string - ---@return string - get_config = function(path) - return string.format("require[[%s]]", path) + ---@param mode string + ---@param from string + ---@param to string + expr = function(mode, from, to) + vim.keymap.set(mode, from, to, { noremap = true, expr = true }) end, - ---@param path string - ---@return string - get_setup = function(path) - return string.format("require[[%s]].setup()", path) - end, + get = { + ---@param path string + ---@return string + config = function(path) + return string.format("require[[%s]]", path) + end, + + ---@param path string + ---@return string + setup = function(path) + return string.format("require[[%s]].setup()", path) + end, + }, }
M
lua/plugins.lua
@@ -20,59 +20,59 @@ use "~/code/gopher.nvim"
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 "configs.project" } + use { "ahmedkhalf/project.nvim", config = u.get.config "configs.project" } use { "gpanders/editorconfig.nvim", event = "BufRead" } use { -- commenting helper "numToStr/Comment.nvim", keys = "gc", event = "BufRead", - config = u.get_setup "Comment", + config = u.get.setup "Comment", } use { -- auto pairs closer "windwp/nvim-autopairs", event = "InsertEnter", - config = u.get_config "configs.autopairs", + config = u.get.config "configs.autopairs", } use { -- status line "nvim-lualine/lualine.nvim", after = "kanagawa.nvim", - config = u.get_config "configs.statusline", + config = u.get.config "configs.statusline", } -- git use { "lewis6991/gitsigns.nvim", event = "BufRead", - config = u.get_config "configs.gitsigns", + config = u.get.config "configs.gitsigns", } use { "TimUntersberger/neogit", cmd = "Neogit", - config = u.get_config "configs.neogit", + config = u.get.config "configs.neogit", } -- picker & file explorer use { "nvim-telescope/telescope.nvim", cmd = "Telescope", - config = u.get_config "configs.telescope", + config = u.get.config "configs.telescope", requires = { "nvim-telescope/telescope-ui-select.nvim" }, } use { "kyazdani42/nvim-tree.lua", cmd = "NvimTreeToggle", - config = u.get_config "configs.nvimtree", + config = u.get.config "configs.nvimtree", } use { -- syntax "nvim-treesitter/nvim-treesitter", event = { "BufRead", "BufNewFile" }, - config = u.get_config "configs.treesitter", + config = u.get.config "configs.treesitter", requires = { { "RRethy/nvim-treesitter-endwise", after = "nvim-treesitter" }, },@@ -81,14 +81,14 @@
use { -- notes "nvim-neorg/neorg", requires = "nvim-treesitter/nvim-treesitter", - config = u.get_config "configs.neorg", + config = u.get.config "configs.neorg", } -- lsp & completion use { "neovim/nvim-lspconfig", event = { "BufRead", "BufNewFile" }, - config = u.get_config "configs.lsp", + config = u.get.config "configs.lsp", requires = { { "williamboman/nvim-lsp-installer", module = "nvim-lsp-installer" }, { "jose-elias-alvarez/null-ls.nvim", module = "null-ls" },@@ -99,7 +99,7 @@
use { "hrsh7th/nvim-cmp", event = "BufRead", - config = u.get_config "configs.cmp", + config = u.get.config "configs.cmp", requires = { { "hrsh7th/cmp-buffer", after = "nvim-cmp" }, { "saadparwaiz1/cmp_luasnip", after = "nvim-cmp" },