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

@@ -0,0 +1,41 @@
local cmp = require('cmp')
local luasnip = require('luasnip')
require("luasnip.loaders.from_vscode").lazy_load() -- Load friendly-snippets
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/snippets" }) -- Load custom Lua snippets
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- Use LuaSnip for expanding snippets
end,
},
mapping = {
['<C-Space>'] = cmp.mapping.complete(), -- Trigger completion manually
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Confirm completion
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' }, -- LSP suggestions
{ name = 'luasnip' }, -- Snippets
{ name = 'buffer' }, -- Buffer words
{ name = 'path' }, -- File paths
})
})

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 })

View File

@@ -5,7 +5,6 @@ require('packer').startup(function(use)
-- {{{ Packer manages itself
use 'wbthomason/packer.nvim' -- Packer manages itself
-- }}}
-- {{{ VIM AutoSave
use({
'okuuva/auto-save.nvim',
@@ -18,7 +17,6 @@ require('packer').startup(function(use)
end,
})
-- }}}
-- {{{ Nvim-Tree
use {
'nvim-tree/nvim-tree.lua',
@@ -27,12 +25,10 @@ require('packer').startup(function(use)
end,
}
-- }}}
-- {{{ Themes
use 'gruvbox-community/gruvbox' -- Gruvbox theme
use 'folke/tokyonight.nvim' -- Tokyo Night theme
-- }}}
-- {{{ Treesitter
use {
'nvim-treesitter/nvim-treesitter',
@@ -40,17 +36,14 @@ require('packer').startup(function(use)
}
require('plugins.treesitter')
-- }}}
-- {{{ Rainbow Delimiters
use 'HiPhish/rainbow-delimiters.nvim'
require('plugins.rainbow_delimiters')
-- }}}
-- {{{ Git Integration
use 'lewis6991/gitsigns.nvim' -- Git decorations in the gutter
use 'tpope/vim-fugitive' -- Git commands in Neovim
-- }}}
-- {{{ Status Line
use {
'nvim-lualine/lualine.nvim',
@@ -64,14 +57,12 @@ require('packer').startup(function(use)
highlight lualine_c_normal guibg=NONE
]]
-- }}}
-- {{{ HardTime
use {
'm4xshen/hardtime.nvim',
requires = { 'MunifTanjim/nui.nvim' }
}
-- }}}
-- {{{ FZF
use {
'junegunn/fzf',
@@ -79,39 +70,29 @@ require('packer').startup(function(use)
}
use 'junegunn/fzf.vim'
-- }}}
-- {{{ Productivity
use 'numToStr/Comment.nvim'
use 'windwp/nvim-autopairs'
use 'tpope/vim-surround'
-- }}}
-- {{{ LaTeX
use 'lervag/vimtex'
require('plugins.vimtex')
-- }}}
-- {{{ Outline
use {
'hedyhli/outline.nvim',
config = function()
require('plugins.outline').setup()
end
}
-- -- {{{ Outline
-- use {
-- 'hedyhli/outline.nvim',
-- config = function()
-- require('plugins.outline').setup()
-- end
-- }
-- }}}
-- {{{ Org-Mode
use {'nvim-orgmode/orgmode', config = function()
require('orgmode').setup{}
end
}
--}}}
-- {{{ Autocompletions
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
-- }}}
-- {{{ Telescope
use {
'nvim-telescope/telescope.nvim',
@@ -129,7 +110,6 @@ require('packer').startup(function(use)
end
}
-- }}}
-- Yazi.nvim {{{
use({
"mikavilpas/yazi.nvim",
@@ -144,16 +124,59 @@ require('packer').startup(function(use)
end,
})
--- }}}
use {
-- Hop.nvim {{{
use {
'phaazon/hop.nvim',
branch = 'v2', -- optional but strongly recommended
config = function()
-- you can configure Hop the way you like here; see :h hop-config
require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
end
}
}
-- }}}
-- nvim.cmp {{{
use {
'hrsh7th/nvim-cmp',
requires = {
'hrsh7th/cmp-buffer', -- Buffer completions
'hrsh7th/cmp-path', -- Path completions
'hrsh7th/cmp-nvim-lsp', -- LSP completions
'hrsh7th/cmp-nvim-lua', -- Neovim API completions
'saadparwaiz1/cmp_luasnip', -- Snippet completions
'L3MON4D3/LuaSnip', -- Snippet engine
'rafamadriz/friendly-snippets', -- Predefined snippets
'evesdropper/luasnip-latex-snippets.nvim'
}
}
-- }}}
-- Markdown {{{
use 'SidOfc/mkdx'
use({
'MeanderingProgrammer/render-markdown.nvim',
after = { 'nvim-treesitter' },
-- requires = { 'echasnovski/mini.nvim', opt = true }, -- if you use the mini.nvim suite
requires = { 'echasnovski/mini.icons', opt = true }, -- if you use standalone mini plugins
-- requires = { 'nvim-tree/nvim-web-devicons', opt = true }, -- if you prefer nvim-web-devicons
config = function()
require('render-markdown').setup({})
end,
})
-- }}}
-- Code Formatting {{{
use({
"nvimtools/none-ls.nvim",
config = function()
requires = { "nvim-lua/plenary.nvim" },
require("plugins.prettier")
end,
})
-- }}}
-- Zotero Integration (deactivated){{{
-- use {
-- 'jalvesaq/zotcite',
-- requires = {
-- 'vim-pandoc/vim-pandoc',
-- 'vim-pandoc/vim-pandoc-syntax'
-- }
-- }}}
end)
require'hop'.setup()

View File

@@ -0,0 +1,20 @@
local null_ls = require("null-ls")
null_ls.setup({
debug = false, -- set to true if you want log spam
sources = {
null_ls.builtins.formatting.prettier.with({
filetypes = { "markdown", "markdown.pandoc", "pandoc" },
}),
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
end,
})

View File

@@ -1,15 +1,22 @@
require'nvim-treesitter.configs'.setup {
ensure_installed = { "c", "lua", "python", "javascript", "markdown", "html", "css"}, -- Add languages you use
sync_install = false, -- Install parsers asynchronously
auto_install = true, -- Automatically install missing parsers
ensure_installed = { "c", "lua", "python", "javascript", "markdown", "markdown_inline", "html", "css" },
sync_install = false,
auto_install = true,
highlight = {
enable = true, -- Enable syntax highlighting
additional_vim_regex_highlighting = false, -- Avoid slow fallback regex highlighting
enable = true,
disable = function(lang, buf)
local filename = vim.api.nvim_buf_get_name(buf)
if lang == "latex" or filename:match("%.bib$") then
return true
end
return false
end,
},
indent = {
enable = true -- Enable indentation support
enable = true,
disable = { "tex", "bib", "markdown" }
},
incremental_selection = {
@@ -23,3 +30,7 @@ require'nvim-treesitter.configs'.setup {
},
}
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldlevel = 2
vim.opt.foldenable = true

View File

@@ -8,6 +8,8 @@ vim.g.vimtex_view_skim_activate = 1 -- Activate Skim on compilation
vim.g.vimtex_compiler_method = 'latexmk' -- Use latexmk for LaTeX compilation
vim.g.vimtex_quickfix_mode = 0 -- Disable automatic quickfix window
vim.g.vimtex_syntax_enabled = 1 -- Enable VimTeX syntax highlighting
vim.g.vimtex_fold_enabled = 1 -- Enable VimTeX syntax highlighting
vim.g.vimtex_format_enabled = 1 -- Enable VimTeX syntax highlighting
-- Custom TeX Engine Commands
vim.api.nvim_create_user_command(

View File

@@ -3,6 +3,14 @@ vim.opt.tabstop = 4 -- Number of spaces that a <Tab> counts for
vim.opt.shiftwidth = 4 -- Number of spaces for indentation
vim.opt.expandtab = true -- Use spaces instead of tabs
vim.cmd [[highlight CursorLine guibg=#3c3836]] -- Darker background for the line
vim.cmd [[highlight CursorColumn guibg=#504945]] -- Slightly darker for the column
vim.cmd [[set incsearch ]] -- Enables incremental search
vim.cmd [[set hlsearch ]] -- Highlights search results
vim.cmd [[set ignorecase]] -- Case insensitive search
vim.cmd [[set smartcase ]] -- Case sensitive if uppercase letters are used
-- Coloscheme
vim.cmd [[colorscheme gruvbox]]
@@ -13,3 +21,6 @@ vim.cmd([[
highlight Normal ctermbg=none guibg=none
highlight NonText ctermbg=none guibg=none
]])
vim.o.title = true
vim.o.titlestring = "nvim: %f"

View File

@@ -0,0 +1,23 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
-- Get current date in YYYY-MM-DD format
local function date()
return os.date("%Y-%m-%d")
end
return {
s("env", {
t({"---",
"title: "}), i(1, "Title"), t({"",
"tags: ["}), i(2, "tag1, tag2"), t({"]",
"date: "}), f(date, {}), t({"",
"---", ""}),
i(0),
}),
}

80
nvim/lua/snippets/tex.lua Normal file
View File

@@ -0,0 +1,80 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
return {
s("psb", {
-- Header + packages
t({
"\\documentclass[a4paper]{scrartcl}",
"\\usepackage[utf8]{inputenc}",
"\\usepackage[ngerman]{babel}",
"\\usepackage{graphicx}",
"\\usepackage{tikz}",
"\\usepackage{setspace}",
"\\usepackage{eso-pic}",
"",
"\\title{"}), i(1, "Projektstatusbericht"),
t({"}",
"\\author{"}), i(2, "Thomas Naderer"),
t({"}",
"\\date{"}), f(function() return os.date("%d.%m.%Y") end, {}),
t({
"}",
"",
"% Logo oben links",
"\\AddToShipoutPictureBG*{%",
" \\begin{tikzpicture}[remember picture,overlay]",
" \\node[anchor=north west, yshift=-1cm, xshift=1cm]",
" at (current page.north west) {%",
" \\includegraphics[height=10mm]{../img/ippd_logo.jpg}",
" };",
" \\end{tikzpicture}",
"}",
"",
"\\begin{document}",
"\\maketitle",
""
}),
-- Projekt 1
t({"\\section*{"}), i(3, "Projekt 1 Titel"), t({"}"}),
t({"\\textbf{Momentaner Stand:}", ""}),
i(4, "Kurze Beschreibung..."),
t({"",
"\\begin{itemize}",
" \\item "}), i(5, "Punkt 1"),
t({"",
" \\item "}), i(6, "Punkt 2"),
t({"",
" \\item "}), i(7, "Punkt 3"),
t({
"",
"\\end{itemize}",
"\\hrule",
""
}),
-- Projekt 2
t({"\\section*{"}), i(8, "Projekt 2 Titel"), t({"}"}),
t({"\\textbf{Momentaner Stand:}", ""}),
i(9, "Kurze Beschreibung..."),
t({"",
"\\begin{itemize}",
" \\item "}), i(10, "Punkt 1"),
t({"",
" \\item "}), i(11, "Punkt 2"),
t({"",
" \\item "}), i(12, "Punkt 3"),
t({
"",
"\\end{itemize}",
"\\hrule",
"",
"\\end{document}"
}),
i(0),
}),
}

View File

@@ -1,8 +1,8 @@
# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config.
#. A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config.
# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas.
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"
[manager]
[mgr]
keymap = [
@@ -127,23 +127,36 @@ keymap = [
# Goto
{ on = [ "g", "h" ], run = "cd ~", desc = "Go home" },
{ on = [ "g", "c" ], run = "cd ~/.config", desc = "Goto ~/.config" },
{ on = [ "g", "v" ], run = "cd /Volumes", desc = "Goto /Volumes" },
#Media and Docs
{ on = [ "g", "d" ], run = "cd ~/Downloads", desc = "Goto ~/Downloads" },
{ on = [ "g", "D" ], run = "cd ~/Documents", desc = "Goto ~/Documents" },
{ on = [ "g", "t" ], run = "cd ~/Torrents", desc = "Goto ~/Torrents" },
{ on = [ "g", "t" , "<Space>" ], run = "cd ~/Torrents", desc = "Goto ~/Torrents" },
{ on = [ "g", "t", "b"], run = "cd ~/Torrents/Books", desc = "Goto Books" },
{ on = [ "g", "t", "a"], run = "cd ~/Torrents/Audiobooks", desc = "Goto Books" },
{ on = [ "g", "t", "s"], run = "cd ~/Torrents/Shows", desc = "Goto Shows" },
{ on = [ "g", "t", "m"], run = "cd ~/Torrents/Movies", desc = "Goto Shows" },
{ on = [ "g", "s" ], run = "cd \"~/Music/Sheet Music/Alto Saxophone\"", desc = "Goto Sax Sheets" },
{ on = [ "g", "o" ], run = "cd ~/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/Privat", desc = "Goto ~/Obsidian" },
{ on = [ "g", "v" ], run = "cd /Volumes", desc = "Goto /Volumes" },
{ on = [ "g", "<Space>" ], run = "cd --interactive", desc = "Jump interactively" },
#Studies
{ on = [ "g", "j", "b" ], run = "cd \"~/Documents/JKU/Studium/BWL\"", desc = "Goto BWL" },
{ on = [ "g", "j", "w" ], run = "cd \"~/Documents/JKU/Work\"", desc = "Goto Work(local)" },
{ on = [ "g", "o", "p" ], run = "cd ~/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/Privat/", desc = "Goto Obsidian/Privat" },
{ on = [ "g", "o", "d" ], run = "shell --confirm 'touch $(date +%F).md'", desc = "Create Daily Note in Obsidian" },
{ on = [ "g", "o", "w" ], run = "cd ~/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/Work/", desc = "Goto Obsidian/Work" },
#Work Related - Network drive
{ on = [ "g", "a" ], run = "cd /Volumes/AK127132", desc = "Goto AK127132" },
{ on = [ "g", "z" ], run = "cd /Volumes/AK127132/Zeitaufzeichnung", desc = "Goto Zeitaufzeichnung" },
{ on = [ "g", "i" ], run = "cd /Volumes/ipec/intern", desc = "Goto Intern" },
{ on = [ "g", "B" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P54_Brückner EDIH\"", desc = "Goto Brückner" },
{ on = [ "g", "S" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P42b_Senoplast SenoSmartCoex\"", desc = "Goto SenoSmartCoex" },
{ on = [ "g", "I" ], run = "cd \"/Volumes/ipec/intern/05_Institutsbesprechungen\"", desc = "Goto Institutsbesprechungen" },
{ on = [ "g", "a", "<Space>" ], run = "cd /Volumes/AK127132", desc = "Goto AK127132" },
{ on = [ "g", "a", "z" ], run = "cd /Volumes/AK127132/Zeitaufzeichnung", desc = "Goto Zeitaufzeichnung" },
{ on = [ "g", "i", "<Space>" ], run = "cd /Volumes/ipec/intern", desc = "Goto Intern" },
{ on = [ "g", "p", "b" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P54_EDIH TBI 80 Brückner\"", desc = "Goto Brückner" },
{ on = [ "g", "p", "s" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P42b_Senoplast SenoSmartCoex\"", desc = "Goto SenoSmartCoex" },
{ on = [ "g", "i", "p" ], run = "cd \"/Volumes/ipec/intern/05_Institutsbesprechungen/Projektstatusberichte\"", desc = "Goto Projektstatusberichte" },
{ on = [ "g", "i", "b" ], run = "cd \"/Volumes/ipec/intern/05_Institutsbesprechungen\"", desc = "Goto Institutsbesprechungen" },
{ on = [ "g", "<Space>" ], run = "cd --interactive", desc = "Jump interactively" },
{ on = "R", run = "open -a \"Finder\" .", desc = "Open current folder in Finder" },
{ on = "R", run = "open -a Finder .", desc = "Open current folder in Finder" },
# Tabs
{ on = "t", run = "tab_create --current", desc = "Create a new tab with CWD" },
@@ -369,7 +382,7 @@ keymap = [
{ on = "f", run = "filter", desc = "Apply a filter for the help items" },
]
[[manager.prepend_keymap]]
[[mgr.prepend_keymap]]
on = "f"
run = "plugin jump-to-char"
desc = "Jump to char"

View File

@@ -7,5 +7,10 @@ play = [
]
[mgr]
ratio = [2, 6, 5] # left, center, right pane width ratios
[plugin]
prepend_previewers = [
{ name = "*.md", run = "glow" },
]