From e5a05cfcb2641d02e03e33d48bf2d74f27a303f9 Mon Sep 17 00:00:00 2001 From: juanito87 Date: Sat, 26 Apr 2025 12:04:04 -0300 Subject: [PATCH 1/3] Updating config, enabling more plugins, sort deprecation warnings --- lua/keymaps.lua | 37 ++++++++++--------- lua/lazy-config.lua | 5 ++- lua/plugins_config/code_runner.lua | 3 +- lua/plugins_config/gitsigns.lua | 4 +- .../{disabled => }/indent_line.lua | 0 lua/plugins_config/{disabled => }/lint.lua | 0 lua/plugins_config/lsp.lua | 2 +- lua/plugins_config/which-key.lua | 4 +- lua/plugins_config/worktree.lua | 1 - 9 files changed, 31 insertions(+), 25 deletions(-) rename lua/plugins_config/{disabled => }/indent_line.lua (100%) rename lua/plugins_config/{disabled => }/lint.lua (100%) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 558a0e44..b281c815 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -1,12 +1,13 @@ -- [[ Basic Keymaps ]] --- See `:help vim.keymap.set()` +-- NOTE: See `:help vim.keymap.set()` -- vim.keymap.set( required, required, required, not required) + -- Set highlight on search, but clear on pressing in normal mode vim.keymap.set('n', '', 'nohlsearch', { desc = 'Remove higlight after search is done' }) -- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) +vim.keymap.set('n', '[d', function() vim.diagnostic.goto({ direction = 'prev', float = false }) end, { desc = 'Go to previous [D]iagnostic message' }) +vim.keymap.set('n', ']d', function() vim.diagnostic.goto({ direction = 'next', float = false }) end, { desc = 'Go to next [D]iagnostic message' }) vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) @@ -21,21 +22,20 @@ vim.keymap.set('n', 'pv', vim.cmd.Ex, { desc = 'Open netrw' }) -- open n vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- Keybinds to make split navigation easier. --- Use CTRL+ to switch between windows +-- NOTE: 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' }) --- TODO add more comments, do some improvements on those. -- copy pasting -vim.keymap.set('n', 'Y', 'y$', { desc = 'Yank till the end of the line' }) -- yanks till the end of the line, like C for change or D for delete +vim.keymap.set('n', 'Y', 'y$', { desc = 'Yank till the end of the line' }) vim.keymap.set('n', 'J', 'mzJ`z', { desc = 'Marks the point (mz), joins the lines (J) and gets back to the marked place (`z)' }) vim.keymap.set({ 'n', 'v' }, 'y', '"+y', { desc = 'Prefix y with leader to send to system clipboard' }) -vim.keymap.set({ 'n', 'v' }, 'Y', '"+Y', { desc = 'Prefix y with leader to send to system clipboard' }) -vim.keymap.set('x', 'p', '"+p', { desc = 'Deletes to void registry to avoid changing registry content' }) -vim.keymap.set('x', 'P', '"_dP', { desc = 'Deletes to void registry to avoid changing registry content' }) +vim.keymap.set({ 'n', 'v' }, 'Y', '"+Y', { desc = 'Prefix Y with leader to send to system clipboard' }) +vim.keymap.set('x', 'p', '"+p', { desc = 'Paste from clipboard over the selection, without chaging the clipboard registry("+).' }) +vim.keymap.set('x', 'P', '"_dP', { desc = 'Deletes to void registry("_) to avoid changing registry("0) content, and then pastes from clipboard' }) -- Search remaps vim.keymap.set('n', 'n', 'nzzzv', { desc = 'n = next search, zz = center cursor on screen, zv = open fold if exist' }) @@ -66,20 +66,23 @@ vim.keymap.set('n', '', '', { desc = 'Close window with ctrl+c' } vim.keymap.set({ 'i', 'v', 'n', 's' }, '', 'w', { desc = 'Save file' }) -- Function and remap to toggle relative numbers. -vim.keymap.set('n', 'nr', function() - vim.opt.nu = false - vim.opt.relativenumber = false -end, { desc = 'Disable number and relative number' }) -vim.keymap.set('n', 'rn', function() - vim.opt.nu = true - vim.opt.relativenumber = true -end, { desc = 'Enable number and relative number' }) +vim.keymap.set('n', 'nr', function() vim.opt.nu = false vim.opt.relativenumber = false end, { desc = 'Disable number and relative number' }) +vim.keymap.set('n', 'rn', function() vim.opt.nu = true vim.opt.relativenumber = true end, { desc = 'Enable number and relative number' }) -- Clean up vim.keymap.set('n', 'dw', ':%s/\\s\\+$//e', { desc = 'Clean trailing whitespace in the document' }) vim.keymap.set('n', 'dn', ':%s/\\n\\+\\%$//e', { desc = 'Clean trailing newlines in the document' }) vim.keymap.set('n', 'ds', ':%s/\\^\\[\\+\\%$//e', { desc = 'Clean trailing escape sequences in the document' }) +-- Code runner keymaps +vim.keymap.set('n', 'rr', ':RunCode', { noremap = true, silent = false }) +vim.keymap.set('n', 'rf', ':RunFile', { noremap = true, silent = false }) +vim.keymap.set('n', 'rft', ':RunFile tab', { noremap = true, silent = false }) +vim.keymap.set('n', 'rp', ':RunProject', { noremap = true, silent = false }) +vim.keymap.set('n', 'rc', ':RunClose', { noremap = true, silent = false }) +vim.keymap.set('n', 'crf', ':CRFiletype', { noremap = true, silent = false }) +vim.keymap.set('n', 'crp', ':CRProjects', { noremap = true, silent = false }) + -- Testing remaps and functions -- better indenting diff --git a/lua/lazy-config.lua b/lua/lazy-config.lua index 932cdbca..cf0b5761 100644 --- a/lua/lazy-config.lua +++ b/lua/lazy-config.lua @@ -17,8 +17,7 @@ require('lazy').setup({ -- One liners -- Highlight todo, notes, etc in comments - { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, - -- { 'CRAG666/code_runner.nvim', config = true }, -- Execute code within nvim. + -- { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, -- Plugins with custom values require 'plugins_config/which-key', -- Show created key bindings @@ -34,6 +33,8 @@ require('lazy').setup({ require 'plugins_config/tree-sitter', -- manage lint, indentation and some othe language related tasks require 'plugins_config/harpoon', -- Improve workflow for multiple files require 'plugins_config/code_runner', -- Code runner + require 'plugins_config/indent_line', -- visualize indentation + require 'plugins_config/lint', -- Add inting to files to complement tree sitter -- require 'plugins_config/copilot', -- copilot config -- Broken configs/Testing config diff --git a/lua/plugins_config/code_runner.lua b/lua/plugins_config/code_runner.lua index d134c11e..103cc938 100644 --- a/lua/plugins_config/code_runner.lua +++ b/lua/plugins_config/code_runner.lua @@ -4,7 +4,8 @@ return { require('code_runner').setup { filetype = { python = 'python3 -u', - typescript = 'deno run', + javascript = 'node $file', + typescript = 'ts-node $file', rust = { 'cd $dir &&', 'rustc $fileName &&', diff --git a/lua/plugins_config/gitsigns.lua b/lua/plugins_config/gitsigns.lua index c3c446b9..bbd91a0f 100644 --- a/lua/plugins_config/gitsigns.lua +++ b/lua/plugins_config/gitsigns.lua @@ -46,7 +46,7 @@ return { map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) @@ -56,7 +56,7 @@ return { end, { desc = 'git [D]iff against last commit' }) -- Toggles map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) + map('n', 'tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) end, }, } diff --git a/lua/plugins_config/disabled/indent_line.lua b/lua/plugins_config/indent_line.lua similarity index 100% rename from lua/plugins_config/disabled/indent_line.lua rename to lua/plugins_config/indent_line.lua diff --git a/lua/plugins_config/disabled/lint.lua b/lua/plugins_config/lint.lua similarity index 100% rename from lua/plugins_config/disabled/lint.lua rename to lua/plugins_config/lint.lua diff --git a/lua/plugins_config/lsp.lua b/lua/plugins_config/lsp.lua index b3a21482..175f5140 100644 --- a/lua/plugins_config/lsp.lua +++ b/lua/plugins_config/lsp.lua @@ -83,7 +83,7 @@ return { -- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. - map('rn', vim.lsp.buf.rename, '[R]e[n]ame') + map('Rn', vim.lsp.buf.rename, '[R]e[n]ame') -- Execute a code action, usually your cursor needs to be on top of an error -- or a suggestion from your LSP for this to activate. diff --git a/lua/plugins_config/which-key.lua b/lua/plugins_config/which-key.lua index cce7e5ed..0dfbdebd 100644 --- a/lua/plugins_config/which-key.lua +++ b/lua/plugins_config/which-key.lua @@ -12,8 +12,10 @@ return { -- Useful plugin to show you pending keybinds. { 'd_', hidden = true }, { 'h', group = 'Git [H]unk' }, { 'h_', hidden = true }, - { 'r', group = '[R]ename' }, + { 'r', group = '[R]un code' }, { 'r_', hidden = true }, + { 'R', group = '[R]e[n]ame' }, + { 'R_', hidden = true }, { 's', group = '[S]earch' }, { 's_', hidden = true }, { 't', group = '[T]oggle' }, diff --git a/lua/plugins_config/worktree.lua b/lua/plugins_config/worktree.lua index ddc1fab5..b85660e2 100644 --- a/lua/plugins_config/worktree.lua +++ b/lua/plugins_config/worktree.lua @@ -1,5 +1,4 @@ return { - 'ThePrimeagen/git-worktree.nvim', -- Manage worktrees from nvim opts = { change_directory_command = 'tcd', -- command to change directory (e.g. lcd for NvimTree) From 25148b1098efa610b1955f7ee273b10a2ed5467d Mon Sep 17 00:00:00 2001 From: juanito87 Date: Sun, 11 May 2025 16:20:43 -0300 Subject: [PATCH 2/3] test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8ace8b9b..2232c655 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ A starting point for Neovim that is: * Single-file * Completely Documented + **NOT** a Neovim distribution, but instead a starting point for your configuration. ## Installation From 8ad2208c3851d4168a91600fa7cf9cd1c95978af Mon Sep 17 00:00:00 2001 From: juanito87 Date: Mon, 12 May 2025 16:24:49 -0300 Subject: [PATCH 3/3] Fix typos. --- lua/plugins_config/colortheme.lua | 2 +- lua/plugins_config/lsp.lua | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/plugins_config/colortheme.lua b/lua/plugins_config/colortheme.lua index 1b2f55c6..cc191ade 100644 --- a/lua/plugins_config/colortheme.lua +++ b/lua/plugins_config/colortheme.lua @@ -17,4 +17,4 @@ return { -- You can easily change to a different colorscheme. -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. vim.cmd.colorscheme 'tokyonight-night' end, - }, -- + } diff --git a/lua/plugins_config/lsp.lua b/lua/plugins_config/lsp.lua index 8fb24190..22893a14 100644 --- a/lua/plugins_config/lsp.lua +++ b/lua/plugins_config/lsp.lua @@ -266,7 +266,7 @@ return { }, } end, -} + { -- Autocompletion 'saghen/blink.cmp', event = 'VimEnter', @@ -365,3 +365,4 @@ return { signature = { enabled = true }, }, }, +}