diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 63b0a5c7..2bd9cad6 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -12,9 +12,8 @@ if not vim.loop.fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) -local plugins = require "plugins" -local opts = require "config.lazy" -require("lazy").setup(plugins, opts) +vim.g.mapleader = " " +require("lazy").setup("plugins") -- Set vim options require "options" diff --git a/config/nvim/lua/colours.lua b/config/nvim/lua/colours.lua index d06120f7..e69de29b 100644 --- a/config/nvim/lua/colours.lua +++ b/config/nvim/lua/colours.lua @@ -1,11 +0,0 @@ -vim.opt.fillchars:append { - horiz = "━", - horizup = "┻", - horizdown = "┳", - vert = "┃", - vertleft = "┨", - vertright = "┣", - verthoriz = "╋", -} -require "config.catppuccin" -vim.cmd "colorscheme catppuccin" diff --git a/config/nvim/lua/config/catppuccin.lua b/config/nvim/lua/config/catppuccin.lua deleted file mode 100644 index 42bf058c..00000000 --- a/config/nvim/lua/config/catppuccin.lua +++ /dev/null @@ -1,22 +0,0 @@ -require("catppuccin").setup { - flavour = "macchiato", - transparent_background = true, - term_colors = true, - integrations = { - gitsigns = true, - indent_blankline = { - enabled = true, - colored_indent_levels = true, - }, - cmp = true, - native_lsp = { - enabled = true, - }, - notify = true, - nvimtree = true, - treesitter = true, - treesitter_context = true, - telescope = true, - lsp_trouble = true, - }, -} diff --git a/config/nvim/lua/config/diffview.lua b/config/nvim/lua/config/diffview.lua deleted file mode 100644 index b1acdbeb..00000000 --- a/config/nvim/lua/config/diffview.lua +++ /dev/null @@ -1,6 +0,0 @@ -require("diffview").setup { - enhanced_diff_hl = true, - file_panel = { - listing_style = "list", - }, -} diff --git a/config/nvim/lua/config/feline.lua b/config/nvim/lua/config/feline.lua deleted file mode 100644 index bb4dea5d..00000000 --- a/config/nvim/lua/config/feline.lua +++ /dev/null @@ -1,2 +0,0 @@ -local components = require("config.catppuccin_feline").get() -require("feline").setup { components = components } diff --git a/config/nvim/lua/config/gitsigns.lua b/config/nvim/lua/config/gitsigns.lua deleted file mode 100644 index d29144b0..00000000 --- a/config/nvim/lua/config/gitsigns.lua +++ /dev/null @@ -1,45 +0,0 @@ -require("gitsigns").setup { - signcolumn = true, - numhl = true, - linehl = false, - current_line_blame = true, - word_diff = false, - on_attach = function(bufnr) - local gs = package.loaded.gitsigns - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map("n", "]c", function() - if vim.wo.diff then return "]c" end - vim.schedule(function() gs.next_hunk() end) - return "" - end, { expr = true }) - - map("n", "[c", function() - if vim.wo.diff then return "[c" end - vim.schedule(function() gs.prev_hunk() end) - return "" - end, { expr = true }) - - -- Actions - map({ "n", "v" }, "hs", ":Gitsigns stage_hunk") - map({ "n", "v" }, "hr", ":Gitsigns reset_hunk") - map("n", "hS", gs.stage_buffer) - map("n", "hu", gs.undo_stage_hunk) - map("n", "hR", gs.reset_buffer) - map("n", "hp", gs.preview_hunk) - map("n", "hb", function() gs.blame_line { full = true } end) - map("n", "tb", gs.toggle_current_line_blame) - map("n", "hd", gs.diffthis) - map("n", "hD", function() gs.diffthis "~" end) - map("n", "td", gs.toggle_deleted) - - -- Text object - map({ "o", "x" }, "ih", ":Gitsigns select_hunk") - end, -} diff --git a/config/nvim/lua/config/indent_blankline.lua b/config/nvim/lua/config/indent_blankline.lua deleted file mode 100644 index 856c9714..00000000 --- a/config/nvim/lua/config/indent_blankline.lua +++ /dev/null @@ -1,12 +0,0 @@ -require("indent_blankline").setup { - show_current_context = true, - show_current_context_start = false, - char_highlight_list = { - "IndentBlanklineIndent1", - "IndentBlanklineIndent2", - "IndentBlanklineIndent3", - "IndentBlanklineIndent4", - "IndentBlanklineIndent5", - "IndentBlanklineIndent6", - }, -} diff --git a/config/nvim/lua/config/lazy.lua b/config/nvim/lua/config/lazy.lua deleted file mode 100644 index 6d328143..00000000 --- a/config/nvim/lua/config/lazy.lua +++ /dev/null @@ -1,10 +0,0 @@ -local M = { - install = { - colorscheme = { - "catppuccin", - "habamax", - "default", - }, - }, -} -return M diff --git a/config/nvim/lua/config/neotree.lua b/config/nvim/lua/config/neotree.lua deleted file mode 100644 index 348a5add..00000000 --- a/config/nvim/lua/config/neotree.lua +++ /dev/null @@ -1,21 +0,0 @@ -vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]] -require("neo-tree").setup { - close_if_last_window = true, - filesystem = { - filtered_items = { - hide_dotfiles = false, - }, - group_empty_dirs = true, - }, - buffers = { - follow_current_file = true, - group_empty_dirs = true, - }, - git_status = { - group_empty_dirs = true, - }, - source_selector = { - winbar = true, - statusline = false, - }, -} diff --git a/config/nvim/lua/config/nvim-test.lua b/config/nvim/lua/config/nvim-test.lua deleted file mode 100644 index 4deb41b7..00000000 --- a/config/nvim/lua/config/nvim-test.lua +++ /dev/null @@ -1,6 +0,0 @@ -require("nvim-test").setup { - termOpts = { - direction = "horizontal", - keep_one = true, - }, -} diff --git a/config/nvim/lua/config/onedarkpro.lua b/config/nvim/lua/config/onedarkpro.lua deleted file mode 100644 index 7a8be2e5..00000000 --- a/config/nvim/lua/config/onedarkpro.lua +++ /dev/null @@ -1,5 +0,0 @@ -require("onedarkpro").setup { - options = { - transparency = true, - }, -} diff --git a/config/nvim/lua/config/tabby.lua b/config/nvim/lua/config/tabby.lua deleted file mode 100644 index e69de29b..00000000 diff --git a/config/nvim/lua/config/telescope.lua b/config/nvim/lua/config/telescope.lua deleted file mode 100644 index cbae1feb..00000000 --- a/config/nvim/lua/config/telescope.lua +++ /dev/null @@ -1,31 +0,0 @@ -require "telescope.actions" -local trouble = require "trouble.providers.telescope" - -require("telescope").setup { - extensions = { - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- the default case_mode is "smart_case" - }, - aerial = { - show_nesting = { - ["_"] = false, - python = true, - json = true, - yaml = true, - }, - }, - }, - defaults = { - mappings = { - i = { [""] = trouble.open_with_trouble }, - n = { [""] = trouble.open_with_trouble }, - }, - }, -} - -require("telescope").load_extension "fzf" -require("telescope").load_extension "notify" diff --git a/config/nvim/lua/config/treesitter.lua b/config/nvim/lua/config/treesitter.lua deleted file mode 100644 index 97dce779..00000000 --- a/config/nvim/lua/config/treesitter.lua +++ /dev/null @@ -1,7 +0,0 @@ -require("nvim-treesitter.configs").setup { - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - disable = { "fortran" }, - }, -} diff --git a/config/nvim/lua/config/trouble.lua b/config/nvim/lua/config/trouble.lua deleted file mode 100644 index c0b5d84a..00000000 --- a/config/nvim/lua/config/trouble.lua +++ /dev/null @@ -1,7 +0,0 @@ -require("trouble").setup { - mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" - auto_open = false, -- automatically open the list when you have diagnostics - auto_close = false, -- automatically close the list when you have no diagnostics - auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window - auto_jump = { "lsp_definitions", "lsp_references", "lsp_implementations" }, -- for the given modes, automatically jump if there is only a single result -} diff --git a/config/nvim/lua/config/cmp.lua b/config/nvim/lua/lsp/cmp.lua similarity index 100% rename from config/nvim/lua/config/cmp.lua rename to config/nvim/lua/lsp/cmp.lua diff --git a/config/nvim/lua/config/lsp.lua b/config/nvim/lua/lsp/init.lua similarity index 100% rename from config/nvim/lua/config/lsp.lua rename to config/nvim/lua/lsp/init.lua diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 80cfbf70..83c7a0a7 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -1,109 +1,3 @@ -local M = { +return { { "folke/lazy.nvim", cmd = "Lazy" }, - { - "catppuccin/nvim", - name = "catppuccin", - lazy = false, - priority = 1000, - config = function() require "colours" end, - }, - { "stevearc/dressing.nvim" }, - { - "feline-nvim/feline.nvim", - config = function() require "config.feline" end, - }, - { - "rcarriga/nvim-notify", - config = function() - require("notify").setup { - background_colour = "#000000", - } - vim.notify = require "notify" - end, - }, - { - "neovim/nvim-lspconfig", - dependencies = { - { "hrsh7th/nvim-cmp" }, - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/cmp-path" }, - { "hrsh7th/cmp-cmdline" }, - { "f3fora/cmp-spell" }, - { "petertriho/cmp-git" }, - { "Dosx001/cmp-commit" }, - { "kdheepak/cmp-latex-symbols" }, - { "L3MON4D3/LuaSnip" }, - { "saadparwaiz1/cmp_luasnip" }, - { "rafamadriz/friendly-snippets" }, - { "windwp/nvim-autopairs" }, - { "jose-elias-alvarez/null-ls.nvim" }, - { "folke/neodev.nvim" }, - }, - config = function() - require "config.lsp" - require "config.cmp" - end, - }, - { - "nvim-treesitter/nvim-treesitter", - config = function() require "config.treesitter" end, - }, - { - "lewis6991/gitsigns.nvim", - config = function() require "config.gitsigns" end, - }, - { - "nvim-neo-tree/neo-tree.nvim", - branch = "v2.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - }, - cmd = "Neotree", - config = function() require "config.neotree" end, - }, - { - "nvim-telescope/telescope.nvim", - branch = "0.1.x", - dependencies = { - { "nvim-lua/plenary.nvim" }, - { - "nvim-telescope/telescope-fzf-native.nvim", - build = "make", - }, - }, - cmd = "Telescope", - config = function() require "config.telescope" end, - }, - { - "folke/trouble.nvim", - dependencies = "nvim-tree/nvim-web-devicons", - cmd = "TroubleToggle", - config = function() require "config.trouble" end, - }, - { - "lukas-reineke/indent-blankline.nvim", - config = function() require "config.indent_blankline" end, - }, - { - "numToStr/Navigator.nvim", - config = function() require("Navigator").setup() end, - }, - { - "klen/nvim-test", - config = function() require "config.nvim-test" end, - }, - { - "numToStr/Comment.nvim", - name = "Comment", - config = function() require "Comment" end, - }, - { - "sindrets/diffview.nvim", - dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" }, - config = function() require "config.diffview" end, - }, } -return M diff --git a/config/nvim/lua/plugins/catppuccin.lua b/config/nvim/lua/plugins/catppuccin.lua new file mode 100644 index 00000000..2e949279 --- /dev/null +++ b/config/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,40 @@ +return { + "catppuccin/nvim", + name = "catppuccin", + lazy = false, + priority = 1000, + config = function() + vim.opt.fillchars:append { + horiz = "━", + horizup = "┻", + horizdown = "┳", + vert = "┃", + vertleft = "┨", + vertright = "┣", + verthoriz = "╋", + } + require("catppuccin").setup { + flavour = "macchiato", + transparent_background = true, + term_colors = true, + integrations = { + gitsigns = true, + indent_blankline = { + enabled = true, + colored_indent_levels = true, + }, + cmp = true, + native_lsp = { + enabled = true, + }, + notify = true, + nvimtree = true, + treesitter = true, + treesitter_context = true, + telescope = true, + lsp_trouble = true, + }, + } + vim.cmd "colorscheme catppuccin" + end, +} diff --git a/config/nvim/lua/plugins/diffview.lua b/config/nvim/lua/plugins/diffview.lua new file mode 100644 index 00000000..b4191821 --- /dev/null +++ b/config/nvim/lua/plugins/diffview.lua @@ -0,0 +1,12 @@ +return { + "sindrets/diffview.nvim", + dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" }, + config = function() + require("diffview").setup { + enhanced_diff_hl = true, + file_panel = { + listing_style = "list", + }, + } + end, +} diff --git a/config/nvim/lua/plugins/dressing.lua b/config/nvim/lua/plugins/dressing.lua new file mode 100644 index 00000000..0bb9abb2 --- /dev/null +++ b/config/nvim/lua/plugins/dressing.lua @@ -0,0 +1 @@ +return { "stevearc/dressing.nvim" } diff --git a/config/nvim/lua/plugins/feline.lua b/config/nvim/lua/plugins/feline.lua new file mode 100644 index 00000000..1ebecc8c --- /dev/null +++ b/config/nvim/lua/plugins/feline.lua @@ -0,0 +1,8 @@ +return { + "feline-nvim/feline.nvim", + dependencies = "catppuccin/nvim", + config = function() + local components = require("ui.catppuccin_feline").get() + require("feline").setup { components = components } + end, +} diff --git a/config/nvim/lua/plugins/gitsigns.lua b/config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 00000000..46c30108 --- /dev/null +++ b/config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,50 @@ +return { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup { + signcolumn = true, + numhl = true, + linehl = false, + current_line_blame = true, + word_diff = false, + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map("n", "]c", function() + if vim.wo.diff then return "]c" end + vim.schedule(function() gs.next_hunk() end) + return "" + end, { expr = true }) + + map("n", "[c", function() + if vim.wo.diff then return "[c" end + vim.schedule(function() gs.prev_hunk() end) + return "" + end, { expr = true }) + + -- Actions + map({ "n", "v" }, "hs", ":Gitsigns stage_hunk") + map({ "n", "v" }, "hr", ":Gitsigns reset_hunk") + map("n", "hS", gs.stage_buffer) + map("n", "hu", gs.undo_stage_hunk) + map("n", "hR", gs.reset_buffer) + map("n", "hp", gs.preview_hunk) + map("n", "hb", function() gs.blame_line { full = true } end) + map("n", "tb", gs.toggle_current_line_blame) + map("n", "hd", gs.diffthis) + map("n", "hD", function() gs.diffthis "~" end) + map("n", "td", gs.toggle_deleted) + + -- Text object + map({ "o", "x" }, "ih", ":Gitsigns select_hunk") + end, + } + end, +} diff --git a/config/nvim/lua/plugins/indent_blankline.lua b/config/nvim/lua/plugins/indent_blankline.lua new file mode 100644 index 00000000..ae83b214 --- /dev/null +++ b/config/nvim/lua/plugins/indent_blankline.lua @@ -0,0 +1,17 @@ +return { + "lukas-reineke/indent-blankline.nvim", + config = function() + require("indent_blankline").setup { + show_current_context = true, + show_current_context_start = false, + char_highlight_list = { + "IndentBlanklineIndent1", + "IndentBlanklineIndent2", + "IndentBlanklineIndent3", + "IndentBlanklineIndent4", + "IndentBlanklineIndent5", + "IndentBlanklineIndent6", + }, + } + end, +} diff --git a/config/nvim/lua/plugins/lspconfig.lua b/config/nvim/lua/plugins/lspconfig.lua new file mode 100644 index 00000000..0aee6514 --- /dev/null +++ b/config/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,25 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + { "hrsh7th/nvim-cmp" }, + { "hrsh7th/cmp-nvim-lsp" }, + { "hrsh7th/cmp-buffer" }, + { "hrsh7th/cmp-path" }, + { "hrsh7th/cmp-cmdline" }, + { "f3fora/cmp-spell" }, + { "petertriho/cmp-git" }, + { "Dosx001/cmp-commit" }, + { "kdheepak/cmp-latex-symbols" }, + { "L3MON4D3/LuaSnip" }, + { "saadparwaiz1/cmp_luasnip" }, + { "rafamadriz/friendly-snippets" }, + { "windwp/nvim-autopairs" }, + { "jose-elias-alvarez/null-ls.nvim" }, + { "folke/neodev.nvim" }, + }, + config = function() + require "lsp.init" + require "lsp.cmp" + end, +} diff --git a/config/nvim/lua/plugins/navigator.lua b/config/nvim/lua/plugins/navigator.lua new file mode 100644 index 00000000..d3ceb4e7 --- /dev/null +++ b/config/nvim/lua/plugins/navigator.lua @@ -0,0 +1,5 @@ +return { + "numToStr/Navigator.nvim", + name = "Navigator", + config = function() require("Navigator").setup() end, +} diff --git a/config/nvim/lua/plugins/neotree.lua b/config/nvim/lua/plugins/neotree.lua new file mode 100644 index 00000000..c52500e1 --- /dev/null +++ b/config/nvim/lua/plugins/neotree.lua @@ -0,0 +1,33 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v2.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + cmd = "Neotree", + config = function() + vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]] + require("neo-tree").setup { + close_if_last_window = true, + filesystem = { + filtered_items = { + hide_dotfiles = false, + }, + group_empty_dirs = true, + }, + buffers = { + follow_current_file = true, + group_empty_dirs = true, + }, + git_status = { + group_empty_dirs = true, + }, + source_selector = { + winbar = true, + statusline = false, + }, + } + end, +} diff --git a/config/nvim/lua/plugins/notify.lua b/config/nvim/lua/plugins/notify.lua new file mode 100644 index 00000000..dd286cfa --- /dev/null +++ b/config/nvim/lua/plugins/notify.lua @@ -0,0 +1,9 @@ +return { + "rcarriga/nvim-notify", + config = function() + require("notify").setup { + background_colour = "#000000", + } + vim.notify = require "notify" + end, +} diff --git a/config/nvim/lua/plugins/nvim-test.lua b/config/nvim/lua/plugins/nvim-test.lua new file mode 100644 index 00000000..7b8782a3 --- /dev/null +++ b/config/nvim/lua/plugins/nvim-test.lua @@ -0,0 +1,11 @@ +return { + "klen/nvim-test", + config = function() + require("nvim-test").setup { + termOpts = { + direction = "horizontal", + keep_one = true, + }, + } + end, +} diff --git a/config/nvim/lua/plugins/telescope.lua b/config/nvim/lua/plugins/telescope.lua new file mode 100644 index 00000000..05804426 --- /dev/null +++ b/config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,46 @@ +return { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + }, + { "rcarriga/nvim-notify" }, + }, + cmd = "Telescope", + config = function() + require "telescope.actions" + local trouble = require "trouble.providers.telescope" + + require("telescope").setup { + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + }, + aerial = { + show_nesting = { + ["_"] = false, + python = true, + json = true, + yaml = true, + }, + }, + }, + defaults = { + mappings = { + i = { [""] = trouble.open_with_trouble }, + n = { [""] = trouble.open_with_trouble }, + }, + }, + } + + require("telescope").load_extension "fzf" + require("telescope").load_extension "notify" + end, +} diff --git a/config/nvim/lua/plugins/treesitter.lua b/config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 00000000..81332ade --- /dev/null +++ b/config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,12 @@ +return { + "nvim-treesitter/nvim-treesitter", + config = function() + require("nvim-treesitter.configs").setup { + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + disable = { "fortran" }, + }, + } + end, +} diff --git a/config/nvim/lua/plugins/trouble.lua b/config/nvim/lua/plugins/trouble.lua new file mode 100644 index 00000000..aa63e42a --- /dev/null +++ b/config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,14 @@ +return { + "folke/trouble.nvim", + dependencies = "nvim-tree/nvim-web-devicons", + cmd = "TroubleToggle", + config = function() + require("trouble").setup { + mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" + auto_open = false, -- automatically open the list when you have diagnostics + auto_close = false, -- automatically close the list when you have no diagnostics + auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window + auto_jump = { "lsp_definitions", "lsp_references", "lsp_implementations" }, -- for the given modes, automatically jump if there is only a single result + } + end, +} diff --git a/config/nvim/lua/config/catppuccin_feline.lua b/config/nvim/lua/ui/catppuccin_feline.lua similarity index 100% rename from config/nvim/lua/config/catppuccin_feline.lua rename to config/nvim/lua/ui/catppuccin_feline.lua