Updated Yazi: version, hop plugin, glow preview

This commit is contained in:
Thomas Naderer
2025-05-30 23:30:44 +02:00
parent b3cb8b7fdf
commit 85ef8dca72
11 changed files with 324 additions and 87 deletions

View File

@@ -13,7 +13,6 @@ local keymap = vim.api.nvim_set_keymap
-- command_mode = 'c',
-------------------------------------------------------------------------------
-- set space as leader key
vim.g.mapleader = " " -- Set space as the leader key
vim.g.maplocalleader = " " -- Optional: set local leader key to space as well
@@ -22,14 +21,14 @@ keymap("n", ";", ":", opt)
keymap("n", ":", ";", opt)
-- no arrows, move the vim way
keymap("n", "<up>", "<nop>", opts)
keymap("n", "<down>", "<nop>", opts)
keymap("n", "<left>", "<nop>", opts)
keymap("n", "<right>", "<nop>", opts)
keymap("i", "<up>", "<nop>", opts)
keymap("i", "<down>", "<nop>", opts)
keymap("i", "<left>", "<nop>", opts)
keymap("i", "<right>", "<nop>", opts)
-- keymap("n", "<up>", "<nop>", opts)
-- keymap("n", "<down>", "<nop>", opts)
-- keymap("n", "<left>", "<nop>", opts)
-- keymap("n", "<right>", "<nop>", opts)
-- keymap("i", "<up>", "<nop>", opts)
-- keymap("i", "<down>", "<nop>", opts)
-- keymap("i", "<left>", "<nop>", opts)
-- keymap("i", "<right>", "<nop>", opts)
-- lazy write / quit
keymap("n", "<leader>w", ":w<cr>", opts)
@@ -43,12 +42,17 @@ keymap("n", "<leader>WQ", ":wq!<cr>", opts)
keymap("n", "j", "gj", opts)
keymap("n", "k", "gk", opts)
-- toggle relativenumber
keymap("n", "<leader>r", ":set number invrnu<cr>", opts)
-- easy folding
-- toggle fold under cursor no jumping around
keymap("n", "z", "za<space>0", opts)
-- toggle linenumber
vim.keymap.set("n", "<leader>n", function()
if vim.wo.number and vim.wo.relativenumber then
vim.wo.number = false
vim.wo.relativenumber = false
elseif vim.wo.number then
vim.wo.relativenumber = true
else
vim.wo.number = true
end
end, { desc = "Toggle line number modes" })
-- maintaining visual mode after shifting > and <
keymap("v", ">", ">gv", opts)
@@ -82,19 +86,18 @@ keymap("n", "c", '"_c', opts)
keymap("n", "C", '"_C', opts)
-- toggle cursorcolumn
keymap("n", "<leader>c", ":set cursorcolumn!<cr>", opts)
-- toggle netrw
keymap("n", "<leader>nd", ":Lexplore %:p:h<cr>", opts)
keymap("n", "<leader>n", ":Lexplore<cr>", opts)
keymap("n", "<leader>c", ":set cursorcolumn! cursorline! <cr>", opts)
-- clear highlighting from the search
keymap("n", "<esc>", ":nohlsearch<cr><esc>", opts)
-- toggle spell checking
keymap("n", "<leader>s", ":setlocal spell! spelllang=en_us,nl<cr>", opts)
keymap("n", "<leader>se", ":setlocal spell! spelllang=en_us,nl<cr>", opts)
keymap("n", "<leader>sd", ":setlocal spell! spelllang=de_at,nl<cr>", opts)
-- date time stamp
keymap("n", "<leader>dt", [[i<c-r>=strftime("%d.%m.%Y")<cr><space>]], opts)
keymap("n", "<leader>tt", [[i<c-r>=strftime("%H:%M")<cr><space>]], opts)
-- double space over word to find and replace
keymap("n", "<space><space>", [[:%s/\<<c-r>=expand("<cword>")<cr>\>/]], opt)
@@ -106,21 +109,26 @@ keymap("c", "w!!", [[w !sudo tee %]], opt)
keymap("n", "<leader>df", [[:w !diff % -<cr>]], opt)
keymap("x", "<leader>df", [[:w !diff % -<cr>]], opt)
-- Yank to System Clipbpard
keymap("x", "Y", '"+y', opt)
keymap("n", "<leader>y", ':Yazi<cr>', opt)
-- place this in one of your configuration file(s)
local hop = require('hop')
local directions = require('hop.hint').HintDirection
vim.keymap.set('', 'f', function()
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true })
hop.hint_char1({ direction = directions.AFTER_CURSOR, })
end, {remap=true})
vim.keymap.set('', 'F', function()
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
hop.hint_char1({ direction = directions.BEFORE_CURSOR, })
end, {remap=true})
vim.keymap.set('', 't', function()
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })
hop.hint_char1({ direction = directions.AFTER_CURSOR, hint_offset = -1 })
end, {remap=true})
vim.keymap.set('', 'T', function()
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })
hop.hint_char1({ direction = directions.BEFORE_CURSOR, hint_offset = 1 })
end, {remap=true})
vim.keymap.set('n', '<Left>', '<C-w>h', { noremap = true })
vim.keymap.set('n', '<Right>', '<C-w>l', { noremap = true })
vim.keymap.set('n', '<Up>', '<C-w>k', { noremap = true })
vim.keymap.set('n', '<Down>', '<C-w>j', { noremap = true })