all repos

init.lua @ 86e6404

my nvim config
14 files changed, 426 insertions(+), 493 deletions(-)
Delete M.setup function from configs setup
Author: flof-ik ss2316544@gmail.com
Committed at: 2022-02-24 14:22:19 +0200
Parent: a2de0a4
M lua/plugin.lua

@@ -1,4 +1,6 @@

-local get_config = require("utils").get_config +local utils = require "utils" +local get_config = utils.get_config +local get_setup = utils.get_setup return require("packer").startup(function(use) use "wbthomason/packer.nvim"

@@ -10,7 +12,7 @@ use "gpanders/editorconfig.nvim"

use "lewis6991/impatient.nvim" use { "tpope/vim-surround", keys = { "c", "d", "y" } } - use { "numToStr/Comment.nvim", keys = { "gc" }, config = get_config "Comment" } + use { "numToStr/Comment.nvim", keys = { "gc" }, config = get_setup "Comment" } use { "windwp/nvim-autopairs", config = get_config "plugin.autopairs" } use { "ahmedkhalf/project.nvim", config = get_config "plugin.project" }

@@ -20,18 +22,18 @@ use { "folke/lua-dev.nvim", ft = "lua", config = get_config "plugin.lua-dev" }

use { "zah/nim.vim", ft = "nim" } -- git - use { "TimUntersberger/neogit", cmd = "Neogit", config = get_config "neogit" } + use { "TimUntersberger/neogit", cmd = "Neogit", config = get_setup "neogit" } use { "lewis6991/gitsigns.nvim", config = get_config "plugin.gitsigns" } -- appearance use { "folke/which-key.nvim", config = get_config "plugin.whichkey" } use { "nvim-lualine/lualine.nvim", config = get_config "plugin.statusline" } - use { "folke/todo-comments.nvim", config = get_config "todo-comments" } + use { "folke/todo-comments.nvim", config = get_setup "todo-comments" } use { "goolord/alpha-nvim", config = get_config "plugin.alpha" } -- another menus :D use { "kyazdani42/nvim-tree.lua", cmd = "NvimTreeToggle", config = get_config "plugin.nvimtree" } - use { "folke/trouble.nvim", cmd = { "Trouble", "TroubleToggle" }, config = get_config "trouble" } + use { "folke/trouble.nvim", cmd = { "Trouble", "TroubleToggle" }, config = get_setup "trouble" } use { "akinsho/toggleterm.nvim",

@@ -49,7 +51,7 @@ }

use { "neovim/nvim-lspconfig", - config = get_config "lsp", + config = get_setup "lsp", requires = { "williamboman/nvim-lsp-installer", "jose-elias-alvarez/null-ls.nvim",
M lua/plugin/alpha.lua

@@ -1,4 +1,4 @@

-local M = {} +local alpha = require "alpha" local function button(sc, txt, keybind, keybind_opts) local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")

@@ -28,52 +28,46 @@ on_press = on_press,

} end -function M.setup() - local alpha = require "alpha" - - local section = { - header = { - type = "text", - opts = { position = "center", hl = "String" }, - val = { - [[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⠀⠀⠀⡀⡢⢂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢄⢮⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⠀⡠⡂⣊⠢⡑⡐⠄⠀⠀⠀⠀⠀⠀⢀⢔⡕⣕⢗⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⠢⠨⢢⠢⡃⡪⡐⡑⢄⠀⠀⠀⠀⢰⢱⡣⣫⢪⢮⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⡑⠅⢅⠣⡊⡢⡊⢌⠢⡂⡀⠀⠀⢐⢧⢳⢕⢧⢳⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⠪⡨⠢⠡⡑⠰⡘⡌⡪⡂⡆⠄⠀⢐⡕⣗⢕⡗⡵⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⠕⢌⠪⡨⢌⠀⠘⡰⡑⡌⡪⡊⣂⠀⡯⣪⡳⣹⡪⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⠕⡅⠕⢌⠢⠀⠀⠀⢕⢅⢇⢕⢒⢬⢺⢕⢽⢜⢮⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⢕⢘⠜⢌⠪⠀⠀⠀⠀⠪⡢⡣⡣⡣⡳⣹⢕⢯⡳⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⢕⢅⢣⢑⠕⠀⠀⠀⠀⠀⠘⢜⢌⢎⢞⢎⢯⡳⡝⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⢕⢌⠆⠁⠀⠀⠀⠀⠀⠀⠀⠈⢎⢎⣗⢽⠑⠉⠀⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⠕⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠣⠓⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]], - [[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀neovim⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]], - }, - }, - buttons = { - type = "group", - val = { - button("f", " search files", "<cmd>Telescope find_files<cr>"), - button("p", "ﰍ search project", "<cmd>Telescope projects<cr>"), - button("e", " open file explorer", "<cmd>NvimTree<cr>"), - button("n", " new file", "<cmd>ene <cr>"), - }, +local section = { + header = { + type = "text", + opts = { position = "center", hl = "String" }, + val = { + [[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⠀⠀⠀⡀⡢⢂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢄⢮⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⠀⡠⡂⣊⠢⡑⡐⠄⠀⠀⠀⠀⠀⠀⢀⢔⡕⣕⢗⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⠢⠨⢢⠢⡃⡪⡐⡑⢄⠀⠀⠀⠀⢰⢱⡣⣫⢪⢮⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⡑⠅⢅⠣⡊⡢⡊⢌⠢⡂⡀⠀⠀⢐⢧⢳⢕⢧⢳⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⠪⡨⠢⠡⡑⠰⡘⡌⡪⡂⡆⠄⠀⢐⡕⣗⢕⡗⡵⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⠕⢌⠪⡨⢌⠀⠘⡰⡑⡌⡪⡊⣂⠀⡯⣪⡳⣹⡪⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⠕⡅⠕⢌⠢⠀⠀⠀⢕⢅⢇⢕⢒⢬⢺⢕⢽⢜⢮⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⢕⢘⠜⢌⠪⠀⠀⠀⠀⠪⡢⡣⡣⡣⡳⣹⢕⢯⡳⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⢕⢅⢣⢑⠕⠀⠀⠀⠀⠀⠘⢜⢌⢎⢞⢎⢯⡳⡝⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⢕⢌⠆⠁⠀⠀⠀⠀⠀⠀⠀⠈⢎⢎⣗⢽⠑⠉⠀⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⠕⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠣⠓⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]], + [[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀neovim⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]], }, - } - - local opts = { - layout = { - { type = "padding", val = 2 }, - section.header, - { type = "padding", val = 2 }, - section.buttons, + }, + buttons = { + type = "group", + val = { + button("f", " search files", "<cmd>Telescope find_files<cr>"), + button("p", "ﰍ search project", "<cmd>Telescope projects<cr>"), + button("e", " open file explorer", "<cmd>NvimTree<cr>"), + button("n", " new file", "<cmd>ene <cr>"), }, - opts = { margin = 5 }, - } + }, +} - alpha.setup(opts) -end +local opts = { + layout = { + { type = "padding", val = 2 }, + section.header, + { type = "padding", val = 2 }, + section.buttons, + }, + opts = { margin = 5 }, +} -return M +alpha.setup(opts)
M lua/plugin/autopairs.lua

@@ -1,12 +1,7 @@

-local M = {} +local npairs = require "nvim-autopairs" -function M.setup() - local npairs = require "nvim-autopairs" - npairs.setup { - check_ts = true, - } +npairs.setup { + check_ts = true, +} - npairs.add_rules(require "nvim-autopairs.rules.endwise-lua") -end - -return M +npairs.add_rules(require "nvim-autopairs.rules.endwise-lua")
M lua/plugin/cmp.lua

@@ -1,94 +1,91 @@

-local M = {} +local cmp = require "cmp" -function M.setup() - local cmp = require "cmp" +-- Snippets +require("luasnip/loaders/from_vscode").load { + paths = { + "~/.local/share/nvim/site/pack/packer/start/friendly-snippets", + "~/.local/share/nvim/site/pack/packer/opt/friendly-snippets", + }, +} - require("luasnip/loaders/from_vscode").load { - paths = { - "~/.local/share/nvim/site/pack/packer/start/friendly-snippets", - "~/.local/share/nvim/site/pack/packer/opt/friendly-snippets", - }, - } +-- Autopairs +cmp.event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done()) - cmp.event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done()) - cmp.setup { - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - formatting = { - format = function(_, vim_item) - vim_item.kind = ({ - 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 = "", - })[vim_item.kind] +cmp.setup { + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + formatting = { + format = function(_, vim_item) + vim_item.kind = ({ + 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 = "", + })[vim_item.kind] - return vim_item - end, - }, - mapping = { - ["<C-j>"] = cmp.mapping.select_next_item(), - ["<C-k>"] = cmp.mapping.select_prev_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 = false }, - ["<Tab>"] = 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, - ["<S-Tab>"] = 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, - }, - sources = { - { name = "nvim_lua", max_item_count = 5 }, - { name = "nvim_lsp", max_item_count = 8 }, - { name = "buffer", max_item_count = 5, keyword_length = 4 }, - { name = "luasnip", max_item_count = 4, keyword_length = 2 }, - { name = "path", max_item_count = 2 }, - }, - experimental = { - native_menu = false, - ghost_text = true, - }, - } -end - -return M + return vim_item + end, + }, + mapping = { + ["<C-j>"] = cmp.mapping.select_next_item(), + ["<C-k>"] = cmp.mapping.select_prev_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 = false }, + ["<Tab>"] = 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, + ["<S-Tab>"] = 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, + }, + sources = { + { name = "nvim_lua", max_item_count = 5 }, + { name = "nvim_lsp", max_item_count = 8 }, + { name = "buffer", max_item_count = 5, keyword_length = 4 }, + { name = "luasnip", max_item_count = 4, keyword_length = 2 }, + { name = "path", max_item_count = 2 }, + }, + experimental = { + native_menu = false, + ghost_text = true, + }, +}
M lua/plugin/gitsigns.lua

@@ -1,42 +1,36 @@

-local M = {} - -function M.setup() - require("gitsigns").setup { - signs = { - add = { hl = "GitSignsAdd", text = "│", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, - change = { hl = "GitSignsChange", text = "│", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - changedelete = { hl = "GitSignsChange", text = "~", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - }, - signcolumn = true, - numhl = false, - linehl = false, - word_diff = false, - watch_gitdir = { - interval = 1000, - follow_files = true, - }, - attach_to_untracked = true, - current_line_blame = true, - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", - delay = 300, - }, - current_line_blame_formatter_opts = { relative_time = false }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, - max_file_length = 1500, - preview_config = { - border = "single", - style = "minimal", - relative = "cursor", - row = 0, - col = 1, - }, - } -end - -return M +require("gitsigns").setup { + signs = { + add = { hl = "GitSignsAdd", text = "│", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, + change = { hl = "GitSignsChange", text = "│", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, + delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + changedelete = { hl = "GitSignsChange", text = "~", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, + }, + signcolumn = true, + numhl = false, + linehl = false, + word_diff = false, + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame = true, + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", + delay = 300, + }, + current_line_blame_formatter_opts = { relative_time = false }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, + max_file_length = 1500, + preview_config = { + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, +}
M lua/plugin/lua-dev.lua

@@ -1,14 +1,8 @@

-local M = {} - -function M.setup() - require("lua-dev").setup { - library = { - vimruntime = true, - types = true, - plugins = true, - }, - runtime_path = false, - } -end - -return M +require("lua-dev").setup { + library = { + vimruntime = true, + types = true, + plugins = true, + }, + runtime_path = false, +}
M lua/plugin/nvimtree.lua

@@ -1,45 +1,38 @@

-local M = {} - -function M.setup() - require("nvim-tree").setup { - disable_netrw = true, - hijack_netrw = true, - auto_close = true, - auto_open = true, - update_cwd = true, - diagnostics = { - enable = true, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, +vim.g.nvim_tree_group_empty = 1 +require("nvim-tree").setup { + disable_netrw = true, + hijack_netrw = true, + auto_close = true, + auto_open = true, + update_cwd = true, + diagnostics = { + enable = true, + icons = { + hint = "", + info = "", + warning = "", + error = "", }, - filters = { - dotfiles = false, - custom = { ".git", "node_modules", "__pycache__", "vendor", "env", ".bin" }, - }, - view = { - width = 30, - auto_resize = false, - hide_root_folder = false, - mappings = { - custom_only = false, - list = { - { key = { "l", "<CR>", "o" }, action = "edit" }, - { key = "h", action = "close_node" }, - { key = "v", action = "vsplit" }, - }, + }, + filters = { + dotfiles = false, + custom = { ".git", "node_modules", "__pycache__", "vendor", "env", ".bin" }, + }, + view = { + width = 30, + auto_resize = false, + hide_root_folder = false, + mappings = { + custom_only = false, + list = { + { key = { "l", "<CR>", "o" }, action = "edit" }, + { key = "h", action = "close_node" }, + { key = "v", action = "vsplit" }, }, }, - trash = { - cmd = "trash", - require_confirm = true, - }, - } - - vim.g.nvim_tree_group_empty = 1 -end - -return M + }, + trash = { + cmd = "trash", + require_confirm = true, + }, +}
M lua/plugin/project.lua

@@ -1,15 +1,7 @@

-local M = {} - -function M.setup() - require("project_nvim").setup { - manual_mode = false, - detection_methods = { "lsp", "pattern" }, - patterns = { ".git", ".svn", "Makefile", "Justfile", "package.json", "go.mod" }, - ignore_lsp = {}, - exclude_dirs = {}, - show_hidden = false, - silent_chdir = true, - } -end - -return M +require("project_nvim").setup { + manual_mode = false, + detection_methods = { "lsp", "pattern" }, + patterns = { ".git", ".svn", "Makefile", "package.json", "go.mod" }, + show_hidden = false, + silent_chdir = true, +}
M lua/plugin/statusline.lua

@@ -1,23 +1,17 @@

-local M = {} - -function M.setup() - require("lualine").setup { - options = { - theme = "onenord", - component_separators = { "", "" }, - section_separators = { "", "" }, - disabled_filetypes = { "NvimTree", "Telescope", "alpha" }, - always_divide_middle = false, - }, - sections = { - lualine_a = { "filename" }, - lualine_b = { "branch", "diff" }, - lualine_c = {}, - lualine_x = {}, - lualine_y = { { "diagnostics", sources = { "nvim_diagnostic" } } }, - lualine_z = { "location" }, - }, - } -end - -return M +require("lualine").setup { + options = { + theme = "onenord", + component_separators = { "", "" }, + section_separators = { "", "" }, + disabled_filetypes = { "NvimTree", "Telescope", "alpha" }, + always_divide_middle = false, + }, + sections = { + lualine_a = { "filename" }, + lualine_b = { "branch", "diff" }, + lualine_c = {}, + lualine_x = {}, + lualine_y = { { "diagnostics", sources = { "nvim_diagnostic" } } }, + lualine_z = { "location" }, + }, +}
M lua/plugin/telescope.lua

@@ -1,65 +1,59 @@

-local M = {} +local actions = require "telescope.actions" +local action_layout = require "telescope.actions.layout" -function M.setup() - local actions = require "telescope.actions" - local action_layout = require "telescope.actions.layout" - - require("telescope").setup { - defaults = { - prompt_prefix = " ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "descending", - layout_strategy = "horizontal", - layout_config = { - width = 0.75, - preview_cutoff = 120, - prompt_position = "top", - horizontal = { mirror = false }, - vertical = { mirror = false }, +require("telescope").setup { + defaults = { + prompt_prefix = " ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "descending", + layout_strategy = "horizontal", + layout_config = { + width = 0.75, + preview_cutoff = 120, + prompt_position = "top", + horizontal = { mirror = false }, + vertical = { mirror = false }, + }, + file_ignore_patterns = { ".git", "node_modules", "__pycache__", "target", "vendor", "env", ".bin" }, + winblend = 0, + border = {}, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + color_devicons = true, + set_env = { ["COLORTERM"] = "truecolor" }, + mappings = { + i = { + ["<esc>"] = actions.close, + ["<C-j>"] = actions.move_selection_next, + ["<C-k>"] = actions.move_selection_previous, + ["<A-p>"] = action_layout.toggle_preview, + ["<C-u>"] = false, }, - file_ignore_patterns = { ".git", "node_modules", "__pycache__", "target", "vendor", "env", ".bin" }, - winblend = 0, - border = {}, - borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, - color_devicons = true, - set_env = { ["COLORTERM"] = "truecolor" }, - mappings = { - i = { - ["<esc>"] = actions.close, - ["<C-j>"] = actions.move_selection_next, - ["<C-k>"] = actions.move_selection_previous, - ["<A-p>"] = action_layout.toggle_preview, - ["<C-u>"] = false, - }, - n = { - ["<C-j>"] = actions.move_selection_next, - ["<C-k>"] = actions.move_selection_previous, - ["<A-p>"] = action_layout.toggle_preview, - }, + n = { + ["<C-j>"] = actions.move_selection_next, + ["<C-k>"] = actions.move_selection_previous, + ["<A-p>"] = action_layout.toggle_preview, }, }, - pickers = { - find_files = { theme = "ivy" }, - live_grep = { theme = "ivy", only_sort_text = true }, - buffers = { theme = "ivy" }, - oldfiles = { theme = "ivy" }, - keymaps = { theme = "ivy" }, - git_branches = { theme = "ivy" }, - git_commits = { theme = "ivy" }, - lsp_definitions = { theme = "ivy" }, - lsp_references = { theme = "ivy" }, - lsp_implementations = { theme = "ivy" }, - lsp_code_actions = { theme = "cursor" }, - lsp_document_symbols = { theme = "ivy" }, - reloader = { theme = "cursor" }, - }, - } - - -- Extensions - require("telescope").load_extension "projects" -end + }, + pickers = { + find_files = { theme = "ivy" }, + live_grep = { theme = "ivy", only_sort_text = true }, + buffers = { theme = "ivy" }, + oldfiles = { theme = "ivy" }, + keymaps = { theme = "ivy" }, + git_branches = { theme = "ivy" }, + git_commits = { theme = "ivy" }, + lsp_definitions = { theme = "ivy" }, + lsp_references = { theme = "ivy" }, + lsp_implementations = { theme = "ivy" }, + lsp_code_actions = { theme = "cursor" }, + lsp_document_symbols = { theme = "ivy" }, + reloader = { theme = "cursor" }, + }, +} -return M +-- Extensions +require("telescope").load_extension "projects"
M lua/plugin/terminal.lua

@@ -1,28 +1,22 @@

-local M = {} - -function M.setup() - require("toggleterm").setup { - size = 20, - open_mapping = [[<c-t>]], - hide_numbers = true, - shade_filetypes = {}, - shade_terminals = true, - shading_factor = 2, - start_in_insert = true, - insert_mappings = true, - persist_size = false, - direction = "float", - close_on_exit = true, - shell = vim.o.shell, - float_opts = { - border = "curved", - winblend = 1, - highlights = { - border = "Normal", - background = "Normal", - }, +require("toggleterm").setup { + size = 20, + open_mapping = [[<c-t>]], + hide_numbers = true, + shade_filetypes = {}, + shade_terminals = true, + shading_factor = 2, + start_in_insert = true, + insert_mappings = true, + persist_size = false, + direction = "float", + close_on_exit = true, + shell = vim.o.shell, + float_opts = { + border = "curved", + winblend = 1, + highlights = { + border = "Normal", + background = "Normal", }, - } -end - -return M + }, +}
M lua/plugin/treesitter.lua

@@ -1,13 +1,7 @@

-local M = {} - -function M.setup() - require("nvim-treesitter.configs").setup { - ensure_installed = { "lua", "go", "gomod", "python", "yaml" }, - indent = { enable = true, disable = { "python", "yaml" } }, - highlight = { enable = true, additional_vim_regex_highlighting = true }, - context_commentstring = { enable = true, enable_autocmd = false }, - autopairs = { enable = true }, - } -end - -return M +require("nvim-treesitter.configs").setup { + ensure_installed = { "lua", "go", "gomod", "python", "yaml" }, + indent = { enable = true, disable = { "python", "yaml" } }, + highlight = { enable = true, additional_vim_regex_highlighting = true }, + context_commentstring = { enable = true, enable_autocmd = false }, + autopairs = { enable = true }, +}
M lua/plugin/whichkey.lua

@@ -1,107 +1,101 @@

-local M = {} +local wk = require "which-key" -function M.setup() - local wk = require "which-key" - - wk.setup { - plugins = { - marks = false, - registers = false, - spelling = { enabled = false, suggestions = 20 }, - presets = { - operators = true, - motions = true, - text_objects = true, - windows = true, - nav = true, - z = true, - g = true, - }, +wk.setup { + plugins = { + marks = false, + registers = false, + spelling = { enabled = false, suggestions = 20 }, + presets = { + operators = true, + motions = true, + text_objects = true, + windows = true, + nav = true, + z = true, + g = true, }, - operators = { gc = "Comments" }, - hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, - popup_mappings = { scroll_down = "<c-d>", scroll_up = "<c-u>" }, - ignore_missing = true, - show_help = true, - key_labels = { ["<space>"] = "SPC", ["<cr>"] = "RET", ["<tab>"] = "TAB" }, - icons = { breadcrumb = "»", separator = "➜", group = "+" }, - window = { - border = "none", - position = "bottom", - margin = { 1, 0, 1, 0 }, - padding = { 2, 2, 2, 2 }, - winblend = 0, - }, - layout = { - height = { min = 4, max = 25 }, - width = { min = 20, max = 50 }, - spacing = 3, - align = "left", - }, - } + }, + operators = { gc = "Comments" }, + hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, + popup_mappings = { scroll_down = "<c-d>", scroll_up = "<c-u>" }, + ignore_missing = true, + show_help = true, + key_labels = { ["<space>"] = "SPC", ["<cr>"] = "RET", ["<tab>"] = "TAB" }, + icons = { breadcrumb = "»", separator = "➜", group = "+" }, + window = { + border = "none", + position = "bottom", + margin = { 1, 0, 1, 0 }, + padding = { 2, 2, 2, 2 }, + winblend = 0, + }, + layout = { + height = { min = 4, max = 25 }, + width = { min = 20, max = 50 }, + spacing = 3, + align = "left", + }, +} - local opts = { - mode = "n", - prefix = "<leader>", - buffer = nil, - silent = true, - noremap = true, - nowait = false, - } - - local mappings = { - f = { "<cmd>Telescope find_files<cr>", "Find file" }, - e = { "<cmd>NvimTreeToggle<cr>", "File explorer" }, - b = { "<cmd>Telescope buffers<cr>", "Find buffer" }, - w = { "<cmd>write!<cr>", "Save file" }, - q = { "<cmd>quit!<cr>", "Quit" }, - c = { "<cmd>bdelete<cr>", "Close buffer" }, - h = { "<cmd>nohlsearch<cr>", "No hl" }, - n = { "<cmd>e! /tmp/note.md<cr>", "Note" }, - s = { - name = "Search", - t = { "<cmd>Telescope live_grep<cr>", "Live grep" }, - r = { "<cmd>Telescope oldfiles<cr>", "Find oldfile" }, - b = { "<cmd>Telescope git_branches<cr>", "Git branches" }, - c = { "<cmd>Telescope git_commits<cr>", "Git commits" }, - s = { "<cmd>Telescope spell_suggest<cr>", "Spell suggest" }, - k = { "<cmd>Telescope keymaps<cr>", "Find keymap" }, - p = { "<cmd>Telescope projects<cr>", "Projects" }, - }, - l = { - name = "LSP", - a = { "<cmd>Telescope lsp_code_actions<cr>", "Code actions" }, - d = { "<cmd>TroubleToggle<cr>", "Diagnostics" }, - r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" }, - f = { "<cmd>lua vim.lsp.buf.formatting()<cr>", "Formatting" }, - i = { "<cmd>LspInfo<cr>", "Info" }, - R = { "<cmd>LspRestart<cr>", "Restart server" }, - s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" }, - l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" }, - j = { "<cmd>lua vim.diagnostic.goto_next()<cr>", "Next Diagnostic" }, - q = { "<cmd>lua vim.diagnostic.setloclist()<cr>", "Quickfix" }, - k = { "<cmd>lua vim.diagnostic.goto_prev()<cr>", "Prev Diagnostic" }, - }, - g = { - name = "git", - g = { "<cmd>Neogit<cr>", "Neogit" }, - s = { "<cmd>lua require[[gitsigns]].stage_hunk()<cr>", "Stage hunk" }, - r = { "<cmd>lua require[[gitsigns]].reset_hunk()<cr>", "Reset hunk" }, - p = { "<cmd>lua require[[gitsigns]].preview_hunk()<cr>", "Preview hunk" }, - b = { "<cmd>lua require[[gitsigns]].blame_line(true)<cr>", "Blame line" }, - R = { "<cmd>lua require[[gitsigns]].reset_buffer()<cr>", "Reset buffer" }, - S = { "<cmd>lua require[[gitsigns]].stage_buffer()<cr>", "Stage buffer" }, - }, - p = { - name = "Packer", - s = { "<cmd>PackerSync<cr>", "Sync" }, - i = { "<cmd>PackerInstall<cr>", "Install" }, - c = { "<cmd>PackerCompile<cr>", "Compile" }, - C = { "<cmd>PackerClean<cr>", "Clean" }, - }, - } +local opts = { + mode = "n", + prefix = "<leader>", + buffer = nil, + silent = true, + noremap = true, + nowait = false, +} - wk.register(mappings, opts) -end +local mappings = { + f = { "<cmd>Telescope find_files<cr>", "Find file" }, + e = { "<cmd>NvimTreeToggle<cr>", "File explorer" }, + b = { "<cmd>Telescope buffers<cr>", "Find buffer" }, + w = { "<cmd>write!<cr>", "Save file" }, + q = { "<cmd>quit!<cr>", "Quit" }, + c = { "<cmd>bdelete<cr>", "Close buffer" }, + h = { "<cmd>nohlsearch<cr>", "No hl" }, + n = { "<cmd>e! /tmp/note.md<cr>", "Note" }, + s = { + name = "Search", + t = { "<cmd>Telescope live_grep<cr>", "Live grep" }, + r = { "<cmd>Telescope oldfiles<cr>", "Find oldfile" }, + b = { "<cmd>Telescope git_branches<cr>", "Git branches" }, + c = { "<cmd>Telescope git_commits<cr>", "Git commits" }, + s = { "<cmd>Telescope spell_suggest<cr>", "Spell suggest" }, + k = { "<cmd>Telescope keymaps<cr>", "Find keymap" }, + p = { "<cmd>Telescope projects<cr>", "Projects" }, + }, + l = { + name = "LSP", + a = { "<cmd>Telescope lsp_code_actions<cr>", "Code actions" }, + d = { "<cmd>TroubleToggle<cr>", "Diagnostics" }, + r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" }, + f = { "<cmd>lua vim.lsp.buf.formatting()<cr>", "Formatting" }, + i = { "<cmd>LspInfo<cr>", "Info" }, + R = { "<cmd>LspRestart<cr>", "Restart server" }, + s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" }, + l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" }, + j = { "<cmd>lua vim.diagnostic.goto_next()<cr>", "Next Diagnostic" }, + q = { "<cmd>lua vim.diagnostic.setloclist()<cr>", "Quickfix" }, + k = { "<cmd>lua vim.diagnostic.goto_prev()<cr>", "Prev Diagnostic" }, + }, + g = { + name = "git", + g = { "<cmd>Neogit<cr>", "Neogit" }, + s = { "<cmd>lua require[[gitsigns]].stage_hunk()<cr>", "Stage hunk" }, + r = { "<cmd>lua require[[gitsigns]].reset_hunk()<cr>", "Reset hunk" }, + p = { "<cmd>lua require[[gitsigns]].preview_hunk()<cr>", "Preview hunk" }, + b = { "<cmd>lua require[[gitsigns]].blame_line(true)<cr>", "Blame line" }, + R = { "<cmd>lua require[[gitsigns]].reset_buffer()<cr>", "Reset buffer" }, + S = { "<cmd>lua require[[gitsigns]].stage_buffer()<cr>", "Stage buffer" }, + }, + p = { + name = "Packer", + s = { "<cmd>PackerSync<cr>", "Sync" }, + i = { "<cmd>PackerInstall<cr>", "Install" }, + c = { "<cmd>PackerCompile<cr>", "Compile" }, + C = { "<cmd>PackerClean<cr>", "Clean" }, + }, +} -return M +wk.register(mappings, opts)
M lua/utils.lua

@@ -1,9 +1,11 @@

local M = {} -M.opts = { noremap = true, silent = true } +function M.get_setup(path) + return string.format("require[[%s]].setup()", path) +end -function M.get_config(name) - return string.format("require[[%s]].setup()", name) +function M.get_config(path) + return string.format("require[[%s]]", path) end return M