Skip to content

Instantly share code, notes, and snippets.

@Konfekt
Konfekt / tag_preview.vim
Created March 18, 2025 09:32
mappings to navigate and preview keywords, tags and (macro) more conveniently
" :tjump opens a menu if multiple tags match whereas :tag does not
nnoremap <c-]> g<C-]>
xnoremap <c-]> g<C-]>
" open tag in preview window
nnoremap g] <c-w>g}<c-w>Pzv<c-w>p
xnoremap g] <c-w>g}<c-w>Pzv<c-w>p
" (forcefully) close preview window and jump back
nnoremap <silent><expr> g[ ':<c-u>silent! pclose<cr>:silent! '..v:count1..'pop<cr>'
@Konfekt
Konfekt / file_preview.vim
Last active March 28, 2025 18:14
preview file under cursor in Vim using ctags as fallback
" Adapted from https://github.com/drmikehenry/vimfiles/blob/e5c369dadde340ead7438b0c4937c3f470acf524/vimrc#L3239
"
" With --extra=+f in ~/.ctags respectively --extras=+f in
" ~/.config/ctags/default.ctags, filenames are tags, too, so
" the following mappings will work when a file isn't in the path.
"
" For automatic (C)tags generation, see either
" https://tbaggery.com or https://bolt80.com/gutentags/
nnoremap <silent> gf :<c-u>call <sid>gf("gf")<cr>
@Konfekt
Konfekt / qalc.md
Last active February 24, 2025 22:03
Calculate intuitvely inside Vim using Qalc's rich syntax
@Konfekt
Konfekt / uq.vim
Last active October 6, 2024 18:13
uq: grep interactively in (Neo)vim
" Add the following snippet to your vimrc or put it into (Neo)Vim's plugin dir
" to grep interactively in the current work dir.
" Open the topmost file in (Neo)Vim by hitting <F2>.
" Requires [ugrep](https://github.com/Genivia/ugrep), a drop-in alternative to grep
" similar to ripgrep.
let s:term = has('nvim') ? 'term' : 'term ++close'
let s:cmd = 'ugrep --config --query --no-confirm --view='..shellescape(v:progpath)
let s:cleanup = has('nvim') ? 'autocmd TermClose <buffer=abuf> if !v:event.status |bwipeout!| endif' : 'redraw!'
@Konfekt
Konfekt / zypper-aliases.sh
Last active September 26, 2024 06:47
Opensuse Zypper packagement aliases
#!/usr/bin/env bash
command -v zypper >/dev/null 2>&1 || return 1
# Zypper {{{1
zcommands=(
licenses ps shell source-download tos vcmp if patch-info pattern-info product-info pt se wp
)
len=${#zcommands[*]}
for (( i=0; i<len; i++ )); do
@Konfekt
Konfekt / apt-aliases.sh
Last active September 26, 2024 07:15
apt / apt-* / dpkg command-line aliases
#!/bin/bash
command -v apt >/dev/null 2>&1 || return 1
# apt commands {{{
apt_commands=(
"ls list"
"cl changelog"
"se search"
@Konfekt
Konfekt / better_gx.md
Last active January 21, 2025 10:40
Open links and files in browser

This has been included in :help netrw-handler

@Konfekt
Konfekt / filepicker.md
Last active November 3, 2024 05:52
Open files selected in LF/Yazi/Ranger/NNN in (Neo)Vim with :FilePicker
@Konfekt
Konfekt / project-local-viminfo.md
Last active September 21, 2024 05:48
Project-Local Viminfo
@Konfekt
Konfekt / msys2-pacman-packages.sh
Created August 21, 2024 20:44
Install a batch of useful MinGW tools
#!/bin/sh
pacman -S \
--needed \
base-devel \
mingw-w64-ucrt-x86_64-toolchain \
cmake \
mingw-w64-ucrt-x86_64-cmake-gui \
\
ctags \