This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Check Python code snippets on the fly with pyrefly. | |
| " Put into ~/.vim/plugins` and use the mapping `g4` on a visual selection or a text object. | |
| if exists('g:loaded_pyrefly_operator') | finish | endif | |
| let g:loaded_pyrefly_operator = 1 | |
| if !executable('pyrefly') | finish | endif | |
| let s:pyrefly_efm = join([ | |
| \ '%E%\s%#ERROR %m', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Generate compile_commands.json for clangd. | |
| " Prefer CMake export, else Ninja compdb, else Bear + Make with optional append. | |
| if exists('b:did_c_compdb_ftplugin') | finish | endif | |
| let b:did_c_compdb_ftplugin = 1 | |
| let s:inflight = {} | |
| augroup c_compdb | |
| autocmd! * <buffer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Automatically add a mutt alias for the sender of each email you open. | |
| # To use it, add to your muttrc (assuming the script is in your $PATH): | |
| # | |
| # set alias_file=~/.mutt/aliases | |
| # set display_filter = 'auto-add_alias.sh ~/.mutt/aliases' | |
| # | |
| # Originally from https://web.archive.org/web/20130307065724/http://wcm1.web.rice.edu/mutt-tips.html and | |
| # refined at https://github.com/teddywing/mutt-alias-auto-add |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| CLI transcription tool using OpenAI Audio Transcriptions REST API. | |
| Requires environment variable OPENAI_API_KEY to be set. | |
| - Accepts multiple inputs: files, directories, or glob patterns. | |
| - Writes outputs next to inputs with .txt extension by default. | |
| - If -o/--output is supplied: | |
| * For multiple inputs: treated as an output directory. | |
| * For a single input: treated as a file path if it has a suffix; otherwise as a directory. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| my ($pattern, $grabnext); | |
| for (@ARGV) { | |
| if ($grabnext or not /^-/) { | |
| $pattern = $_; | |
| last; | |
| } elsif (/^--$/) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Set &grepprg to rg, ugrep, git grep or grep otherwise. | |
| " Assumes a global ignore file `$XDG_CONFIG_HOME/grep/ignore`; create it by, | |
| " say `touch ~/.config/grep/ignore` to ensure its existence. | |
| augroup vimrcGrep | |
| autocmd! | |
| augroup END | |
| " Scheduling niceness on Linux. | |
| let s:scheduler = (has('unix') && executable('chrt') && executable('ionice')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let s:nul = ' 2> ' .. (has('win32') ? 'nul' : '/dev/null') | |
| function! s:outside_repo() abort | |
| if exists('*FugitiveGitDir') | |
| return empty(FugitiveGitDir()) | |
| else | |
| " let outside_repo = empty(finddir('.git', getcwd().';')) && empty(findfile('.git', getcwd().';')) | |
| silent let repo = system('git rev-parse --is-inside-work-tree' .. s:nul .. ' 1>&2') | |
| return v:shell_error != 0 | |
| endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nnoremap <silent><expr> <plug>(FixLastBadSpell) $"\<Cmd>call <SID>FixLastBadSpell()\<CR>" | |
| nnoremap <silent><expr> <C-q> &l:spell ? "\<plug>(FixLastBadSpell)" : "<C-q>" | |
| inoremap <silent><expr> <plug>(FixLastBadSpell) $"\<Cmd>call <SID>FixLastBadSpell()\<CR>" | |
| inoremap <silent><expr> <C-q> &l:spell ? "\<plug>(FixLastBadSpell)" : "<C-q>" | |
| function! s:FixLastBadSpell() abort | |
| " Save current position to return to later. | |
| let last_changedtick = b:changedtick | |
| let last_line_length = len(getline('.')) | |
| let position = getpos('.')[1:3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " :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>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " 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> |