From 9ee1e9b217a6dddf1c6d302a135945ba8cf80ea0 Mon Sep 17 00:00:00 2001 From: Robert Gant Date: Sat, 28 Dec 2024 22:34:57 -0600 Subject: [PATCH 1/4] feat: Add custom plugins for bufferline, lualine, nvim-tree, and tmux navigator --- init.lua | 119 ++++---------------------- lua/custom/plugins/bufferline.lua | 19 ++++ lua/custom/plugins/init.lua | 8 +- lua/custom/plugins/lualine.lua | 13 +++ lua/custom/plugins/nvim-tree.lua | 26 ++++++ lua/custom/plugins/tmux_navigator.lua | 17 ++++ 6 files changed, 99 insertions(+), 103 deletions(-) create mode 100644 lua/custom/plugins/bufferline.lua create mode 100644 lua/custom/plugins/lualine.lua create mode 100644 lua/custom/plugins/nvim-tree.lua create mode 100644 lua/custom/plugins/tmux_navigator.lua diff --git a/init.lua b/init.lua index 08717d537e6..fbccf0e958e 100644 --- a/init.lua +++ b/init.lua @@ -1,89 +1,3 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== - -What is Kickstart? - - Kickstart.nvim is *not* a distribution. - - Kickstart.nvim is a starting point for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving Kickstart just the way it is for a while - or immediately breaking it into modular pieces. It's up to you! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example which will only take 10-15 minutes: - - https://learnxinyminutes.com/docs/lua/ - - After understanding a bit more about Lua, you can use `:help lua-guide` as a - reference for how Neovim integrates Lua. - - :help lua-guide - - (or HTML version): https://neovim.io/doc/user/lua-guide.html - -Kickstart Guide: - - TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. - - If you don't know what this means, type the following: - - - - : - - Tutor - - - - (If you already know the Neovim basics, you can skip this step.) - - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua. - - Next, run AND READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. - - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite Neovim features. - - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not exactly sure of what you're looking for. - - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or Neovim features used in Kickstart. - - NOTE: Look for lines like this - - Throughout the file. These are for you, the reader, to help you understand what is happening. - Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your Neovim config. - -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now! :) ---]] - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) @@ -91,7 +5,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.opt` @@ -164,6 +78,8 @@ vim.opt.scrolloff = 10 -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') +-- -- Map pf to open the default file explorer +-- vim.keymap.set('n', 'pf', ':Explore', { desc = '[P]roject [F]iles Explorer' }) -- Diagnostic keymaps vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) @@ -230,7 +146,6 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following -- keys can be used to configure plugin behavior/loading/etc. @@ -398,10 +313,10 @@ require('lazy').setup({ -- Enable Telescope extensions if they are installed pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') - -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) @@ -615,17 +530,17 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, + clangd = {}, + gopls = {}, + pyright = {}, + rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, + ts_ls = {}, -- lua_ls = { @@ -789,7 +704,7 @@ require('lazy').setup({ -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.confirm { select = true }, --[''] = cmp.mapping.select_next_item(), --[''] = cmp.mapping.select_prev_item(), @@ -927,18 +842,18 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', - -- 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.debug', + 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 -- 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/bufferline.lua b/lua/custom/plugins/bufferline.lua new file mode 100644 index 00000000000..d889929a2e4 --- /dev/null +++ b/lua/custom/plugins/bufferline.lua @@ -0,0 +1,19 @@ +return { + "akinsho/bufferline.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("bufferline").setup({ + options = { + separator_style = "slant", -- Modern separator style + diagnostics = "nvim_lsp", -- Show LSP diagnostics in tabs + show_buffer_icons = true, -- File type icons in tabs + show_buffer_close_icons = false, -- Disable close icons + offsets = { + { filetype = "NvimTree", text = "File Explorer", highlight = "Directory", text_align = "left" }, + }, + }, + }) + vim.keymap.set("n", "", ":BufferLineCycleNext", { desc = "Next buffer" }) + vim.keymap.set("n", "", ":BufferLineCyclePrev", { desc = "Previous buffer" }) + end, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8d7a..5624925f6e5 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,10 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +return { + -- other plugins + { + 'christoomey/vim-tmux-navigator', + lazy = false, -- Load immediately + }, +} diff --git a/lua/custom/plugins/lualine.lua b/lua/custom/plugins/lualine.lua new file mode 100644 index 00000000000..c88fde7ae12 --- /dev/null +++ b/lua/custom/plugins/lualine.lua @@ -0,0 +1,13 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("lualine").setup({ + options = { + theme = "tokyonight", -- Use the same theme as your colorscheme + section_separators = { left = "", right = "" }, + component_separators = { left = "", right = "" }, + }, + }) + end, +} diff --git a/lua/custom/plugins/nvim-tree.lua b/lua/custom/plugins/nvim-tree.lua new file mode 100644 index 00000000000..1400678cc29 --- /dev/null +++ b/lua/custom/plugins/nvim-tree.lua @@ -0,0 +1,26 @@ +return { + 'nvim-tree/nvim-tree.lua', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('nvim-tree').setup { + view = { + width = 30, + side = 'left', + }, + renderer = { + highlight_opened_files = 'all', + icons = { + glyphs = { + default = '', + folder = { + arrow_closed = '', + arrow_open = '', + }, + }, + }, + }, + } + vim.keymap.set('n', 'pf', ':NvimTreeToggle', { desc = 'Toggle file explorer' }) + vim.keymap.set('n', 'e', ':NvimTreeFocus', { desc = 'Focus nvim-tree' }) + end, +} diff --git a/lua/custom/plugins/tmux_navigator.lua b/lua/custom/plugins/tmux_navigator.lua new file mode 100644 index 00000000000..588522631dc --- /dev/null +++ b/lua/custom/plugins/tmux_navigator.lua @@ -0,0 +1,17 @@ +return { + 'christoomey/vim-tmux-navigator', + cmd = { + 'TmuxNavigateLeft', + 'TmuxNavigateDown', + 'TmuxNavigateUp', + 'TmuxNavigateRight', + 'TmuxNavigatePrevious', + }, + keys = { + { '', 'TmuxNavigateLeft' }, + { '', 'TmuxNavigateDown' }, + { '', 'TmuxNavigateUp' }, + { '', 'TmuxNavigateRight' }, + { '', 'TmuxNavigatePrevious' }, + }, +} From 5f21eddeb46216d489ac401d1dbd75a03a4f41bd Mon Sep 17 00:00:00 2001 From: Robert Gant Date: Sat, 28 Dec 2024 22:50:54 -0600 Subject: [PATCH 2/4] gfdg From 95e35d4b5901d88bef3ebb4becf1b8419dc78d87 Mon Sep 17 00:00:00 2001 From: Robert Gant Date: Sat, 28 Dec 2024 22:53:15 -0600 Subject: [PATCH 3/4] fix: Correct comment typo in init.lua --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index fbccf0e958e..7907340774f 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,5 @@ -- Set as the leader key --- See `:help mapleader` +-- See `:help mapleader`fdfdfd -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' From a8e2f92c4b5034782c603c92957f952544ac13a0 Mon Sep 17 00:00:00 2001 From: Robert Gant Date: Sun, 29 Dec 2024 21:48:57 -0600 Subject: [PATCH 4/4] please dont break --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index a9797aea7a8..7634003f57b 100644 --- a/init.lua +++ b/init.lua @@ -7,7 +7,7 @@ vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = true --- [[ Setting options ]] +-- [[ Setting options ]] remove after git fixed -- See `:help vim.opt` -- NOTE: You can change these options as you wish! -- For more options, you can see `:help option-list`