diff options
Diffstat (limited to 'lua/user')
-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 |
6 files changed, 76 insertions, 67 deletions
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" |