diff --git a/init.lua b/init.lua index 5bae27c5..a3c9de00 100644 --- a/init.lua +++ b/init.lua @@ -115,7 +115,9 @@ vim.opt.showmode = false -- Sync clipboard between OS and Neovim. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -vim.opt.clipboard = 'unnamedplus' +vim.schedule(function() + vim.opt.clipboard = 'unnamedplus' +end) -- Enable break indent vim.opt.breakindent = true @@ -198,8 +200,8 @@ vim.keymap.set('n', '', 'zz', { desc = 'Center cursor after down half vim.keymap.set('n', '', 'zz', { desc = 'Center cursor after down half up' }) -- buffers -vim.keymap.set("n", "", "bprevious", { desc = "Prev Buffer" }) -vim.keymap.set("n", "", "bnext", { desc = "Next Buffer" }) +vim.keymap.set('n', '', 'bprevious', { desc = 'Prev Buffer' }) +vim.keymap.set('n', '', 'bnext', { desc = 'Next Buffer' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -273,41 +275,40 @@ require('lazy').setup({ { 'tpope/vim-fugitive', - config = function() - vim.keymap.set("n", "gs", vim.cmd.Git) + config = function() + vim.keymap.set('n', 'gs', vim.cmd.Git) - local Sefcik_Fugitive = vim.api.nvim_create_augroup("Sefcik_Fugitive", {}) + local Sefcik_Fugitive = vim.api.nvim_create_augroup('Sefcik_Fugitive', {}) - local autocmd = vim.api.nvim_create_autocmd - autocmd("BufWinEnter", { - group = Sefcik_Fugitive, - pattern = "*", - callback = function() - if vim.bo.ft ~= "fugitive" then - return - end + local autocmd = vim.api.nvim_create_autocmd + autocmd('BufWinEnter', { + group = Sefcik_Fugitive, + pattern = '*', + callback = function() + if vim.bo.ft ~= 'fugitive' then + return + end - local bufnr = vim.api.nvim_get_current_buf() - local opts = {buffer = bufnr, remap = false} - vim.keymap.set("n", "P", function() - vim.cmd.Git('push') - end, opts) + local bufnr = vim.api.nvim_get_current_buf() + local opts = { buffer = bufnr, remap = false } + vim.keymap.set('n', 'P', function() + vim.cmd.Git 'push' + end, opts) - -- rebase always - vim.keymap.set("n", "p", function() - vim.cmd.Git({'pull', '--rebase'}) - end, opts) + -- rebase always + vim.keymap.set('n', 'p', function() + vim.cmd.Git { 'pull', '--rebase' } + end, opts) - -- NOTE: It allows me to easily set the branch i am pushing and any tracking - -- needed if i did not set the branch up correctly - vim.keymap.set("n", "t", ":Git push -u origin ", opts); - end, - }) + -- NOTE: It allows me to easily set the branch i am pushing and any tracking + -- needed if i did not set the branch up correctly + vim.keymap.set('n', 't', ':Git push -u origin ', opts) + end, + }) - - vim.keymap.set("n", "gu", "diffget //2") - vim.keymap.set("n", "gh", "diffget //3") - end + vim.keymap.set('n', 'gu', 'diffget //2') + vim.keymap.set('n', 'gh', 'diffget //3') + end, }, -- NOTE: Plugins can also be configured to run Lua code when they are loaded. @@ -329,21 +330,78 @@ require('lazy').setup({ 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' config = function() -- This is the function that runs, AFTER loading - require('which-key').setup() + local wk = require 'which-key' + + wk.setup() -- Document existing key chains - require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['h'] = { name = '[H]arpoon', _ = 'which_key_ignore' }, - ['l'] = { name = '[L]azy Git', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, + wk.add { + { 'c', desc = '[C]ode' }, + { 'd', desc = '[D]ocument' }, + { 'h', desc = '[H]arpoon' }, + { 'l', desc = '[L]azy Git' }, + { 'r', desc = '[R]ename' }, + { 's', desc = '[S]earch' }, + { 'w', desc = '[W]orkspace' }, } end, }, + { -- Useful plugin to show you pending keybinds. + 'folke/which-key.nvim', + event = 'VimEnter', -- Sets the loading event to 'VimEnter' + opts = { + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, + }, + + -- Document existing key chains + spec = { + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + { 'd', group = '[D]ocument' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'h', group = '[H]arpoon' }, + { 'l', group = '[L]azy Git' }, + }, + }, + }, + -- NOTE: Plugins can specify dependencies. -- -- The dependencies are proper plugin specifications as well - anything @@ -522,7 +580,7 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim - 'williamboman/mason.nvim', + { 'williamboman/mason.nvim', config = true }, 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', @@ -889,9 +947,16 @@ require('lazy').setup({ -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. 'catppuccin/nvim', - name = 'catpuccin', + name = 'catppuccin', priority = 1000, -- Make sure to load this before all the other start plugins. init = function() + require('catppuccin').setup { + integrations = { + mini = { + enabled = true, + }, + }, + } -- require('rose-pine').setup { -- disable_background = true, -- styles = { @@ -933,23 +998,48 @@ require('lazy').setup({ -- Simple and easy statusline. -- You could remove this setup call if you don't like it, -- and try some other statusline plugin - local statusline = require 'mini.statusline' + -- local statusline = require 'mini.statusline' -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } + -- statusline.setup { use_icons = vim.g.have_nerd_font } -- You can configure sections in the statusline by overriding their -- default behavior. For example, here we set the section for -- cursor location to LINE:COLUMN ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() - return '%2l/%L:%-2v' - end + -- statusline.section_location = function() + -- return '%2l/%L:%-2v' + -- end -- ... and there is more! -- Check out: https://github.com/echasnovski/mini.nvim end, }, + { + 'nvim-lualine/lualine.nvim', + init = function() + require('lualine').setup { + options = { + icons_enabled = true, + component_separators = '|', + section_separators = '', + }, + sections = { + lualine_c = { + { + 'filename', + path = 1, -- 0: Just the filename + -- 1: Relative path + -- 2: Absolute path + -- 3: Absolute path, with tilde as the home directory + -- 4: Filename and parent dir, with tilde as the home directory + }, + }, + }, + } + end, + }, + { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', @@ -983,12 +1073,41 @@ require('lazy').setup({ { 'max397574/better-escape.nvim', - opts = { - mapping = { 'jk', 'kj' }, - timeout = vim.o.timeoutlen, - clear_empty_lines = false, - keys = '', - }, + config = function() + require('better_escape').setup { + timeout = vim.o.timeoutlen, + mappings = { + i = { + j = { + k = '', + j = '', + }, + }, + c = { + j = { + k = '', + j = '', + }, + }, + t = { + j = { + k = '', + j = '', + }, + }, + v = { + j = { + k = '', + }, + }, + s = { + j = { + k = '', + }, + }, + }, + } + end, }, { @@ -1021,8 +1140,12 @@ require('lazy').setup({ -- 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.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.bufferline' -- 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. @@ -1050,6 +1173,12 @@ require('lazy').setup({ lazy = '💤 ', }, }, + checker = { + -- automatically check for plugin updates + enabled = true, + notify = true, -- get a notification when new updates are found + frequency = 3600, -- check for updates every hour + }, }) -- The line beneath this is called `modeline`. See `:help modeline` diff --git a/lua/kickstart/plugins/bufferline.lua b/lua/kickstart/plugins/bufferline.lua new file mode 100644 index 00000000..41c9f66d --- /dev/null +++ b/lua/kickstart/plugins/bufferline.lua @@ -0,0 +1,12 @@ +return { + 'akinsho/bufferline.nvim', + version = "*", + dependencies = 'nvim-tree/nvim-web-devicons', + config = function() + require('bufferline').setup { + options = { + separator_style = 'slant', + } + } + end, +} diff --git a/lua/kickstart/plugins/indent_line.lua b/lua/kickstart/plugins/indent_line.lua index ed7f2693..cb873c65 100644 --- a/lua/kickstart/plugins/indent_line.lua +++ b/lua/kickstart/plugins/indent_line.lua @@ -6,4 +6,4 @@ return { main = 'ibl', opts = {}, }, -} +} \ No newline at end of file diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 7f0dc42f..907c6bf3 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -47,7 +47,12 @@ return { vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { group = lint_augroup, callback = function() - require('lint').try_lint() + -- Only run the linter in buffers that you can modify in order to + -- avoid superfluous noise, notably within the handy LSP pop-ups that + -- describe the hovered symbol using Markdown. + if vim.opt_local.modifiable:get() then + lint.try_lint() + end end, }) end, diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua new file mode 100644 index 00000000..1f464ae6 --- /dev/null +++ b/lua/kickstart/plugins/neo-tree.lua @@ -0,0 +1,25 @@ +-- Neo-tree is a Neovim plugin to browse the file system +-- https://github.com/nvim-neo-tree/neo-tree.nvim + +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', + }, + cmd = 'Neotree', + keys = { + { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, + }, + opts = { + filesystem = { + window = { + mappings = { + ['\\'] = 'close_window', + }, + }, + }, + }, +} \ No newline at end of file