From 0a90afe6e7e5994685de7b51d64b4d3c67681144 Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Tue, 7 Nov 2023 19:23:28 +1030 Subject: [PATCH] Add lazygit --- .config/nvim/lazy-lock.json | 56 +++---- .config/nvim/lua/tovi/plugins/init.lua | 5 +- .config/nvim/lua/tovi/plugins/lazygit.lua | 7 + .../nvim/lua/tovi/plugins/lsp/lspconfig.lua | 46 +----- .config/nvim/lua/tovi/plugins/lsp/mason.lua | 1 + .config/nvim/lua/tovi/plugins/nvim-go.lua | 14 ++ .config/nvim/lua/tovi/plugins/nvim-tree.lua | 2 + .config/nvim/lua/tovi/plugins/oil.lua | 143 ++++++++++++++++++ 8 files changed, 206 insertions(+), 68 deletions(-) create mode 100644 .config/nvim/lua/tovi/plugins/lazygit.lua create mode 100644 .config/nvim/lua/tovi/plugins/nvim-go.lua create mode 100644 .config/nvim/lua/tovi/plugins/oil.lua diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index a1bb0a9..438ea92 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,46 +1,48 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "1fd22fa96c11573248f9fdd09f25e724c7bb3dd4" }, + "LuaSnip": { "branch": "master", "commit": "a4de64570b9620875c8ea04175cd07ed8e32ac99" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "copilot.vim": { "branch": "release", "commit": "998cf5ab1b85e844c7e8edb864a997e590df7182" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "copilot.vim": { "branch": "release", "commit": "309b3c803d1862d5e84c7c9c5749ae04010123b8" }, "dart-vim-plugin": { "branch": "master", "commit": "928302ec931caf0dcf21835cca284ccd2b192f7b" }, - "dressing.nvim": { "branch": "master", "commit": "c1e1d5fa44fe08811b6ef4aadac2b50e602f9504" }, - "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, + "dressing.nvim": { "branch": "master", "commit": "fe3071330a0720ce3695ac915820c8134b22d1b0" }, + "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, "fugitive-gitlab.vim": { "branch": "master", "commit": "55fed481c0309b3405dd3d72921d687bf36873a8" }, - "gitsigns.nvim": { "branch": "main", "commit": "bdeba1cec3faddd89146690c10b9a87949c0ee66" }, - "go.nvim": { "branch": "master", "commit": "019936780060efc64c0f22a47afd08fbbe82e026" }, - "guihua.lua": { "branch": "master", "commit": "5ad8dba19ce9b9fd8965598984dfdc9c119f97e4" }, - "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, - "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, - "leap.nvim": { "branch": "main", "commit": "5efe985cf68fac3b6a6dfe7a75fbfaca8db2af9c" }, + "gitsigns.nvim": { "branch": "main", "commit": "af0f583cd35286dd6f0e3ed52622728703237e50" }, + "go.nvim": { "branch": "master", "commit": "ab303d5134946affda0741e2214dd59d763d865e" }, + "guihua.lua": { "branch": "master", "commit": "54bcc1026588e352a16014165b8abcb6eb6d3418" }, + "harpoon": { "branch": "master", "commit": "c1aebbad9e3d13f20bedb8f2ce8b3a94e39e424a" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "lazygit.nvim": { "branch": "main", "commit": "de35012036d43bca03628d40d083f7c02a4cda3f" }, + "leap.nvim": { "branch": "main", "commit": "b6ae80f8fc9993638608fc1a51c6ab0eeb12618c" }, "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, - "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "2451adb9bdb0fd32140bf3aa8dbc17ff60050db3" }, + "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "40301e1c74bc0946eece13edf2b1c561cc497491" }, "mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" }, - "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, + "mason.nvim": { "branch": "main", "commit": "eabf6d347fdb75be360d4c0ced1145670a171453" }, "minintro.nvim": { "branch": "master", "commit": "b150254b4ae85a896175c65debdd25ce7b5fd106" }, - "neotest": { "branch": "master", "commit": "1e67a504d03def3a6a1125d934cb511680f72555" }, + "neotest": { "branch": "master", "commit": "901891484db3d46ce43d56871273dc7d40621356" }, "neotest-go": { "branch": "main", "commit": "1a15e1136db43775214a3e7a598f8930c29c94b7" }, "neotest-phpunit": { "branch": "main", "commit": "e2dfa3280d2a33495a3f710bc364d2cfd1f40c83" }, - "nightfly": { "branch": "master", "commit": "2737ba5b8d22ad6803bb0f51099f90c61bab566c" }, + "nightfly": { "branch": "master", "commit": "06ad2689ebd251a71c6caeb9fb47e231773c9b47" }, "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, - "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, - "nvim-lsp-file-operations": { "branch": "master", "commit": "2abe934ab00a18932f55edfd881555934622fe36" }, - "nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" }, - "nvim-tree.lua": { "branch": "master", "commit": "07eb5b4059aa0a6366c46d5546ff6239dfdc1f03" }, - "nvim-treesitter": { "branch": "master", "commit": "0960322686bfa38afd4f1e0b9660473cf77e24b6" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "1e0ffa0acc92f88f9f2b68df47ccbe1917653a42" }, + "nvim-lspconfig": { "branch": "master", "commit": "37457f268af5cd6765e589b0dcd7cbd192d8da00" }, + "nvim-tree.lua": { "branch": "master", "commit": "0a99c4a23eae8e25285a30d08439aee8da4f5c16" }, + "nvim-treesitter": { "branch": "master", "commit": "96f55f304332ca6ea1b7dde32d3ec04b5298c316" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, - "nvim-web-devicons": { "branch": "master", "commit": "480a756df82a0c231622c9bf2173bb6634713716" }, - "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, + "oil.nvim": { "branch": "master", "commit": "6175bd646272335c8db93264760760d8f2a611d5" }, + "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, - "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, - "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, + "undotree": { "branch": "master", "commit": "170aa9e516b6926e6bddfe21bbf01f2283a00e7d" }, + "vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" }, "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, - "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } } \ No newline at end of file diff --git a/.config/nvim/lua/tovi/plugins/init.lua b/.config/nvim/lua/tovi/plugins/init.lua index cc2491a..54d8f22 100644 --- a/.config/nvim/lua/tovi/plugins/init.lua +++ b/.config/nvim/lua/tovi/plugins/init.lua @@ -1,8 +1,7 @@ return { - "nvim-lua/plenary.nvim", -- lua functions that many plugins use + "nvim-lua/plenary.nvim", + "ray-x/guihua.lua", -- Programming language specific plugins - "ray-x/go.nvim", - "ray-x/guihua.lua", "dart-lang/dart-vim-plugin", } diff --git a/.config/nvim/lua/tovi/plugins/lazygit.lua b/.config/nvim/lua/tovi/plugins/lazygit.lua new file mode 100644 index 0000000..1ae2769 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/lazygit.lua @@ -0,0 +1,7 @@ +return { + "kdheepak/lazygit.nvim", + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, +} diff --git a/.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua b/.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua index c52e4aa..5a22755 100644 --- a/.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua +++ b/.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua @@ -105,47 +105,11 @@ return { on_attach = on_attach, }) - -- configure tailwindcss server - lspconfig["tailwindcss"].setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - - -- configure svelte server - lspconfig["svelte"].setup({ - capabilities = capabilities, - on_attach = function(client, bufnr) - on_attach(client, bufnr) - - vim.api.nvim_create_autocmd("BufWritePost", { - pattern = { "*.js", "*.ts" }, - callback = function(ctx) - if client.name == "svelte" then - client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file }) - end - end, - }) - end, - }) - - -- configure prisma orm server - lspconfig["prismals"].setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - - -- configure graphql language server - lspconfig["graphql"].setup({ - capabilities = capabilities, - on_attach = on_attach, - filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" }, - }) - -- configure emmet language server - lspconfig["emmet_ls"].setup({ + lspconfig["volar"].setup({ capabilities = capabilities, on_attach = on_attach, - filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" }, + filetypes = { "vue" }, }) -- configure php server @@ -160,6 +124,12 @@ return { on_attach = on_attach, }) + -- configure python server + lspconfig["gopls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + -- configure lua server (with special settings) lspconfig["lua_ls"].setup({ capabilities = capabilities, diff --git a/.config/nvim/lua/tovi/plugins/lsp/mason.lua b/.config/nvim/lua/tovi/plugins/lsp/mason.lua index 90d4127..38488ff 100644 --- a/.config/nvim/lua/tovi/plugins/lsp/mason.lua +++ b/.config/nvim/lua/tovi/plugins/lsp/mason.lua @@ -39,6 +39,7 @@ return { "prismals", "pyright", "intelephense", + "gopls", }, -- auto-install configured servers (with lspconfig) automatic_installation = true, -- not the same as ensure_installed diff --git a/.config/nvim/lua/tovi/plugins/nvim-go.lua b/.config/nvim/lua/tovi/plugins/nvim-go.lua new file mode 100644 index 0000000..16e9083 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/nvim-go.lua @@ -0,0 +1,14 @@ +return { + "ray-x/go.nvim", + dependencies = { -- optional packages + "ray-x/guihua.lua", + "neovim/nvim-lspconfig", + "nvim-treesitter/nvim-treesitter", + }, + event = {"CmdlineEnter"}, + ft = {"go", 'gomod'}, + build = ':lua require("go.install").update_all_sync()', + config = function () + require("go").setup() + end +} diff --git a/.config/nvim/lua/tovi/plugins/nvim-tree.lua b/.config/nvim/lua/tovi/plugins/nvim-tree.lua index a9a88b3..86203fe 100644 --- a/.config/nvim/lua/tovi/plugins/nvim-tree.lua +++ b/.config/nvim/lua/tovi/plugins/nvim-tree.lua @@ -6,6 +6,7 @@ return { config = function() local nvimtree = require("nvim-tree") + local nvimtree_api = require("nvim-tree.api") -- recommended settings from nvim-tree documentation vim.g.loaded_netrw = 1 @@ -65,5 +66,6 @@ return { ) -- toggle file explorer on current file keymap.set("n", "ec", "NvimTreeCollapse", { desc = "Collapse file explorer" }) -- collapse file explorer keymap.set("n", "er", "NvimTreeRefresh", { desc = "Refresh file explorer" }) -- refresh file explorer + keymap.set("n", "?", nvimtree_api.tree.toggle_help, { desc = "Toggle nvim tree help" }) end, } diff --git a/.config/nvim/lua/tovi/plugins/oil.lua b/.config/nvim/lua/tovi/plugins/oil.lua new file mode 100644 index 0000000..10606dc --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/oil.lua @@ -0,0 +1,143 @@ +return { + 'stevearc/oil.nvim', + opts = {}, + -- Optional dependencies + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function () + require("oil").setup({ + -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) + -- Set to false if you still want to use netrw. + default_file_explorer = true, + -- Id is automatically added at the beginning, and name at the end + -- See :help oil-columns + columns = { + "icon", + "permissions", + "size", + "mtime", + }, + -- Buffer-local options to use for oil buffers + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + -- Window-local options to use for oil buffers + win_options = { + wrap = false, + signcolumn = "no", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic", + }, + delete_to_trash = false, + -- Skip the confirmation popup for simple operations + skip_confirm_for_simple_edits = false, + prompt_save_on_select_new_entry = true, + -- Oil will automatically delete hidden buffers after this delay + -- You can set the delay to false to disable cleanup entirely + -- Note that the cleanup process only starts when none of the oil buffers are currently displayed + cleanup_delay_ms = 2000, + -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap + -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) + -- Additionally, if it is a string that matches "actions.", + -- it will use the mapping at require("oil.actions"). + -- Set to `false` to remove a keymap + -- See :help oil-actions for a list of all available actions + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = "actions.select_vsplit", + [""] = "actions.select_split", + [""] = "actions.select_tab", + [""] = "actions.preview", + [""] = "actions.close", + [""] = "actions.refresh", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = "actions.tcd", + ["gs"] = "actions.change_sort", + ["gx"] = "actions.open_external", + ["g."] = "actions.toggle_hidden", + }, + -- Set to false to disable all of the above keymaps + use_default_keymaps = true, + view_options = { + -- Show files and directories that start with "." + show_hidden = false, + -- This function defines what is considered a "hidden" file + is_hidden_file = function(name, bufnr) + return vim.startswith(name, ".") + end, + -- This function defines what will never be shown, even when `show_hidden` is set + is_always_hidden = function(name, bufnr) + return false + end, + sort = { + -- sort order can be "asc" or "desc" + -- see :help oil-columns to see which columns are sortable + { "type", "asc" }, + { "name", "asc" }, + }, + }, + -- Configuration for the floating window in oil.open_float + float = { + -- Padding around the floating window + padding = 2, + max_width = 0, + max_height = 0, + border = "rounded", + win_options = { + winblend = 0, + }, + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + override = function(conf) + return conf + end, + }, + -- Configuration for the actions floating preview window + preview = { + -- Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_width and max_width can be a single value or a list of mixed integer/float types. + -- max_width = {100, 0.8} means "the lesser of 100 columns or 80% of total" + max_width = 0.9, + -- min_width = {40, 0.4} means "the greater of 40 columns or 40% of total" + min_width = { 40, 0.4 }, + -- optionally define an integer/float for the exact width of the preview window + width = nil, + -- Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_height and max_height can be a single value or a list of mixed integer/float types. + -- max_height = {80, 0.9} means "the lesser of 80 columns or 90% of total" + max_height = 0.9, + -- min_height = {5, 0.1} means "the greater of 5 columns or 10% of total" + min_height = { 5, 0.1 }, + -- optionally define an integer/float for the exact height of the preview window + height = nil, + border = "rounded", + win_options = { + winblend = 0, + }, + }, + -- Configuration for the floating progress window + progress = { + max_width = 0.9, + min_width = { 40, 0.4 }, + width = nil, + max_height = { 10, 0.9 }, + min_height = { 5, 0.1 }, + height = nil, + border = "rounded", + minimized_border = "none", + win_options = { + winblend = 0, + }, + }, + }) + + vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) + end +}