diff --git a/init.lua b/init.lua index 13c8143d..2e226a31 100644 --- a/init.lua +++ b/init.lua @@ -87,108 +87,9 @@ 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) -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 - --- [[ Setting options ]] --- See `:help vim.opt` --- NOTE: You can change these options as you wish! --- For more options, you can see `:help option-list` - --- Make line numbers default -vim.opt.number = true --- You can also add relative line numbers, to help with jumping. --- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true - --- Enable mouse mode, can be useful for resizing splits for example! -vim.opt.mouse = 'a' - --- Don't show the mode, since it's already in the status line -vim.opt.showmode = false - --- Sync clipboard between OS and Neovim. --- Schedule the setting after `UiEnter` because it can increase startup-time. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' -end) - --- Enable break indent -vim.opt.breakindent = true - --- Save undo history -vim.opt.undofile = true - --- Case-insensitive searching UNLESS \C or one or more capital letters in the search term -vim.opt.ignorecase = true -vim.opt.smartcase = true - --- Keep signcolumn on by default -vim.opt.signcolumn = 'yes' - --- Decrease update time -vim.opt.updatetime = 250 - --- Decrease mapped sequence wait time --- Displays which-key popup sooner -vim.opt.timeoutlen = 300 - --- Configure how new splits should be opened -vim.opt.splitright = true -vim.opt.splitbelow = true - --- Sets how neovim will display certain whitespace characters in the editor. --- See `:help 'list'` --- and `:help 'listchars'` -vim.opt.list = true -vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } - --- Preview substitutions live, as you type! -vim.opt.inccommand = 'split' - --- Show which line your cursor is on -vim.opt.cursorline = true - --- Minimal number of screen lines to keep above and below the cursor. -vim.opt.scrolloff = 10 - --- [[ Basic Keymaps ]] --- See `:help vim.keymap.set()` - --- Clear highlights on search when pressing in normal mode --- See `:help hlsearch` -vim.keymap.set('n', '', 'nohlsearch') - --- Diagnostic keymaps -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) - --- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier --- for people to discover. Otherwise, you normally need to press , which --- is not what someone will guess without a bit more experience. --- --- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping --- or just use to exit terminal mode -vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) - --- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') - --- Keybinds to make split navigation easier. --- Use CTRL+ to switch between windows -- --- See `:help wincmd` for a list of all window commands -vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +require 'custom.options' +require 'custom.keymaps' -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -685,7 +586,7 @@ require('lazy').setup({ -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } + local disable_filetypes = { c = true, cpp = true, javascript = true } local lsp_format_opt if disable_filetypes[vim.bo[bufnr].filetype] then lsp_format_opt = 'never' @@ -764,9 +665,9 @@ require('lazy').setup({ -- No, but seriously. Please read `:help ins-completion`, it is really good! mapping = cmp.mapping.preset.insert { -- Select the [n]ext item - [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_next_item(), -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_prev_item(), -- Scroll the documentation window [b]ack / [f]orward [''] = cmp.mapping.scroll_docs(-4), @@ -775,7 +676,7 @@ require('lazy').setup({ -- Accept ([y]es) the completion. -- This will auto-import if your LSP supports it. -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.confirm { select = true }, -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines @@ -919,17 +820,17 @@ require('lazy').setup({ -- -- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', + 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. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua new file mode 100644 index 00000000..2d706979 --- /dev/null +++ b/lua/custom/keymaps.lua @@ -0,0 +1,34 @@ +-- [[ Basic Keymaps ]] +-- See `:help vim.keymap.set()` + +-- Clear highlights on search when pressing in normal mode +-- See `:help hlsearch` +vim.keymap.set('n', '', 'nohlsearch') + +-- Diagnostic keymaps +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier +-- for people to discover. Otherwise, you normally need to press , which +-- is not what someone will guess without a bit more experience. +-- +-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping +-- or just use to exit terminal mode +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) + +-- TIP: Disable arrow keys in normal mode +-- vim.keymap.set('n', '', 'echo "Use h to move!!"') +-- vim.keymap.set('n', '', 'echo "Use l to move!!"') +-- vim.keymap.set('n', '', 'echo "Use k to move!!"') +-- vim.keymap.set('n', '', 'echo "Use j to move!!"') + +-- Keybinds to make split navigation easier. +-- Use CTRL+ to switch between windows +-- +-- See `:help wincmd` for a list of all window commands +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +vim.keymap.set('n', '', ':bnext ', { desc = 'Move focus to the upper window' }) +vim.keymap.set('n', 'e', ':Neotree toggle', { desc = 'Move focus to the upper window' }) diff --git a/lua/custom/options.lua b/lua/custom/options.lua new file mode 100644 index 00000000..505356f9 --- /dev/null +++ b/lua/custom/options.lua @@ -0,0 +1,69 @@ +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 = true + +-- [[ Setting options ]] +-- See `:help vim.opt` +-- NOTE: You can change these options as you wish! +-- For more options, you can see `:help option-list` + +-- Make line numbers default +vim.opt.number = true +-- You can also add relative line numbers, to help with jumping. +-- Experiment for yourself to see if you like it! +vim.opt.relativenumber = true + +-- Enable mouse mode, can be useful for resizing splits for example! +vim.opt.mouse = 'a' + +-- Don't show the mode, since it's already in the status line +vim.opt.showmode = false + +-- Sync clipboard between OS and Neovim. +-- Schedule the setting after `UiEnter` because it can increase startup-time. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.schedule(function() + vim.opt.clipboard = 'unnamedplus' +end) + +-- Enable break indent +vim.opt.breakindent = true + +-- Save undo history +vim.opt.undofile = true + +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Keep signcolumn on by default +vim.opt.signcolumn = 'yes' + +-- Decrease update time +vim.opt.updatetime = 250 + +-- Decrease mapped sequence wait time +-- Displays which-key popup sooner +vim.opt.timeoutlen = 300 + +-- Configure how new splits should be opened +vim.opt.splitright = true +vim.opt.splitbelow = true + +-- Sets how neovim will display certain whitespace characters in the editor. +-- See `:help 'list'` +-- and `:help 'listchars'` +vim.opt.list = true +vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } + +-- Preview substitutions live, as you type! +vim.opt.inccommand = 'split' + +-- Show which line your cursor is on +vim.opt.cursorline = true + +-- Minimal number of screen lines to keep above and below the cursor. +vim.opt.scrolloff = 10 diff --git a/lua/custom/plugins/fugitive.lua b/lua/custom/plugins/fugitive.lua new file mode 100644 index 00000000..b6b4c97b --- /dev/null +++ b/lua/custom/plugins/fugitive.lua @@ -0,0 +1,3 @@ +return { + 'tpope/vim-fugitive', +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..393a5a99 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,40 @@ +return { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local harpoon = require 'harpoon' + + -- REQUIRED + harpoon:setup() + -- REQUIRED + + vim.keymap.set('n', 'a', function() + harpoon:list():add() + end) + vim.keymap.set('n', '', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end) + + -- vim.keymap.set('n', '', function() + -- harpoon:list():select(1) + -- end) + vim.keymap.set('n', '', function() + harpoon:list():select(2) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(3) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(4) + end) + + -- Toggle previous & next buffers stored within Harpoon list + vim.keymap.set('n', '', function() + harpoon:list():prev() + end) + vim.keymap.set('n', '', function() + harpoon:list():next() + end) + end, +} diff --git a/lua/custom/plugins/neogit.lua b/lua/custom/plugins/neogit.lua new file mode 100644 index 00000000..f45b5d43 --- /dev/null +++ b/lua/custom/plugins/neogit.lua @@ -0,0 +1,12 @@ +return { + 'NeogitOrg/neogit', + dependencies = { + 'nvim-lua/plenary.nvim', -- required + 'sindrets/diffview.nvim', -- optional - Diff integration + + -- Only one of these is needed, not both. + 'nvim-telescope/telescope.nvim', -- optional + -- "ibhagwan/fzf-lua", -- optional + }, + config = true, +} diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index ca9bc237..0d3694c4 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -6,7 +6,7 @@ return { config = function() local lint = require 'lint' lint.linters_by_ft = { - markdown = { 'markdownlint' }, + -- markdown = { 'markdownlint' }, } -- To allow other plugins to add linters to require('lint').linters_by_ft,