diff options
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | after/plugin/autoclose.lua | 32 | ||||
-rw-r--r-- | after/plugin/harpoon.lua | 22 | ||||
-rw-r--r-- | after/plugin/mini.lua | 8 | ||||
-rw-r--r-- | after/plugin/telescope.lua | 17 | ||||
-rw-r--r-- | after/plugin/vim-tmux-navigator.lua | 10 | ||||
-rw-r--r-- | lua/user/init.lua | 10 | ||||
-rw-r--r-- | lua/user/lazy.lua | 114 | ||||
-rw-r--r-- | lua/user/lsp.lua | 2 | ||||
-rw-r--r-- | lua/user/main.go | 7 | ||||
-rw-r--r-- | lua/user/map.lua | 8 | ||||
-rw-r--r-- | lua/user/set.lua | 2 |
12 files changed, 127 insertions, 112 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6187cee --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +.PHONY: check + +LUA_FILES := $(shell find . -type f -name "*.lua") + +check: + luacheck --no-color --globals=vim -- $(LUA_FILES) + stylua $(LUA_FILES) diff --git a/after/plugin/autoclose.lua b/after/plugin/autoclose.lua index 89078ef..543d7d9 100644 --- a/after/plugin/autoclose.lua +++ b/after/plugin/autoclose.lua @@ -1,20 +1,20 @@ require("autoclose").setup({ - keys = { - ["("] = { escape = false, close = true, pair = "()"}, - ["["] = { escape = false, close = true, pair = "[]"}, - ["{"] = { escape = false, close = true, pair = "{}"}, + keys = { + ["("] = { escape = false, close = true, pair = "()" }, + ["["] = { escape = false, close = true, pair = "[]" }, + ["{"] = { escape = false, close = true, pair = "{}" }, - [">"] = { escape = true, close = false, pair = "<>"}, - [")"] = { escape = true, close = false, pair = "()"}, - ["]"] = { escape = true, close = false, pair = "[]"}, - ["}"] = { escape = true, close = false, pair = "{}"}, + [">"] = { escape = true, close = false, pair = "<>" }, + [")"] = { escape = true, close = false, pair = "()" }, + ["]"] = { escape = true, close = false, pair = "[]" }, + ["}"] = { escape = true, close = false, pair = "{}" }, - ['"'] = { escape = true, close = true, pair = '""'}, - ["'"] = { escape = true, close = true, pair = "''"}, - ["`"] = { escape = true, close = true, pair = "``"}, - }, - options = { - disabled_filetypes = { "text", "telekasten", "groff", "diff", "gitcommit", "fugitive" }, - disable_when_touch = true, - }, + ['"'] = { escape = true, close = true, pair = '""' }, + ["'"] = { escape = true, close = true, pair = "''" }, + ["`"] = { escape = true, close = true, pair = "``" }, + }, + options = { + disabled_filetypes = { "text", "telekasten", "groff", "diff", "gitcommit", "fugitive" }, + disable_when_touch = true, + }, }) diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua index bd5aeef..f7d522a 100644 --- a/after/plugin/harpoon.lua +++ b/after/plugin/harpoon.lua @@ -1,33 +1,33 @@ local harpoon = require("harpoon") +local map = vim.keymap.set -- REQUIRED harpoon:setup() --- REQUIRED -vim.keymap.set("n", "<leader>a", function() - harpoon:list():append() -end, { desc = "Append file to harpoon starred list" }) -vim.keymap.set("n", "<C-e>", function() +map("n", "<C-h>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, { desc = "Check the list of files in harpoon" }) -vim.keymap.set("n", "<C-j>", function() +map("n", " ha", function() + harpoon:list():add() +end, { desc = "Append file to harpoon starred list" }) +map("n", " h1", function() harpoon:list():select(1) end, { desc = "Harpoon to 1st file in list" }) -vim.keymap.set("n", "<C-k>", function() +map("n", " h2", function() harpoon:list():select(2) end, { desc = "Harpoon to 2nd file in list" }) -vim.keymap.set("n", "<C-l>", function() +map("n", " h3", function() harpoon:list():select(3) end, { desc = "Harpoon to 3rd file in list" }) -vim.keymap.set("n", "<C-;>", function() +map("n", " h4", function() harpoon:list():select(4) end, { desc = "Harpoon to 4th file in list" }) -- Toggle previous & next buffers stored within Harpoon list -vim.keymap.set("n", "<C-S-J>", function() +map("n", " hp", function() harpoon:list():prev() end, { desc = "Harpoon to previous file in list" }) -vim.keymap.set("n", "<C-S-K>", function() +map("n", " hn", function() harpoon:list():next() end, { desc = "Harpoon to next file in list" }) diff --git a/after/plugin/mini.lua b/after/plugin/mini.lua index d039e54..8bd6531 100644 --- a/after/plugin/mini.lua +++ b/after/plugin/mini.lua @@ -1,7 +1,3 @@ --- Setup my mini.nvim settings --- mini.nvim is amazing because it add's a lot of functionality while keeping itself as minimal as possible --- because of it's modular nature and fact it has a lot of functionality it lower the amount of needed plugins even for advanced features - -- mini.nvim statusline module require("mini.statusline").setup({ set_vim_settings = false, @@ -11,4 +7,6 @@ require("mini.statusline").setup({ require("mini.comment").setup({}) -- mini.nvim surround module --- require("mini.surround").setup({}) +require("mini.surround").setup({ + silent = true +}) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index a45d5fb..cfefbbc 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -1,10 +1,11 @@ -require('telescope').setup({ +require("telescope").setup({ defaults = { path_display = { shorten = { - len = 3, exclude = {1, -1} + len = 3, + exclude = { 1, -1 }, }, - truncate = true + truncate = true, }, dynamic_preview_title = true, }, @@ -21,11 +22,11 @@ require('telescope').setup({ }, }) -local builtin = require('telescope.builtin') -vim.keymap.set('n', '<leader>ff', builtin.find_files) -vim.keymap.set('n', '<leader><leader>', builtin.buffers) -vim.keymap.set('n', '<leader>fg', builtin.git_files) -vim.keymap.set('n', '<leader>fw', builtin.live_grep) +local builtin = require("telescope.builtin") +vim.keymap.set("n", "<leader>ff", builtin.find_files) +vim.keymap.set("n", "<leader><leader>", builtin.buffers) +vim.keymap.set("n", "<leader>fg", builtin.git_files) +vim.keymap.set("n", "<leader>fw", builtin.live_grep) vim.keymap.set("n", "<C-p>", "<cmd>Telescope git_files<cr>", { desc = "Find git files" }) vim.keymap.set("n", "<leader>vh", builtin.help_tags, { desc = "Find help tags" }) diff --git a/after/plugin/vim-tmux-navigator.lua b/after/plugin/vim-tmux-navigator.lua index c7042fd..0aed3f9 100644 --- a/after/plugin/vim-tmux-navigator.lua +++ b/after/plugin/vim-tmux-navigator.lua @@ -1,6 +1,6 @@ vim.cmd("let g:tmux_navigator_no_mappings = 1") -vim.keymap.set("n", "<M-h>", ":<C-U>TmuxNavigateLeft<cr>", {silent = true}) -vim.keymap.set("n", "<M-j>", ":<C-U>TmuxNavigateDown<cr>", {silent = true}) -vim.keymap.set("n", "<M-k>", ":<C-U>TmuxNavigateUp<cr>", {silent = true}) -vim.keymap.set("n", "<M-l>", ":<C-U>TmuxNavigateRight<cr>", {silent = true}) -vim.keymap.set("n", "<M-/>", ":<C-U>TmuxNavigatePrevious<cr>", {silent = true}) +vim.keymap.set("n", "<M-h>", ":<C-U>TmuxNavigateLeft<cr>", { silent = true }) +vim.keymap.set("n", "<M-j>", ":<C-U>TmuxNavigateDown<cr>", { silent = true }) +vim.keymap.set("n", "<M-k>", ":<C-U>TmuxNavigateUp<cr>", { silent = true }) +vim.keymap.set("n", "<M-l>", ":<C-U>TmuxNavigateRight<cr>", { silent = true }) +vim.keymap.set("n", "<M-/>", ":<C-U>TmuxNavigatePrevious<cr>", { silent = true }) diff --git a/lua/user/init.lua b/lua/user/init.lua index 5892f74..b467dc3 100644 --- a/lua/user/init.lua +++ b/lua/user/init.lua @@ -1,6 +1,7 @@ require("user.set") require("user.map") require("user.lazy") +require("user.lsp") local autocmd = vim.api.nvim_create_autocmd @@ -17,7 +18,7 @@ autocmd("TextYankPost", { }) -- [[ Auto create parent directory if it doesn't exist ]] -autocmd({ "BufWritePre" }, { +autocmd("BufWritePre", { group = augroup("auto_create_dir"), callback = function(event) if event.match:match("^%w%w+://") then @@ -27,3 +28,10 @@ autocmd({ "BufWritePre" }, { vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") end, }) + +autocmd("BufWritePre", { + pattern = "*", + callback = function(args) + require("conform").format({ bufnr = args.buf }) + end, +}) diff --git a/lua/user/lazy.lua b/lua/user/lazy.lua index afac170..6d94783 100644 --- a/lua/user/lazy.lua +++ b/lua/user/lazy.lua @@ -14,7 +14,7 @@ vim.opt.rtp:prepend(lazypath) -- plugins installation and configuration require("lazy").setup({ - -- lsp setup + -- lsp setup { -- LSP Support "neovim/nvim-lspconfig", @@ -32,64 +32,61 @@ require("lazy").setup({ "dcampos/nvim-snippy", -- basic snippet's "honza/vim-snippets", - -- cmp for autocompletion - "hrsh7th/nvim-cmp", - -- cmp nvim-lsp plugin - "hrsh7th/cmp-nvim-lsp", - -- cmp snippy support - "dcampos/cmp-snippy", - -- path comletion - "hrsh7th/cmp-path", - -- kind icons - "onsails/lspkind.nvim", + -- cmp for autocompletion + "hrsh7th/nvim-cmp", + -- cmp nvim-lsp plugin + "hrsh7th/cmp-nvim-lsp", + -- cmp snippy support + "dcampos/cmp-snippy", + -- path comletion + "hrsh7th/cmp-path", + -- kind icons + "onsails/lspkind.nvim", + -- Minimal neovim modules for a lot of things + "echasnovski/mini.nvim", + -- Adds git related signs to the gutter, as well as utilities for managing changes + "lewis6991/gitsigns.nvim", + -- better ntrw + "tpope/vim-vinegar", + -- integration with tmux keybinds + "christoomey/vim-tmux-navigator", + -- auto close brackets + "m4xshen/autoclose.nvim", }, - { - "gbprod/nord.nvim", - lazy = false, - priority = 1000, - config = function() - require("nord").setup({ - transparent = false, - terminal_colors = true, -- `:terminal` - diff = { mode = "bg" }, - borders = true, - -- values : [bg|fg|none] - errors = { mode = "bg" }, - -- values : [vim|vscode] - search = { theme = "vim" }, - styles = { - -- `:help nvim_set_hl` - comments = { italic = true }, - keywords = { bold = true }, - functions = { bold = true }, - variables = { bold = true }, - -- To customize lualine/bufferline - bufferline = { - current = {}, - modified = { italic = true }, - }, - }, - }) - vim.cmd.colorscheme("nord") - end, - }, - install = { - colorscheme = { "nord" }, - }, - - - -- Adds git related signs to the gutter, as well as utilities for managing changes - "lewis6991/gitsigns.nvim", - - -- better ntrw - "tpope/vim-vinegar", - - -- integration with tmux keybinds - "christoomey/vim-tmux-navigator", - - -- auto close brackets - "m4xshen/autoclose.nvim", + { + "gbprod/nord.nvim", + lazy = false, + priority = 1000, + config = function() + require("nord").setup({ + transparent = false, + terminal_colors = true, -- `:terminal` + diff = { mode = "bg" }, + borders = true, + -- values : [bg|fg|none] + errors = { mode = "bg" }, + -- values : [vim|vscode] + search = { theme = "vim" }, + styles = { + -- `:help nvim_set_hl` + comments = { italic = true }, + keywords = { bold = true }, + functions = { bold = true }, + variables = { bold = true }, + -- To customize lualine/bufferline + bufferline = { + current = {}, + modified = { italic = true }, + }, + }, + }) + vim.cmd.colorscheme("nord") + end, + }, + install = { + colorscheme = { "nord" }, + }, -- Fuzzy Finder (files, lsp, etc) { @@ -118,9 +115,6 @@ require("lazy").setup({ requires = { "nvim-lua/plenary.nvim", lazy = true }, }, }, - - -- Minimal neovim modules for a lot of things - { "echasnovski/mini.nvim" }, }, { performance = { rtp = { diff --git a/lua/user/lsp.lua b/lua/user/lsp.lua new file mode 100644 index 0000000..2de41ba --- /dev/null +++ b/lua/user/lsp.lua @@ -0,0 +1,2 @@ +local lspconfig = require("lspconfig") +lspconfig.gopls.setup({}) diff --git a/lua/user/main.go b/lua/user/main.go new file mode 100644 index 0000000..ef25884 --- /dev/null +++ b/lua/user/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello, world!") +} diff --git a/lua/user/map.lua b/lua/user/map.lua index ebcd2ca..a8df1ad 100644 --- a/lua/user/map.lua +++ b/lua/user/map.lua @@ -42,13 +42,12 @@ map({ "n", "v" }, "<leader>P", [["+p]]) map({ "n", "v" }, "<leader>d", [["_d]]) - -- templates vim.keymap.set("n", "<LocalLeader>rt", ":-1r " .. vim.fn.stdpath("config") .. "/templates", { noremap = true }) -- hide all -local s = {hidden_all = 0} -vim.keymap.set("n", "<C-h>", function () +local s = { hidden_all = 0 } +vim.keymap.set("n", "<C-h>", function() s.hidden_all = 1 - s.hidden_all local opt = s.hidden_all == 0 vim.opt.showmode = opt @@ -64,7 +63,7 @@ end, { noremap = true }) vim.keymap.set("n", "<Leader>w", "<cmd>write<cr>", { noremap = true }) vim.keymap.set("n", "<Leader>W", "<cmd>write!<cr>", { noremap = true }) vim.keymap.set("n", "<Leader>e", "<cmd>edit<cr>", { noremap = true }) -vim.keymap.set("n", "<LocalLeader>s", function () +vim.keymap.set("n", "<LocalLeader>s", function() vim.cmd.source() print("sourced.") end, { noremap = true }) @@ -75,4 +74,3 @@ vim.keymap.set("n", "<Leader>P", "<cmd>Lazy<cr>", { noremap = true }) -- spelling vim.keymap.set("n", "<C-s>s", "<cmd>setlocal spell!<cr>", { noremap = true }) vim.keymap.set("n", "<C-s>g", "z=1<cr><cr>", { noremap = true }) - diff --git a/lua/user/set.lua b/lua/user/set.lua index 9f526f4..cb8dba4 100644 --- a/lua/user/set.lua +++ b/lua/user/set.lua @@ -90,7 +90,7 @@ opt.formatoptions = "cqrnj" -- Get the current working directory, replace the $HOME portion of the path with ~, -- and extract the last three directories -local cwd = vim.fn.getcwd():gsub(os.getenv('HOME'), '~') +local cwd = vim.fn.getcwd():gsub(os.getenv("HOME"), "~") local last_dirs = string.match(cwd, "[^/]+/[^/]+/[^/]+/?$") if last_dirs then opt.titlestring = last_dirs .. " -> %t" |