From 60746cda00bdfc2d655e9752b5a30b4ddf60fc5e Mon Sep 17 00:00:00 2001 From: David Francis Date: Thu, 22 Jun 2023 15:49:51 +0100 Subject: [PATCH 01/10] Update init.lua --- init.lua | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/init.lua b/init.lua index c62174516e5..172d2e63139 100644 --- a/init.lua +++ b/init.lua @@ -1,40 +1,3 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== - -Kickstart.nvim is *not* a distribution. - -Kickstart.nvim is a template 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 should start exploring, configuring and tinkering to - explore Neovim! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example: - - https://learnxinyminutes.com/docs/lua/ - - And then you can explore or search through `:help lua-guide` - - -Kickstart Guide: - -I have left several `:help X` comments throughout the init.lua -You should run that command and read that help section for more information. - -In addition, I have some `NOTE:` items throughout the file. -These are for you, the reader to help 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 nvim config. - -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 required (otherwise wrong leader will be used) @@ -210,7 +173,7 @@ require('lazy').setup({ -- NOTE: You can change these options as you wish! -- Set highlight on search -vim.o.hlsearch = false +vim.o.hlsearch = true -- Make line numbers default vim.wo.number = true From 1ba504fa3ef806e4e8dce2980a4a32940109b110 Mon Sep 17 00:00:00 2001 From: David Francis Date: Fri, 23 Jun 2023 14:16:55 +0100 Subject: [PATCH 02/10] Update theme --- init.lua | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 172d2e63139..13a1beeb378 100644 --- a/init.lua +++ b/init.lua @@ -92,13 +92,22 @@ require('lazy').setup({ }, }, + -- { + -- -- Theme inspired by Atom + -- 'navarasu/onedark.nvim', + -- priority = 1000, + -- config = function() + -- vim.cmd.colorscheme 'onedark' + -- end, + -- }, + { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', + "catppuccin/nvim", + name = "catppuccin", priority = 1000, config = function() - vim.cmd.colorscheme 'onedark' - end, + vim.cmd.colorscheme 'catppuccin' -- 'catppuccin-latte', 'catppuccin-frappe', 'catppuccin-macchiato', 'catppuccin-mocha' + end }, { @@ -108,7 +117,7 @@ require('lazy').setup({ opts = { options = { icons_enabled = false, - theme = 'onedark', + theme = 'auto', component_separators = '|', section_separators = '', }, @@ -210,6 +219,10 @@ vim.o.completeopt = 'menuone,noselect' -- NOTE: You should make sure your terminal supports this vim.o.termguicolors = true +vim.o.tabstop = 4 +vim.o.shiftwidth = 4 +vim.o.expandtab = true + -- [[ Basic Keymaps ]] -- Keymaps for better default experience From 1feb6300d701ca686bbbf79e99721de54c8c2456 Mon Sep 17 00:00:00 2001 From: David Francis Date: Fri, 23 Jun 2023 16:30:51 +0100 Subject: [PATCH 03/10] Add git reset hunk keybinding --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index 13a1beeb378..96e76e79e61 100644 --- a/init.lua +++ b/init.lua @@ -87,6 +87,7 @@ require('lazy').setup({ on_attach = function(bufnr) vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) + vim.keymap.set('n', 'rh', require('gitsigns').reset_hunk, { buffer = bufnr, desc = '[R]eset [H]unk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end, }, From 08d77ce84506e4cd45ab7d4e00945b9b4e308625 Mon Sep 17 00:00:00 2001 From: David Francis Date: Fri, 23 Jun 2023 18:26:29 +0100 Subject: [PATCH 04/10] Set scrolloff --- init.lua | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index 96e76e79e61..d83cb5c5571 100644 --- a/init.lua +++ b/init.lua @@ -70,6 +70,10 @@ require('lazy').setup({ }, }, + { + 'github/copilot.vim', + }, + -- Useful plugin to show you pending keybinds. { 'folke/which-key.nvim', opts = {} }, { @@ -93,16 +97,7 @@ require('lazy').setup({ }, }, - -- { - -- -- Theme inspired by Atom - -- 'navarasu/onedark.nvim', - -- priority = 1000, - -- config = function() - -- vim.cmd.colorscheme 'onedark' - -- end, - -- }, - - { + { "catppuccin/nvim", name = "catppuccin", priority = 1000, @@ -224,6 +219,8 @@ vim.o.tabstop = 4 vim.o.shiftwidth = 4 vim.o.expandtab = true +vim.o.scrolloff = 8 + -- [[ Basic Keymaps ]] -- Keymaps for better default experience From dece0db113bd08708ee0b032965bcdf77c13bae5 Mon Sep 17 00:00:00 2001 From: David Francis Date: Sat, 24 Jun 2023 16:17:58 +0100 Subject: [PATCH 05/10] init.lua updates --- init.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index d83cb5c5571..65b8c66b973 100644 --- a/init.lua +++ b/init.lua @@ -97,6 +97,7 @@ require('lazy').setup({ }, }, + -- theme { "catppuccin/nvim", name = "catppuccin", @@ -215,9 +216,10 @@ vim.o.completeopt = 'menuone,noselect' -- NOTE: You should make sure your terminal supports this vim.o.termguicolors = true -vim.o.tabstop = 4 -vim.o.shiftwidth = 4 -vim.o.expandtab = true +-- Think these are set automatically by a plugin instead +-- vim.o.tabstop = 4 +-- vim.o.shiftwidth = 4 +-- vim.o.expandtab = true vim.o.scrolloff = 8 From 503a6e9e74ec11943a9aa7bcb6bafb76a6dc3c00 Mon Sep 17 00:00:00 2001 From: David Francis Date: Mon, 26 Jun 2023 00:25:42 +0100 Subject: [PATCH 06/10] Update system clipboard behaviour --- init.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 65b8c66b973..c3d4ccd89e8 100644 --- a/init.lua +++ b/init.lua @@ -92,7 +92,7 @@ require('lazy').setup({ vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) vim.keymap.set('n', 'rh', require('gitsigns').reset_hunk, { buffer = bufnr, desc = '[R]eset [H]unk' }) - vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) + vim.keymap.set('n', 'vh', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Pre[v]iew [H]unk' }) end, }, }, @@ -188,9 +188,13 @@ vim.wo.number = true vim.o.mouse = 'a' -- Sync clipboard between OS and Neovim. --- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -vim.o.clipboard = 'unnamedplus' +vim.keymap.set({'n', 'v'}, 'y', '"+y', { desc = 'Yank to system clipboard' }) +vim.keymap.set({'n', 'v'}, 'p', '"+p', { desc = 'Paste from system clipboard' }) +vim.keymap.set({'n', 'v'}, 'P', '"+P', { desc = 'Paste from system clipboard' }) +vim.keymap.set('n', 'yy', '"+yy', { desc = 'Yank line to system clipboard' }) +vim.keymap.set('n', 'Y', '"+y$', { desc = 'Yank to end of line to system clipboard' }) +vim.keymap.set('v', 'Y', '"+Y', { desc = 'Yank highlighted lines to system clipboard' }) -- Enable break indent vim.o.breakindent = true From ae96b4bc403d108be2e3e68705631b4f38f1aa74 Mon Sep 17 00:00:00 2001 From: David Francis Date: Tue, 27 Jun 2023 12:46:55 +0100 Subject: [PATCH 07/10] Config for folding --- init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init.lua b/init.lua index c3d4ccd89e8..f91a195d0f0 100644 --- a/init.lua +++ b/init.lua @@ -227,6 +227,12 @@ vim.o.termguicolors = true vim.o.scrolloff = 8 +-- Folding with treesitter +vim.o.foldmethod = 'expr' +vim.o.foldexpr = 'nvim_treesitter#foldexpr()' +vim.o.foldenable = false -- start with all folds open +vim.o.foldlevel = 99 + -- [[ Basic Keymaps ]] -- Keymaps for better default experience From a0ab86aef5fa8625c0567acb4c71ecaa020d1727 Mon Sep 17 00:00:00 2001 From: David Francis Date: Thu, 15 Feb 2024 15:02:20 +0000 Subject: [PATCH 08/10] Remove github copilot plugin --- init.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/init.lua b/init.lua index f91a195d0f0..c233d0664ab 100644 --- a/init.lua +++ b/init.lua @@ -70,10 +70,6 @@ require('lazy').setup({ }, }, - { - 'github/copilot.vim', - }, - -- Useful plugin to show you pending keybinds. { 'folke/which-key.nvim', opts = {} }, { From a9e10f2855a7f5f5b67569079ba109edc2f6172f Mon Sep 17 00:00:00 2001 From: David Francis Date: Thu, 15 Feb 2024 15:11:33 +0000 Subject: [PATCH 09/10] Enable comment hotkeys --- init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/init.lua b/init.lua index ef15a43ffcd..4155cbe7501 100644 --- a/init.lua +++ b/init.lua @@ -250,6 +250,18 @@ vim.api.nvim_create_autocmd('TextYankPost', { pattern = '*', }) +require('Comment').setup({ + ignore = '^$', + toggler = { + line = 'cc', + block = 'bc', + }, + opleader = { + line = 'c', + block = 'b', + }, +}) + -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` require('telescope').setup { From a5950ac59dedc63a255c76726a17367220eeb22c Mon Sep 17 00:00:00 2001 From: David Francis Date: Wed, 28 Feb 2024 12:58:39 +0000 Subject: [PATCH 10/10] Update init.lua --- init.lua | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 4155cbe7501..753948962b8 100644 --- a/init.lua +++ b/init.lua @@ -70,6 +70,9 @@ require('lazy').setup({ }, }, + -- Plugin to autopair brackets + { 'windwp/nvim-autopairs', event = 'InsertEnter', opts = {} }, + -- Useful plugin to show you pending keybinds. { 'folke/which-key.nvim', opts = {} }, { @@ -192,6 +195,23 @@ vim.keymap.set('n', 'yy', '"+yy', { desc = 'Yank line to system clipboar vim.keymap.set('n', 'Y', '"+y$', { desc = 'Yank to end of line to system clipboard' }) vim.keymap.set('v', 'Y', '"+Y', { desc = 'Yank highlighted lines to system clipboard' }) +-- Escape terminal mode +vim.keymap.set('t', '', '', { desc = 'Escape terminal mode'}) + +-- Use ALT+{h,j,k,l} to navigate windows from any mode (see :help terminal) +vim.keymap.set('t', '', 'h') +vim.keymap.set('t', '', 'j') +vim.keymap.set('t', '', 'k') +vim.keymap.set('t', '', 'l') +vim.keymap.set('i', '', 'h') +vim.keymap.set('i', '', 'j') +vim.keymap.set('i', '', 'k') +vim.keymap.set('i', '', 'l') +vim.keymap.set('n', '', 'h') +vim.keymap.set('n', '', 'j') +vim.keymap.set('n', '', 'k') +vim.keymap.set('n', '', 'l') + -- Enable break indent vim.o.breakindent = true @@ -218,8 +238,8 @@ vim.o.termguicolors = true -- Think these are set automatically by a plugin instead -- vim.o.tabstop = 4 --- vim.o.shiftwidth = 4 --- vim.o.expandtab = true +vim.o.shiftwidth = 4 +vim.o.expandtab = true vim.o.scrolloff = 8 @@ -300,7 +320,7 @@ vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { de -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim', 'c_sharp' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, @@ -419,11 +439,11 @@ end -- Add any additional override configuration in the following tables. They will be passed to -- the `settings` field of the server config. You must look up that documentation yourself. local servers = { - -- clangd = {}, - -- gopls = {}, + clangd = {}, + gopls = {}, -- pyright = {}, -- rust_analyzer = {}, - -- tsserver = {}, + tsserver = {}, lua_ls = { Lua = {