Skip to content

Instantly share code, notes, and snippets.

@igemnace
igemnace / rofi-pass
Last active December 20, 2023 21:32
Rofi script to find a password from password-store and copy it to clipboard.
#!/usr/bin/env bash
cd "$HOME/.password-store" || exit 1
pass_name=$(fd --type file --exec echo '{.}' | rofi -dmenu -i -p "pass")
[[ -n $pass_name ]] || exit 1
if pass show -c "$pass_name"; then
notify-send --urgency=normal "$pass_name" "Password copied to clipboard!"
fi
@igemnace
igemnace / fzf-snippets.sh
Last active April 11, 2023 23:29
Some fzf snippets
fzf_argfiles() {
fzf --multi | tr '\n' ' '
}
# for unstaged changes and untracked files
fzf_dirty_files() {
git status --porcelain | cut -c 1,2,3 --complement | fzf --multi --preview-window=up:50% --preview='git diff --color=always {}'
}
fzf_modified_files() {
@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 / 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 / fzf_and_editors.md
Last active May 5, 2021 08:09
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 / 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 / _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 / 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