diff --git a/init.lua b/init.lua index b98ffc61..ab49bcd5 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.o.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.o.relativenumber = true +vim.o.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' @@ -173,6 +173,9 @@ vim.o.confirm = true -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') +-- Shortcut to open Lazy menu +vim.keymap.set('n', 'l', 'Lazy') + -- Diagnostic keymaps vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) @@ -459,6 +462,11 @@ require('lazy').setup({ vim.keymap.set('n', 'sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' }) + + -- Shortcut to open neo-tree explorer + vim.keymap.set('n', 'e', function() + vim.cmd ':Neotree' + end, { desc = 'Open file explorer' }) end, }, @@ -977,14 +985,14 @@ require('lazy').setup({ -- require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/plugins/filesystem.lua b/lua/custom/plugins/filesystem.lua new file mode 100644 index 00000000..aa501449 --- /dev/null +++ b/lua/custom/plugins/filesystem.lua @@ -0,0 +1,30 @@ +-- File navigation using neo-tree +return { + 'nvim-neo-tree/neo-tree.nvim', + branch = 'v3.x', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + 'MunifTanjim/nui.nvim', + -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information + }, + lazy = false, -- neo-tree will lazily load itself + ---@module "neo-tree" + ---@type neotree.Config? + config = function() + require('neo-tree').setup { + event_handlers = { + { + event = 'file_open_requested', + handler = function() + -- auto close + vim.cmd 'Neotree close' + end, + }, + }, + } + end, + opts = { + -- fill any relevant options here + }, +} diff --git a/lua/custom/plugins/git.lua b/lua/custom/plugins/git.lua new file mode 100644 index 00000000..da71044d --- /dev/null +++ b/lua/custom/plugins/git.lua @@ -0,0 +1,21 @@ +-- lazygit integration into nvim +return { + 'kdheepak/lazygit.nvim', + lazy = true, + cmd = { + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', + }, + -- optional for floating window border decoration + dependencies = { + 'nvim-lua/plenary.nvim', + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { 'gg', 'LazyGit', desc = 'LazyGit' }, + }, +} diff --git a/lua/custom/plugins/markdown.lua b/lua/custom/plugins/markdown.lua new file mode 100644 index 00000000..76aed403 --- /dev/null +++ b/lua/custom/plugins/markdown.lua @@ -0,0 +1,9 @@ +return { + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = {}, +} diff --git a/lua/custom/plugins/misc.lua b/lua/custom/plugins/misc.lua new file mode 100644 index 00000000..92d9e2f6 --- /dev/null +++ b/lua/custom/plugins/misc.lua @@ -0,0 +1,25 @@ +return { + { + 'goolord/alpha-nvim', + config = function() + local dashboard = require 'alpha.themes.dashboard' + local title = { + '███╗░░░███╗░█████╗░███████╗░█████╗░██╗░░░██╗░░░███╗░░██╗██╗░░░██╗██╗███╗░░░███╗', + '████╗░████║██╔══██╗╚════██║██╔══██╗██║░░░██║░░░████╗░██║██║░░░██║██║████╗░████║', + '██╔████╔██║███████║░░███╔═╝██║░░██║╚██╗░██╔╝░░░██╔██╗██║╚██╗░██╔╝██║██╔████╔██║', + '██║╚██╔╝██║██╔══██║██╔══╝░░██║░░██║░╚████╔╝░░░░██║╚████║░╚████╔╝░██║██║╚██╔╝██║', + '██║░╚═╝░██║██║░░██║███████╗╚█████╔╝░░╚██╔╝░░██╗██║░╚███║░░╚██╔╝░░██║██║░╚═╝░██║', + '╚═╝░░░░░╚═╝╚═╝░░╚═╝╚══════╝░╚════╝░░░░╚═╝░░░╚═╝╚═╝░░╚══╝░░░╚═╝░░░╚═╝╚═╝░░░░░╚═╝', + } + dashboard.section.header.val = title + require('alpha').setup(dashboard.opts) + end, + }, + { + 'echansnovski/mini.nvim', + version = false, + }, + { + 'tpope/vim-repeat', + }, +} diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index cbbd22d2..db450f6f 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -34,22 +34,22 @@ return { -- Actions -- visual mode - map('v', 'hs', function() + map('v', 'gs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' }) - map('v', 'hr', function() + map('v', 'gr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' }) -- normal mode - map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) - map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) - map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) - map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) - map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) - map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) - map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) - map('n', 'hD', function() + map('n', 'gs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) + map('n', 'gr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) + map('n', 'gS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) + map('n', 'gu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'gR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) + map('n', 'gp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) + map('n', 'gb', gitsigns.blame_line, { desc = 'git [b]lame line' }) + map('n', 'gd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) + map('n', 'gD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' }) -- Toggles