From cec0aa4de15d7ec0739fc4f3ab6783a7ec8567dc Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 09:21:34 +0200 Subject: [PATCH 01/13] p --- lua/custom/maps/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/custom/maps/init.lua b/lua/custom/maps/init.lua index 4789429..fb7d3f5 100644 --- a/lua/custom/maps/init.lua +++ b/lua/custom/maps/init.lua @@ -85,6 +85,9 @@ vim.keymap.set('t', '', vim.api.nvim_replace_termcodes('', true, vim.keymap.set({ 'n', 'v' }, 'y', '"+y', { desc = '[Y]ank to system' }) vim.keymap.set({ 'n', 'v' }, 'Y', '"+Y', { desc = '[Y]ank to system' }) vim.keymap.set({ 'n', 'v' }, 'yy', '"+yy', { desc = '[Y]ank to system' }) + +-- paste from system clipboard +vim.keymap.set({ 'n', 'v' }, 'p', '"+p', { desc = '[P]aste from system' }) vim.keymap.set({ 't', 'n', 'v' }, '', '"+pi', { desc = 'Paste the system clipboard' }) -- add lines from normal and visual, without insert mode From 423cf830b382d281e24a3ae43351f2e394ce02a7 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 09:31:52 +0200 Subject: [PATCH 02/13] readd theme.lua settings file --- .gitignore | 1 - lua/settings/theme.lua | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 lua/settings/theme.lua diff --git a/.gitignore b/.gitignore index 7b8b949..2b27ef0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,3 @@ after **/.DS_Store lua/custom/secret lua/custom/configs/secret -lua/settings/theme.lua diff --git a/lua/settings/theme.lua b/lua/settings/theme.lua new file mode 100644 index 0000000..1bd4c61 --- /dev/null +++ b/lua/settings/theme.lua @@ -0,0 +1,5 @@ +-- Themery block +-- This block will be replaced by Themery. +vim.cmd("colorscheme tokyonight-storm") +vim.g.theme_id = 10 +-- end themery block From dc339b1b1272d73d7270ae10048790f2bea20ff1 Mon Sep 17 00:00:00 2001 From: cscherrNT Date: Mon, 8 Jul 2024 09:37:40 +0200 Subject: [PATCH 03/13] add note to ignore theme.lua in settings --- lua/settings/theme.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/settings/theme.lua b/lua/settings/theme.lua index 1bd4c61..f0d0986 100644 --- a/lua/settings/theme.lua +++ b/lua/settings/theme.lua @@ -1,3 +1,5 @@ +-- Use `git update-index --assume-unchanged ` to ignore changes in this file +-- -- Themery block -- This block will be replaced by Themery. vim.cmd("colorscheme tokyonight-storm") From 6bff5a90758a6933ce3afef68b50673192a196bc Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 10:32:51 +0200 Subject: [PATCH 04/13] autocommands for filetypes --- init.lua | 144 ++++++++++++++++++++-------------------- lua/custom/autocmds.lua | 29 ++++++++ 2 files changed, 102 insertions(+), 71 deletions(-) create mode 100644 lua/custom/autocmds.lua diff --git a/init.lua b/init.lua index 536bc39..f04d835 100644 --- a/init.lua +++ b/init.lua @@ -1,88 +1,89 @@ local opt = vim.opt local g = vim.g -g.mapleader = ' ' -g.maplocalleader = ';' -g.python3_host_prog = '/usr/bin/python3' +vim.g.mapleader = ' ' +vim.g.maplocalleader = ';' +vim.g.python3_host_prog = '/usr/bin/python3' -opt.mouse = 'a' -- mouse does annoying things for me if it's not 'a' -opt.signcolumn = 'yes' -opt.clipboard = '' -- don't just use the system clipboard -opt.wrap = false -opt.breakindent = false -opt.spell = false -opt.conceallevel = 2 -opt.undofile = true -opt.undolevels = 10000 -opt.writebackup = false -opt.history = 5000 -opt.shada = { "'1000", '<50', 's10', 'h' } +vim.o.mouse = 'a' -- mouse does annoying things for me if it's not 'a' +vim.o.signcolumn = 'yes' +vim.o.clipboard = '' -- don't just use the system clipboard +vim.o.wrap = false +vim.o.breakindent = false +vim.o.spell = false +vim.o.conceallevel = 2 +vim.o.concealcursor = 'nc' +vim.o.undofile = true +vim.o.undolevels = 10000 +vim.o.writebackup = false +vim.o.history = 5000 +vim.o.shada = { "'1000", '<50', 's10', 'h' } +vim.g.syntax = true -- Tabs and Indents -- === - -opt.textwidth = 80 -- Text width maximum chars before wrapping -opt.tabstop = 4 -- The number of spaces a tab is -opt.shiftwidth = 4 -- Number of spaces to use in auto(indent) -opt.smarttab = true -- Tab insert blanks according to 'shiftwidth' -opt.autoindent = true -- Use same indenting on new lines -opt.smartindent = true -- Smart autoindenting on new lines -opt.shiftround = true -- Round indent to multiple of 'shiftwidth' +vim.o.textwidth = 80 -- Text width maximum chars before wrapping +vim.o.tabstop = 4 -- The number of spaces a tab is +vim.o.shiftwidth = 4 -- Number of spaces to use in auto(indent) +vim.o.smarttab = true -- Tab insert blanks according to 'shiftwidth' +vim.o.autoindent = true -- Use same indenting on new lines +vim.o.smartindent = true -- Smart autoindenting on new lines +vim.o.shiftround = true -- Round indent to multiple of 'shiftwidth' -- Timing -- === -opt.ttimeout = true -opt.timeoutlen = 500 -- Time out on mappings -opt.ttimeoutlen = 10 -- Time out on key codes -opt.updatetime = 250 -- Idle time to write swap and trigger CursorHold +vim.o.ttimeout = true +vim.o.timeoutlen = 500 -- Time out on mappings +vim.o.ttimeoutlen = 10 -- Time out on key codes +vim.o.updatetime = 250 -- Idle time to write swap and trigger CursorHold -- Searching -- === -opt.ignorecase = true -- Search ignoring case -opt.smartcase = true -- Keep case when searching with * -opt.infercase = true -- Adjust case in insert completion mode -opt.incsearch = true -- Incremental search +vim.o.ignorecase = true -- Search ignoring case +vim.o.smartcase = true -- Keep case when searching with * +vim.o.infercase = true -- Adjust case in insert completion mode +vim.o.incsearch = true -- Incremental search vim.opt.hlsearch = true -- highlight searched stuff -- Formatting -- === -opt.wrap = false -- No wrap by default -opt.linebreak = true -- Break long lines at 'breakat' -opt.breakat = '\\ \\ ;:,!?' -- Long lines break chars -opt.startofline = false -- Cursor in same column for few commands -opt.splitbelow = true -- Splits open bottom right -opt.splitright = true -opt.breakindentopt = { shift = 2, min = 20 } -opt.formatoptions = '' -- see :h fo-table & :h formatoptions +vim.o.wrap = false -- No wrap by default +vim.o.linebreak = true -- Break long lines at 'breakat' +vim.o.breakat = '\\ \\ ;:,!?' -- Long lines break chars +vim.o.startofline = false -- Cursor in same column for few commands +vim.o.splitbelow = true -- Splits open bottom right +vim.o.splitright = true +vim.o.breakindentopt = { shift = 2, min = 20 } +vim.o.formatoptions = '' -- see :h fo-table & :h formatoptions vim.opt.breakindent = true -- Diff -- === -opt.diffopt:append { 'iwhite', 'indent-heuristic', 'algorithm:patience' } -opt.wildmode = 'longest:full,full' -- Command-line completion mode +vim.o.diffopt:append { 'iwhite', 'indent-heuristic', 'algorithm:patience' } +vim.o.wildmode = 'longest:full,full' -- Command-line completion mode -- Folds -- === -opt.foldlevel = 10 -- start with all folds open +vim.o.foldlevel = 10 -- start with all folds open -- Editor UI -- === vim.o.guifont = 'FiraCode Nerd Font:h15' -opt.termguicolors = true -opt.shortmess = 'xsTOInfFitloCaAs' -opt.showmode = true -- Show mode in cmd window -opt.scrolloff = 10 -- Keep at least n lines above/below -opt.sidescrolloff = 10 -- Keep at least n lines left/right -opt.numberwidth = 2 -- Minimum number of columns to use for the line number -opt.number = true -- Show line numbers -opt.relativenumber = true -- Show relative line numbers -opt.ruler = true -- Default status ruler -opt.showtabline = 1 -- Don't change this, goes back to a vanilla vim default -opt.laststatus = 3 -- Always show laststatus +vim.o.termguicolors = true +vim.o.shortmess = 'xsTOInfFitloCaAs' +vim.o.showmode = true -- Show mode in cmd window +vim.o.scrolloff = 10 -- Keep at least n lines above/below +vim.o.sidescrolloff = 10 -- Keep at least n lines left/right +vim.o.numberwidth = 2 -- Minimum number of columns to use for the line number +vim.o.number = true -- Show line numbers +vim.o.relativenumber = true -- Show relative line numbers +vim.o.ruler = true -- Default status ruler +vim.o.showtabline = 1 -- Don't change this, goes back to a vanilla vim default +vim.o.laststatus = 3 -- Always show laststatus -- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` @@ -116,31 +117,31 @@ if vim.g.neovide == true then vim.g.neovide_fullscreen = true end -opt.helpheight = 0 -- Disable help window resizing -opt.winwidth = 30 -- Minimum width for active window -opt.winminwidth = 1 -- Minimum width for inactive windows -opt.winheight = 1 -- Minimum height for active window -opt.winminheight = 1 -- Minimum height for inactive window +vim.o.helpheight = 0 -- Disable help window resizing +vim.o.winwidth = 30 -- Minimum width for active window +vim.o.winminwidth = 1 -- Minimum width for inactive windows +vim.o.winheight = 1 -- Minimum height for active window +vim.o.winminheight = 1 -- Minimum height for inactive window -opt.showcmd = false -- show command in status line -opt.cmdheight = 0 -opt.cmdwinheight = 5 -- Command-line lines -opt.equalalways = true -- Resize windows on split or close -opt.colorcolumn = '80' -- Column highlight at textwidth's max character-limit +vim.o.showcmd = false -- show command in status line +vim.o.cmdheight = 0 +vim.o.cmdwinheight = 5 -- Command-line lines +vim.o.equalalways = true -- Resize windows on split or close +vim.o.colorcolumn = '80' -- Column highlight at textwidth's max character-limit -opt.cursorline = true -opt.cursorlineopt = { 'number', 'screenline' } +vim.o.cursorline = true +vim.o.cursorlineopt = { 'number', 'screenline' } -opt.pumheight = 10 -- Maximum number of items to show in the popup menu -opt.pumwidth = 10 -- Minimum width for the popup menu -opt.pumblend = 10 -- Popup blend +vim.o.pumheight = 10 -- Maximum number of items to show in the popup menu +vim.o.pumwidth = 10 -- Minimum width for the popup menu +vim.o.pumblend = 10 -- Popup blend -- Spelling correction -- === -opt.spell = false -- manually enable spell with `set spell` or `ts` -opt.spelllang = 'en,de_de,' -opt.spellsuggest = 'double,50,timeout:5000' +vim.o.spell = false -- manually enable spell with `set spell` or `ts` +vim.o.spelllang = 'en,de_de,' +vim.o.spellsuggest = 'double,50,timeout:5000' -- autocommands -- === @@ -175,6 +176,7 @@ end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) require 'custom.maps' +require 'custom.autocmds' require('lazy').setup({ { import = 'custom.plugins' }, }, { diff --git a/lua/custom/autocmds.lua b/lua/custom/autocmds.lua new file mode 100644 index 0000000..35a8529 --- /dev/null +++ b/lua/custom/autocmds.lua @@ -0,0 +1,29 @@ +local augroup = vim.api.nvim_create_augroup('plex_generic_autocmds', {}) + +-- always use the tex filetype for latex things, as those are most supported by +-- latex language servers. +vim.api.nvim_create_autocmd('FileType', { + group = augroup, + pattern = { + 'latex', + 'plaintex', + }, + callback = function() + vim.bo.filetype = 'tex' + end, +}) + +-- conceallevel is what converts things like **bold** to be displayed as bold +-- without the stars. This is useful, but we might not want it for some +-- filetypes. +vim.api.nvim_create_autocmd('FileType', { + group = augroup, + pattern = { + 'latex', + 'plaintex', + 'tex', + }, + callback = function() + vim.opt_local.conceallevel = 0 + end, +}) From 80e3241a66d230cb71530b822af8c2caf5743152 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 11:12:19 +0200 Subject: [PATCH 05/13] add more themes --- lua/custom/plugins/themes.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lua/custom/plugins/themes.lua b/lua/custom/plugins/themes.lua index 6657993..cf05db3 100644 --- a/lua/custom/plugins/themes.lua +++ b/lua/custom/plugins/themes.lua @@ -65,6 +65,30 @@ return { name = 'kanagawa-wave', colorscheme = 'kanagawa-wave', }, + { + name = 'zenbones', + colorscheme = 'zenbones', + before = [[ + -- It's a major hack from the themery guys that this is a string + vim.opt.background = "dark" + ]], + }, + { + name = 'tokyobones', + colorscheme = 'tokyobones', + before = [[ + -- It's a major hack from the themery guys that this is a string + vim.opt.background = "dark" + ]], + }, + { + name = 'kanagawabones', + colorscheme = 'kanagawabones', + before = [[ + -- It's a major hack from the themery guys that this is a string + vim.opt.background = "dark" + ]], + }, -- Light themes { name = '==========Light Themes==========', @@ -78,6 +102,14 @@ return { name = 'kanagawa-lotus', colorscheme = 'kanagawa-lotus', }, + { + name = 'zenbones', + colorscheme = 'zenbones', + before = [[ + -- It's a major hack from the themery guys that this is a string + vim.opt.background = "light" + ]], + }, }, themeConfigFile = '~/.config/nvim/lua/settings/theme.lua', livePreview = true, -- Apply theme while browsing. Default to true. @@ -86,4 +118,5 @@ return { }, 'folke/tokyonight.nvim', 'rebelot/kanagawa.nvim', + { 'zenbones-theme/zenbones.nvim', dependencies = { 'rktjmp/lush.nvim' } }, } From ed0bd3cc06af1aa337ddefc67b067d2be4522fa0 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 11:12:31 +0200 Subject: [PATCH 06/13] vim-illuminate jump explanation --- lua/custom/plugins/ui.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/custom/plugins/ui.lua b/lua/custom/plugins/ui.lua index a17b2e5..e7e9634 100644 --- a/lua/custom/plugins/ui.lua +++ b/lua/custom/plugins/ui.lua @@ -273,6 +273,17 @@ return { 'neo-tree', }, }, + -- looks weird but is useful: put your cursor on a word and other occurences + -- of the word in your buffer will be highlighted. You can then use + -- '[[' and ']]' to go to the next or previous occurence. + -- + -- Try it: + -- + -- word #### word ########### + -- ############## word ###### + -- #### word #### word word # + -- + -- (It might not work with comments) keys = { { ']]', desc = 'Next Reference' }, { '[[', desc = 'Prev Reference' }, @@ -280,6 +291,7 @@ return { config = function(_, opts) require('illuminate').configure(opts) + -- only magic follows local function map(key, dir, buffer) vim.keymap.set('n', key, function() require('illuminate')['goto_' .. dir .. '_reference'](false) From 0b52884aa792e8cf61e10d10922578f2bdfb185e Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 11:12:40 +0200 Subject: [PATCH 07/13] change style in init --- init.lua | 139 +++++++++++++++++++++++++++---------------------------- 1 file changed, 68 insertions(+), 71 deletions(-) diff --git a/init.lua b/init.lua index f04d835..6871941 100644 --- a/init.lua +++ b/init.lua @@ -1,89 +1,86 @@ -local opt = vim.opt -local g = vim.g - vim.g.mapleader = ' ' vim.g.maplocalleader = ';' vim.g.python3_host_prog = '/usr/bin/python3' -vim.o.mouse = 'a' -- mouse does annoying things for me if it's not 'a' -vim.o.signcolumn = 'yes' -vim.o.clipboard = '' -- don't just use the system clipboard -vim.o.wrap = false -vim.o.breakindent = false -vim.o.spell = false -vim.o.conceallevel = 2 -vim.o.concealcursor = 'nc' -vim.o.undofile = true -vim.o.undolevels = 10000 -vim.o.writebackup = false -vim.o.history = 5000 -vim.o.shada = { "'1000", '<50', 's10', 'h' } +vim.opt.mouse = 'a' -- mouse does annoying things for me if it's not 'a' +vim.opt.signcolumn = 'yes' +vim.opt.clipboard = '' -- don't just use the system clipboard +vim.opt.wrap = false +vim.opt.breakindent = false +vim.opt.spell = false +vim.opt.conceallevel = 2 +vim.opt.concealcursor = 'nc' +vim.opt.undofile = true +vim.opt.undolevels = 10000 +vim.opt.writebackup = false +vim.opt.history = 5000 +vim.opt.shada = { "'1000", '<50', 's10', 'h' } vim.g.syntax = true -- Tabs and Indents -- === -vim.o.textwidth = 80 -- Text width maximum chars before wrapping -vim.o.tabstop = 4 -- The number of spaces a tab is -vim.o.shiftwidth = 4 -- Number of spaces to use in auto(indent) -vim.o.smarttab = true -- Tab insert blanks according to 'shiftwidth' -vim.o.autoindent = true -- Use same indenting on new lines -vim.o.smartindent = true -- Smart autoindenting on new lines -vim.o.shiftround = true -- Round indent to multiple of 'shiftwidth' +vim.opt.textwidth = 80 -- Text width maximum chars before wrapping +vim.opt.tabstop = 4 -- The number of spaces a tab is +vim.opt.shiftwidth = 4 -- Number of spaces to use in auto(indent) +vim.opt.smarttab = true -- Tab insert blanks according to 'shiftwidth' +vim.opt.autoindent = true -- Use same indenting on new lines +vim.opt.smartindent = true -- Smart autoindenting on new lines +vim.opt.shiftround = true -- Round indent to multiple of 'shiftwidth' -- Timing -- === -vim.o.ttimeout = true -vim.o.timeoutlen = 500 -- Time out on mappings -vim.o.ttimeoutlen = 10 -- Time out on key codes -vim.o.updatetime = 250 -- Idle time to write swap and trigger CursorHold +vim.opt.ttimeout = true +vim.opt.timeoutlen = 500 -- Time out on mappings +vim.opt.ttimeoutlen = 10 -- Time out on key codes +vim.opt.updatetime = 250 -- Idle time to write swap and trigger CursorHold -- Searching -- === -vim.o.ignorecase = true -- Search ignoring case -vim.o.smartcase = true -- Keep case when searching with * -vim.o.infercase = true -- Adjust case in insert completion mode -vim.o.incsearch = true -- Incremental search +vim.opt.ignorecase = true -- Search ignoring case +vim.opt.smartcase = true -- Keep case when searching with * +vim.opt.infercase = true -- Adjust case in insert completion mode +vim.opt.incsearch = true -- Incremental search vim.opt.hlsearch = true -- highlight searched stuff -- Formatting -- === -vim.o.wrap = false -- No wrap by default -vim.o.linebreak = true -- Break long lines at 'breakat' -vim.o.breakat = '\\ \\ ;:,!?' -- Long lines break chars -vim.o.startofline = false -- Cursor in same column for few commands -vim.o.splitbelow = true -- Splits open bottom right -vim.o.splitright = true -vim.o.breakindentopt = { shift = 2, min = 20 } -vim.o.formatoptions = '' -- see :h fo-table & :h formatoptions +vim.opt.wrap = false -- No wrap by default +vim.opt.linebreak = true -- Break long lines at 'breakat' +vim.opt.breakat = '\\ \\ ;:,!?' -- Long lines break chars +vim.opt.startofline = false -- Cursor in same column for few commands +vim.opt.splitbelow = true -- Splits open bottom right +vim.opt.splitright = true +vim.opt.breakindentopt = { shift = 2, min = 20 } +vim.opt.formatoptions = '' -- see :h fo-table & :h formatoptions vim.opt.breakindent = true -- Diff -- === -vim.o.diffopt:append { 'iwhite', 'indent-heuristic', 'algorithm:patience' } -vim.o.wildmode = 'longest:full,full' -- Command-line completion mode +vim.opt.diffopt:append { 'iwhite', 'indent-heuristic', 'algorithm:patience' } +vim.opt.wildmode = 'longest:full,full' -- Command-line completion mode -- Folds -- === -vim.o.foldlevel = 10 -- start with all folds open +vim.opt.foldlevel = 10 -- start with all folds open -- Editor UI -- === vim.o.guifont = 'FiraCode Nerd Font:h15' -vim.o.termguicolors = true -vim.o.shortmess = 'xsTOInfFitloCaAs' -vim.o.showmode = true -- Show mode in cmd window -vim.o.scrolloff = 10 -- Keep at least n lines above/below -vim.o.sidescrolloff = 10 -- Keep at least n lines left/right -vim.o.numberwidth = 2 -- Minimum number of columns to use for the line number -vim.o.number = true -- Show line numbers -vim.o.relativenumber = true -- Show relative line numbers -vim.o.ruler = true -- Default status ruler -vim.o.showtabline = 1 -- Don't change this, goes back to a vanilla vim default -vim.o.laststatus = 3 -- Always show laststatus +vim.opt.termguicolors = true +vim.opt.shortmess = 'xsTOInfFitloCaAs' +vim.opt.showmode = true -- Show mode in cmd window +vim.opt.scrolloff = 10 -- Keep at least n lines above/below +vim.opt.sidescrolloff = 10 -- Keep at least n lines left/right +vim.opt.numberwidth = 2 -- Minimum number of columns to use for the line number +vim.opt.number = true -- Show line numbers +vim.opt.relativenumber = true -- Show relative line numbers +vim.opt.ruler = true -- Default status ruler +vim.opt.showtabline = 1 -- Don't change this, goes back to a vanilla vim default +vim.opt.laststatus = 3 -- Always show laststatus -- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` @@ -117,31 +114,31 @@ if vim.g.neovide == true then vim.g.neovide_fullscreen = true end -vim.o.helpheight = 0 -- Disable help window resizing -vim.o.winwidth = 30 -- Minimum width for active window -vim.o.winminwidth = 1 -- Minimum width for inactive windows -vim.o.winheight = 1 -- Minimum height for active window -vim.o.winminheight = 1 -- Minimum height for inactive window +vim.opt.helpheight = 0 -- Disable help window resizing +vim.opt.winwidth = 30 -- Minimum width for active window +vim.opt.winminwidth = 1 -- Minimum width for inactive windows +vim.opt.winheight = 1 -- Minimum height for active window +vim.opt.winminheight = 1 -- Minimum height for inactive window -vim.o.showcmd = false -- show command in status line -vim.o.cmdheight = 0 -vim.o.cmdwinheight = 5 -- Command-line lines -vim.o.equalalways = true -- Resize windows on split or close -vim.o.colorcolumn = '80' -- Column highlight at textwidth's max character-limit +vim.opt.showcmd = false -- show command in status line +vim.opt.cmdheight = 0 +vim.opt.cmdwinheight = 5 -- Command-line lines +vim.opt.equalalways = true -- Resize windows on split or close +vim.opt.colorcolumn = '80' -- Column highlight at textwidth's max character-limit -vim.o.cursorline = true -vim.o.cursorlineopt = { 'number', 'screenline' } +vim.opt.cursorline = true +vim.opt.cursorlineopt = { 'number', 'screenline' } -vim.o.pumheight = 10 -- Maximum number of items to show in the popup menu -vim.o.pumwidth = 10 -- Minimum width for the popup menu -vim.o.pumblend = 10 -- Popup blend +vim.opt.pumheight = 10 -- Maximum number of items to show in the popup menu +vim.opt.pumwidth = 10 -- Minimum width for the popup menu +vim.opt.pumblend = 10 -- Popup blend -- Spelling correction -- === -vim.o.spell = false -- manually enable spell with `set spell` or `ts` -vim.o.spelllang = 'en,de_de,' -vim.o.spellsuggest = 'double,50,timeout:5000' +vim.opt.spell = false -- manually enable spell with `set spell` or `ts` +vim.opt.spelllang = 'en,de_de,' +vim.opt.spellsuggest = 'double,50,timeout:5000' -- autocommands -- === From ea7ecf138bcd0ebbeafdefceee0a84e9d6c52273 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 11:40:07 +0200 Subject: [PATCH 08/13] better illuminate --- lua/custom/plugins/ui.lua | 47 +++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/lua/custom/plugins/ui.lua b/lua/custom/plugins/ui.lua index e7e9634..d55addc 100644 --- a/lua/custom/plugins/ui.lua +++ b/lua/custom/plugins/ui.lua @@ -260,8 +260,15 @@ return { lazy = false, event = { 'BufReadPost', 'BufNewFile' }, opts = { + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + large_file_cutoff = 50000, delay = 200, - under_cursor = false, + under_cursor = true, modes_allowlist = { 'n', 'no', 'nt' }, filetypes_denylist = { 'DiffviewFileHistory', @@ -271,6 +278,8 @@ return { 'git', 'minifiles', 'neo-tree', + 'NvimTree_1', + 'dashboard', }, }, -- looks weird but is useful: put your cursor on a word and other occurences @@ -283,36 +292,22 @@ return { -- ############## word ###### -- #### word #### word word # -- - -- (It might not work with comments) + -- (Does only work if the regex source is currently active, otherwise the + -- references are those your language server or treesitter gives out, so + -- syntax aware) keys = { { ']]', desc = 'Next Reference' }, { '[[', desc = 'Prev Reference' }, }, config = function(_, opts) - require('illuminate').configure(opts) - - -- only magic follows - local function map(key, dir, buffer) - vim.keymap.set('n', key, function() - require('illuminate')['goto_' .. dir .. '_reference'](false) - end, { - desc = dir:sub(1, 1):upper() .. dir:sub(2) .. ' Reference', - buffer = buffer, - }) - end - - map(']]', 'next') - map('[[', 'prev') - - -- also set it after loading ftplugins, since a lot overwrite [[ and ]] - vim.api.nvim_create_autocmd('FileType', { - group = vim.api.nvim_create_augroup('plex_illuminate', {}), - callback = function() - local buffer = vim.api.nvim_get_current_buf() - map(']]', 'next', buffer) - map('[[', 'prev', buffer) - end, - }) + local illuminate = require 'illuminate' + illuminate.configure(opts) + vim.keymap.set('n', '[[', function() + illuminate.goto_prev_reference() -- try putting your cursor on `illuminate` + end, { desc = 'Goto last occurence of current word' }) + vim.keymap.set('n', ']]', function() + illuminate.goto_next_reference() + end, { desc = 'Goto next occurence of current word' }) end, }, { From ae62c303c57e0c80e4774bcfbd1edf025851984f Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 15:10:28 +0200 Subject: [PATCH 09/13] fix which-keys --- lua/custom/plugins/ui.lua | 40 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/lua/custom/plugins/ui.lua b/lua/custom/plugins/ui.lua index d55addc..bd2365e 100644 --- a/lua/custom/plugins/ui.lua +++ b/lua/custom/plugins/ui.lua @@ -140,6 +140,7 @@ return { }, { 'folke/which-key.nvim', + event = 'VimEnter', -- Sets the loading event to 'VimEnter' keys = { '', '', '', '', '"', "'", '`', 'c', 'v', 'g' }, defaults = { mode = { 'n', 'v' }, @@ -148,13 +149,14 @@ return { ['g'] = { name = '+goto' }, [']'] = { name = '+next' }, ['['] = { name = '+prev' }, - ['d'] = { name = '+lsp/debug' }, - ['r'] = { name = '+diagnostics/quickfix' }, - ['c'] = { name = '+code' }, - ['g'] = { name = '+git' }, - ['t'] = { name = '+toggle/tools' }, - ['w'] = { name = '+window/which' }, - ['f'] = { name = '+formatting' }, + ['d'] = { name = '+[D]ebug' }, + ['c'] = { name = '+[C]ode/[C]olor' }, + ['g'] = { name = '+[G]ood tools' }, + ['f'] = { name = '+[F]ormatting' }, + ['r'] = { name = '[R]ename' }, + ['f'] = { name = '[F]ind' }, + ['w'] = { name = '[W]orkspace' }, + ['t'] = { name = '[T]oggle' }, }, opts = { triggers_nowait = { @@ -233,28 +235,6 @@ return { }) end, }, - { -- Useful plugin to show you pending keybinds. - '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() - - -- Document existing key chains - require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['f'] = { name = '[F]ind', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, - ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, - ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, - } - -- visual mode - require('which-key').register({ - ['h'] = { 'Git [H]unk' }, - }, { mode = 'v' }) - end, - }, { 'RRethy/vim-illuminate', lazy = false, @@ -262,7 +242,7 @@ return { opts = { -- providers: provider used to get references in the buffer, ordered by priority providers = { - 'lsp', + 'lsp', -- useless for tex but still used 'treesitter', 'regex', }, From 77261effb022cf210104c34f8d9d23b595fd52d8 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 15:10:36 +0200 Subject: [PATCH 10/13] change maps for trouble --- lua/custom/plugins/lsp.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index e56ba32..b5f6c43 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -38,12 +38,12 @@ return { opts = { use_diagnostic_signs = true }, -- stylua: ignore keys = { - { 'rb', "Trouble diagnostics toggle filter.buf=0", desc = 'Document Diagnostics (Trouble)' }, - { 'rr', 'Trouble diagnostics toggle', desc = 'Workspace Diagnostics (Trouble)' }, - { 'rq', "Trouble qflist toggle", desc = 'Quickfix List (Trouble)' }, - { 'rl', "Trouble loclist toggle", desc = 'Location List (Trouble)' }, - { 'rd', "Trouble symbols", desc = 'LSP symbols (Trouble)' }, - { 'rt', "Trouble todo", desc = 'Todos (Trouble)' }, + { 'ctb', "Trouble diagnostics toggle filter.buf=0", desc = 'Document Diagnostics (Trouble)' }, + { 'ctr', 'Trouble diagnostics toggle', desc = 'Workspace Diagnostics (Trouble)' }, + { 'ctq', "Trouble qflist toggle", desc = 'Quickfix List (Trouble)' }, + { 'ctl', "Trouble loclist toggle", desc = 'Location List (Trouble)' }, + { 'ctd', "Trouble symbols", desc = 'LSP symbols (Trouble)' }, + { 'ctt', "Trouble todo", desc = 'Todos (Trouble)' }, { '[q', function() From 3a8b4acf3d6b46c656ef8fc968792d4921a2c9d9 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 15:13:46 +0200 Subject: [PATCH 11/13] moar moar buffers --- lua/custom/maps/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/custom/maps/init.lua b/lua/custom/maps/init.lua index 6918230..de07d1c 100644 --- a/lua/custom/maps/init.lua +++ b/lua/custom/maps/init.lua @@ -59,6 +59,8 @@ vim.keymap.set({ 'n' }, '#', "'", { desc = '[Q]uit the current window' }) -- split windows vim.keymap.set('n', '"', 'vsplit', { desc = 'Split the window vertically' }) vim.keymap.set('n', '%', 'split', { desc = 'Split the window horizontally' }) +vim.keymap.set('n', 'w"', 'vnew', { desc = 'Split the window vertically (new buffer)' }) +vim.keymap.set('n', 'w%', 'new', { desc = 'Split the window horizontally (new buffer)' }) -- window actions vim.keymap.set('n', 'wbn', 'enew', { desc = 'Open a [N]ew [B]uffer' }) @@ -75,6 +77,7 @@ vim.keymap.set('n', 'wn', 'tabnew', { desc = 'Open a [N]ew [W]o vim.keymap.set('n', 'wc', 'tabclose', { desc = '[C]lose a [W]orkspace/Tab' }) vim.keymap.set('n', 'wk', 'tabnext', { desc = 'Next [W]orkspace/Tab' }) vim.keymap.set('n', 'wj', 'tabprevious', { desc = 'Last [W]orkspace/Tab' }) +vim.keymap.set('n', 'n', 'enew', { desc = '[N]ew Buffer' }) vim.keymap.set('t', '', vim.api.nvim_replace_termcodes('', true, true, true), { desc = 'Leave terminal mode' }) From 77f0411be1765d9ec3b30eb87446411a18eadc14 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 15:35:14 +0200 Subject: [PATCH 12/13] whichkey actual fix --- lua/custom/plugins/telescope.lua | 2 +- lua/custom/plugins/ui.lua | 75 +++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 26 deletions(-) diff --git a/lua/custom/plugins/telescope.lua b/lua/custom/plugins/telescope.lua index 52ab28b..284c8a1 100644 --- a/lua/custom/plugins/telescope.lua +++ b/lua/custom/plugins/telescope.lua @@ -92,7 +92,7 @@ return { vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) vim.keymap.set('n', 'fb', builtin.buffers, { desc = '[F]ind existing [B]uffers' }) vim.keymap.set('n', 'fm', builtin.marks, { desc = '[F]ind book[M]arks' }) - vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind LSP [D]iagnostigs' }) + vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostigs' }) vim.keymap.set('n', 'fs', builtin.lsp_dynamic_workspace_symbols, { desc = '[F]ind LSP [S]ymbols' }) -- spelling diff --git a/lua/custom/plugins/ui.lua b/lua/custom/plugins/ui.lua index bd2365e..7176583 100644 --- a/lua/custom/plugins/ui.lua +++ b/lua/custom/plugins/ui.lua @@ -141,23 +141,6 @@ return { { 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' - keys = { '', '', '', '', '"', "'", '`', 'c', 'v', 'g' }, - defaults = { - mode = { 'n', 'v' }, - [';'] = { name = '+telescope' }, - [';f'] = { name = '+find' }, - ['g'] = { name = '+goto' }, - [']'] = { name = '+next' }, - ['['] = { name = '+prev' }, - ['d'] = { name = '+[D]ebug' }, - ['c'] = { name = '+[C]ode/[C]olor' }, - ['g'] = { name = '+[G]ood tools' }, - ['f'] = { name = '+[F]ormatting' }, - ['r'] = { name = '[R]ename' }, - ['f'] = { name = '[F]ind' }, - ['w'] = { name = '[W]orkspace' }, - ['t'] = { name = '[T]oggle' }, - }, opts = { triggers_nowait = { -- marks @@ -180,7 +163,51 @@ return { v = { 'j', 'k' }, n = { 'o', 'O' }, }, + -- plugins = { + -- marks = true, -- shows a list of your marks on ' and ` + -- registers = true, -- shows your registers on " in NORMAL or in INSERT mode + -- -- the presets plugin, adds help for a bunch of default keybindings in Neovim + -- -- No actual key bindings are created + -- spelling = { + -- enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions + -- suggestions = 20, -- how many suggestions should be shown in the list? + -- }, + -- presets = { + -- operators = true, -- adds help for operators like d, y, ... + -- motions = true, -- adds help for motions + -- text_objects = true, -- help for text objects triggered after entering an operator + -- windows = true, -- default bindings on + -- nav = true, -- misc bindings to work with windows + -- z = true, -- bindings for folds, spelling and others prefixed with z + -- g = true, -- bindings for prefixed with g + -- }, + -- }, + icons = { + breadcrumb = 'ยป', -- symbol used in the command line area that shows your active key combo + separator = 'โžœ', -- symbol used between a key and it's label + group = '+', -- symbol prepended to a group + }, }, + config = function(opts) + local wk = require 'which-key' + local defaults = { + mode = { 'n', 'v' }, + [';'] = { name = '+telescope' }, + [';f'] = { name = '+find' }, + ['g'] = { name = '+goto' }, + [']'] = { name = '+next' }, + ['['] = { name = '+prev' }, + ['d'] = { name = '+[D]ebug' }, + ['c'] = { name = '+[C]ode/[C]olor' }, + ['g'] = { name = '+[G]ood tools' }, + ['f'] = { name = '+[F]ormatting' }, + ['r'] = { name = '[R]ename' }, + ['f'] = { name = '[F]ind' }, + ['w'] = { name = '[W]orkspace' }, + ['t'] = { name = '[T]oggle', ['๐Ÿšซ'] = 'which_key_ignore' }, + } + wk.register(defaults, opts) + end, }, { 'echasnovski/mini.trailspace', @@ -294,14 +321,12 @@ return { 'folke/todo-comments.nvim', lazy = false, dependencies = 'nvim-telescope/telescope.nvim', - -- stylua: ignore - keys = { - { ']t', function() require('todo-comments').jump_next() end, desc = 'Next todo comment' }, - { '[t', function() require('todo-comments').jump_prev() end, desc = 'Previous todo comment' }, - { 'fdt', 'TodoTelescope', desc = 'todo' }, - { 'xt', 'TodoTrouble', desc = 'Todo (Trouble)' }, - { 'xT', 'TodoTrouble keywords=TODO,FIX,FIXME', desc = 'Todo/Fix/Fixme (Trouble)' }, - }, + -- stylua: ignore + keys = { + { ']t', function() require('todo-comments').jump_next() end, desc = 'Next todo comment' }, + { '[t', function() require('todo-comments').jump_prev() end, desc = 'Previous todo comment' }, + { 'fdt', 'TodoTelescope', desc = 'todo' }, + }, opts = { signs = true, keywords = { From 032dce6ecabb5c505ac7de83f1577fd4e1eb4a62 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 16:02:49 +0200 Subject: [PATCH 13/13] which keys is strong --- lua/custom/maps/init.lua | 4 ++-- lua/custom/plugins/telescope.lua | 2 +- lua/custom/plugins/ui.lua | 10 ++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lua/custom/maps/init.lua b/lua/custom/maps/init.lua index de07d1c..9561639 100644 --- a/lua/custom/maps/init.lua +++ b/lua/custom/maps/init.lua @@ -63,8 +63,8 @@ vim.keymap.set('n', 'w"', 'vnew', { desc = 'Split the window ve vim.keymap.set('n', 'w%', 'new', { desc = 'Split the window horizontally (new buffer)' }) -- window actions -vim.keymap.set('n', 'wbn', 'enew', { desc = 'Open a [N]ew [B]uffer' }) -vim.keymap.set('n', 'wbc', 'bw', { desc = '[C]lose current [B]uffer' }) -- :bd would keep in background +vim.keymap.set('n', 'wbn', 'enew', { desc = 'Open a [N]ew buffer' }) +vim.keymap.set('n', 'wbc', 'bw', { desc = '[C]lose current buffer' }) -- :bd would keep in background vim.keymap.set('n', '', 'resize +1', { desc = 'Resize window' }) vim.keymap.set('n', '', 'resize -1', { desc = 'Resize window' }) vim.keymap.set('n', '', 'vertical resize +1', { desc = 'Resize window vertically' }) diff --git a/lua/custom/plugins/telescope.lua b/lua/custom/plugins/telescope.lua index 284c8a1..b02ac40 100644 --- a/lua/custom/plugins/telescope.lua +++ b/lua/custom/plugins/telescope.lua @@ -118,7 +118,7 @@ return { end, { desc = '[F]ind [/] in Open Files' }) -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'fnf', function() + vim.keymap.set('n', 'fnf', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[F]ind [N]eovim [F]iles' }) end, diff --git a/lua/custom/plugins/ui.lua b/lua/custom/plugins/ui.lua index 7176583..86f09a3 100644 --- a/lua/custom/plugins/ui.lua +++ b/lua/custom/plugins/ui.lua @@ -192,18 +192,16 @@ return { local wk = require 'which-key' local defaults = { mode = { 'n', 'v' }, - [';'] = { name = '+telescope' }, - [';f'] = { name = '+find' }, + [''] = { name = '+select', f = { name = '[F]ind' } }, ['g'] = { name = '+goto' }, [']'] = { name = '+next' }, ['['] = { name = '+prev' }, - ['d'] = { name = '+[D]ebug' }, - ['c'] = { name = '+[C]ode/[C]olor' }, + ['d'] = { name = '+[D]ebug', w = { name = '[W]indow' }, c = { name = '[C]hange' } }, + ['c'] = { name = '+[C]ode/[C]olor', t = { name = '+[T]rouble' } }, ['g'] = { name = '+[G]ood tools' }, ['f'] = { name = '+[F]ormatting' }, ['r'] = { name = '[R]ename' }, - ['f'] = { name = '[F]ind' }, - ['w'] = { name = '[W]orkspace' }, + ['w'] = { name = '[W]orkspace', b = { name = 'buffer' } }, ['t'] = { name = '[T]oggle', ['๐Ÿšซ'] = 'which_key_ignore' }, } wk.register(defaults, opts)