Skip to content

Instantly share code, notes, and snippets.

@igemnace
igemnace / _aurclean
Last active May 30, 2020 09:43
Simple zsh completion widgets for my AUR scripts and functions. Put somewhere in your `fpath`.
#compdef aurclean
_files -W "${AUR_DIR:-$HOME/.aur}"
@igemnace
igemnace / aur-functions.sh
Created September 27, 2018 16:32
Convenience functions for working with my AUR scripts. Meant to be sourced in ~/.profile, ~/.bashrc, ~/.zshrc, etc.
aur() {
aurget "$@" && aurinstall "$@"
}
aurdeps() {
aurget "$@" && aurinstall --asdeps "$@"
}
reaur() {
aurupdate "$@" && aurinstall "$@"
@igemnace
igemnace / .makery.json(1)
Created May 10, 2018 03:37
.makery.json examples from my projects.
{
"lint": {
"compiler": "eslint"
},
"build": {
"makeprg": "adb shell input keyevent 82"
},
"tags": {
"makeprg": "es-ctags -R src"
}
@igemnace
igemnace / vim_and_definitions.md
Last active March 7, 2022 22:45
"Jump to Definition" in Vim

Vim and Definitions

Did you know Vim has a few builtin features designed to help with the "Jump to Definition" action you see in most IDEs?

Level 1: include and define

Since Vim is a "dumb" editor (that is, it doesn't do any static analysis on your text), you'd expect a "Jump to Definition" feature that relies on a simple text search.

@igemnace
igemnace / watchrun
Last active September 9, 2020 17:44
Watch file modifications with inotifywait and run arbitrary commands on those files
#!/usr/bin/env bash
# Depends on inotifywait, from inotify-tools
# Usage: watchrun dir... -- command...
# e.g. watchrun src -- ctags -a
dirs=()
until [[ $1 == -- ]]; do
dirs+=("$1")
@igemnace
igemnace / fzf_and_editors.md
Last active September 24, 2024 16:30
FZF and Text Editors

FZF and Text Editors

Because of the Unix-like nature of FZF (list through stdin, selection through stdout), it's very easy to come up with different uses for it.

One of my personal favorites is to select files to open in my text editor. Most basic would be:

$ vim "$(fzf)"
@igemnace
igemnace / vim_and_grep.md
Created April 19, 2018 06:07
Working with Grep and Vim

Working with Grep and Vim

The demo: [asciinema][1]

This workflow is in thanks to [a Reddit post by romainl][2].

Opening grep results directly in Vim

Sometimes, you just want to know where a string is found. In these cases, a simple

@igemnace
igemnace / incsearch.vim
Created November 6, 2017 04:25
Original behavior for incsearch.
augroup IncSearch
autocmd!
autocmd CmdLineEnter [/\?] set nohlsearch
autocmd CmdLineLeave [/\?] set hlsearch
augroup END
@igemnace
igemnace / template-lite.vim
Created October 24, 2017 02:11
Example for filetype-specific template replacement. Nice to go in your vimrc, or in $VIM/after/plugin/template-lite.vim.
function! TemplateReplace() abort
if expand('%') =~ glob2regpat('*.js')
" do JS-specific replacement
elseif expand('%') =~ glob2regpat('*.sh')
" do sh-specific replacement
endif
endfunction
augroup TemplateLite
autocmd!
@igemnace
igemnace / .bashrc
Created September 13, 2017 15:07
Snippets for an inotifywait loop to regenerate ctags.
watchdir() {
inotifywait -rme modify --format '%w%f' "$1"
}