From de8abea97224f178816b7b1c44e3c4677555ca9a Mon Sep 17 00:00:00 2001 From: Joshua McCabe Date: Fri, 2 Feb 2024 14:17:48 +0000 Subject: [PATCH 1/3] add custom plugins --- init.lua | 6 ++++-- lazy-lock.json | 33 ++++++++++++++++++++++++++++++++ lua/custom/plugins/autopairs.lua | 17 ++++++++++++++++ lua/custom/plugins/filetree.lua | 15 +++++++++++++++ lua/custom/plugins/scrollbar.lua | 6 ++++++ 5 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 lazy-lock.json create mode 100644 lua/custom/plugins/autopairs.lua create mode 100644 lua/custom/plugins/filetree.lua create mode 100644 lua/custom/plugins/scrollbar.lua diff --git a/init.lua b/init.lua index 6c6ae020bcd..ec89794de84 100644 --- a/init.lua +++ b/init.lua @@ -271,7 +271,7 @@ require('lazy').setup({ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] @@ -346,6 +346,7 @@ vim.api.nvim_create_autocmd('TextYankPost', { -- See `:help telescope` and `:help telescope.setup()` require('telescope').setup { defaults = { + vimgrep_arguments = { 'rg', '--hidden', '--color=never', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' }, mappings = { i = { [''] = false, @@ -579,7 +580,8 @@ local servers = { -- rust_analyzer = {}, -- tsserver = {}, -- html = { filetypes = { 'html', 'twig', 'hbs'} }, - + phpactor = {}, + -- intelephense = {}, lua_ls = { Lua = { workspace = { checkThirdParty = false }, diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000000..ef5a334ebc2 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,33 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "82108e7e31cc6fc223cc5df5cae6d89f70bb199f" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "fidget.nvim": { "branch": "main", "commit": "3a93300c076109d86c7ce35ec67a8034ae6ba9db" }, + "friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" }, + "gitsigns.nvim": { "branch": "main", "commit": "4aaacbf5e5e2218fd05eb75703fe9e0f85335803" }, + "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" }, + "mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" }, + "neo-tree.nvim": { "branch": "main", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" }, + "neodev.nvim": { "branch": "main", "commit": "66b58c47dc393700c3523067d9d12879a1a528dd" }, + "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, + "nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-lspconfig": { "branch": "master", "commit": "7eed8b2150192e5ad05e1886fdf133493ddf2928" }, + "nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" }, + "nvim-treesitter": { "branch": "master", "commit": "97ba59c6f532072e456b3d1f2413560e689c132b" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" }, + "nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" }, + "onedark.nvim": { "branch": "master", "commit": "dc3bad0121298f89b50aaff8599d1946e07eb4c2" }, + "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 00000000000..3f3d9789419 --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,17 @@ +-- File: lua/custom/plugins/autopairs.lua + +return { + "windwp/nvim-autopairs", + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require("nvim-autopairs").setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) + end, +} diff --git a/lua/custom/plugins/filetree.lua b/lua/custom/plugins/filetree.lua new file mode 100644 index 00000000000..55580ad2ac2 --- /dev/null +++ b/lua/custom/plugins/filetree.lua @@ -0,0 +1,15 @@ +-- Unless you are still migrating, remove the deprecated commands from v1.x +vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) + +return { + "nvim-neo-tree/neo-tree.nvim", + version = "*", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function () + require('neo-tree').setup {} + end, +} diff --git a/lua/custom/plugins/scrollbar.lua b/lua/custom/plugins/scrollbar.lua new file mode 100644 index 00000000000..a59d54e7975 --- /dev/null +++ b/lua/custom/plugins/scrollbar.lua @@ -0,0 +1,6 @@ +return { + "petertriho/nvim-scrollbar", + config = function() + require("scrollbar").setup {} + end, +} From 1f2e5c54e94bdd89b8b1fe8efca1fe1987714ff1 Mon Sep 17 00:00:00 2001 From: Joshua McCabe Date: Fri, 2 Feb 2024 22:27:22 +0000 Subject: [PATCH 2/3] change theme to kanagawa --- init.lua | 26 ++++++++++++++++++-------- lazy-lock.json | 30 +++++++++++++++--------------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/init.lua b/init.lua index ec89794de84..d5b4961cbf7 100644 --- a/init.lua +++ b/init.lua @@ -188,18 +188,28 @@ require('lazy').setup({ end, }, }, - + -- { + -- -- Theme inspired by Atom + -- 'navarasu/onedark.nvim', + -- priority = 1000, + -- lazy = false, + -- config = function() + -- require('onedark').setup { + -- -- Set a style preset. 'dark' is default. + -- style = 'warm', -- dark, darker, cool, deep, warm, warmer, light + -- } + -- require('onedark').load() + -- end, + -- }, { -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - lazy = false, + 'rebelot/kanagawa.nvim', config = function() - require('onedark').setup { + require('kanagawa').setup { -- Set a style preset. 'dark' is default. - style = 'dark', -- dark, darker, cool, deep, warm, warmer, light + theme = 'dragon', -- dark, darker, cool, deep, warm, warmer, light } - require('onedark').load() + require('kanagawa').load() end, }, @@ -580,7 +590,7 @@ local servers = { -- rust_analyzer = {}, -- tsserver = {}, -- html = { filetypes = { 'html', 'twig', 'hbs'} }, - phpactor = {}, + -- phpactor = {}, -- intelephense = {}, lua_ls = { Lua = { diff --git a/lazy-lock.json b/lazy-lock.json index ef5a334ebc2..127e4d042ee 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,32 +1,32 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "82108e7e31cc6fc223cc5df5cae6d89f70bb199f" }, + "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "fidget.nvim": { "branch": "main", "commit": "3a93300c076109d86c7ce35ec67a8034ae6ba9db" }, - "friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" }, - "gitsigns.nvim": { "branch": "main", "commit": "4aaacbf5e5e2218fd05eb75703fe9e0f85335803" }, + "fidget.nvim": { "branch": "main", "commit": "1d1042d418ee8cb70d68f1e38db639844331c093" }, + "friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" }, + "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, - "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, - "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" }, - "mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" }, + "kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" }, + "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, + "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2b3d247fce06f53934174f5dfe0362c42d65c00c" }, + "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, "neo-tree.nvim": { "branch": "main", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" }, - "neodev.nvim": { "branch": "main", "commit": "66b58c47dc393700c3523067d9d12879a1a528dd" }, + "neodev.nvim": { "branch": "main", "commit": "2793ba3127c2c93ee486b9072a3ef129eeb950cc" }, "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, "nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, - "nvim-lspconfig": { "branch": "master", "commit": "7eed8b2150192e5ad05e1886fdf133493ddf2928" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac530dfb97e51d82e3b0a7cddbf7a4a7c4c10ff8" }, "nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" }, - "nvim-treesitter": { "branch": "master", "commit": "97ba59c6f532072e456b3d1f2413560e689c132b" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" }, + "nvim-treesitter": { "branch": "master", "commit": "e7ea07e42c478cb466cf96124693b447add84011" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "8edd5a6d96936bdff23333d3bc177481388839e5" }, "nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" }, - "onedark.nvim": { "branch": "master", "commit": "dc3bad0121298f89b50aaff8599d1946e07eb4c2" }, - "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, - "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }, + "vim-fugitive": { "branch": "master", "commit": "f116dcc8e21021e6fbfb6b0a9f8f7b9566d933f4" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } From 69d5a976f85432b45ae8eff52a2956528b7ec8d6 Mon Sep 17 00:00:00 2001 From: Joshua McCabe Date: Mon, 5 Feb 2024 19:28:54 +0100 Subject: [PATCH 3/3] improve neotree --- init.lua | 20 ++++++++++++++++---- lua/custom/plugins/filetree.lua | 14 +++++++++++++- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index d5b4961cbf7..b285d3392d2 100644 --- a/init.lua +++ b/init.lua @@ -206,8 +206,7 @@ require('lazy').setup({ 'rebelot/kanagawa.nvim', config = function() require('kanagawa').setup { - -- Set a style preset. 'dark' is default. - theme = 'dragon', -- dark, darker, cool, deep, warm, warmer, light + theme = 'dragon', -- wave, dragon, lotus } require('kanagawa').load() end, @@ -294,6 +293,9 @@ vim.o.hlsearch = false -- Make line numbers default vim.wo.number = true +-- Make relative numbers default +vim.wo.relativenumber = true + -- Enable mouse mode vim.o.mouse = 'a' @@ -325,6 +327,8 @@ vim.o.completeopt = 'menuone,noselect' -- NOTE: You should make sure your terminal supports this vim.o.termguicolors = true +vim.o.shiftwidth = 4 +vim.o.tabstop = 4 -- [[ Basic Keymaps ]] -- Keymaps for better default experience @@ -546,6 +550,14 @@ local on_attach = function(_, bufnr) print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, '[W]orkspace [L]ist Folders') + -- Add key map for organising imports + nmap('li', function() + vim.lsp.buf.execute_command({ + command = "_typescript.organizeImports", + arguments = {vim.api.nvim_buf_get_name(0)}, + }) + end, '[L]ay Out [I]mports') + -- Create a command `:Format` local to the LSP buffer vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) vim.lsp.buf.format() @@ -588,10 +600,10 @@ local servers = { -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, - -- tsserver = {}, -- html = { filetypes = { 'html', 'twig', 'hbs'} }, -- phpactor = {}, - -- intelephense = {}, + tsserver = {}, + intelephense = {}, lua_ls = { Lua = { workspace = { checkThirdParty = false }, diff --git a/lua/custom/plugins/filetree.lua b/lua/custom/plugins/filetree.lua index 55580ad2ac2..e1e397b32ab 100644 --- a/lua/custom/plugins/filetree.lua +++ b/lua/custom/plugins/filetree.lua @@ -10,6 +10,18 @@ return { "MunifTanjim/nui.nvim", }, config = function () - require('neo-tree').setup {} + require('neo-tree').setup { + default_component_configs = { + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "󰜌", + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon" + }, + } + } end, }