Skip to content

Instantly share code, notes, and snippets.

View gilbertw1's full-sized avatar

Bryan Gilbert gilbertw1

View GitHub Profile
(defun counsel-projectile-bookmark ()
"Forward to `bookmark-jump' or `bookmark-set' if bookmark doesn't exist."
(interactive)
(require 'bookmark)
(let ((projectile-bookmarks (projectile-bookmarks)))
(ivy-read "Create or jump to bookmark: "
projectile-bookmarks
:action (lambda (x)
(cond ((and counsel-bookmark-avoid-dired
(member x projectile-bookmarks)
@gilbertw1
gilbertw1 / preview
Last active October 23, 2017 15:53
Awesome rg search
#!/bin/sh
FILE_LINE_NO="$1"
FILE="$(echo "$FILE_LINE_NO" | cut -d":" -f1)"
SUFFIX="$(echo $FILE | cut -d"." -f2)"
LINE_NO="$(echo "$FILE_LINE_NO" | cut -d":" -f2)"
if [ "$LINE_NO" -gt 10 ]
then
START="$((${LINE_NO} - 10))"
@gilbertw1
gilbertw1 / conifg.py
Last active October 12, 2017 21:38
Externally edit text field in qutebrowser
c.aliases['edit-field'] = 'debug-pyeval -q objreg.get(\'tabbed-browser\', scope=\'window\', window=\'last-focused\').currentWidget()._widget.page().runJavaScript(\'document.activeElement.value\', lambda res: objreg.get(\'command-dispatcher\', scope=\'window\', window=\'last-focused\')._run_userscript(\'edit_field\', res, verbose=False))'
# Indented Command Python
objreg.get('tabbed-browser', scope='window', window='last-focused') \
.currentWidget()._widget.page() \
.runJavaScript('document.activeElement.value', lambda res:
objreg.get('command-dispatcher', scope='window', window='last-focused') \
._run_userscript('edit_field', res, verbose=False))
@gilbertw1
gilbertw1 / evil.el
Created October 6, 2017 19:45
disable region limiting in evil-ex
(evil-define-command evil-ex (&optional initial-input)
:keep-visual t
:repeat abort
(interactive
(list
(let ((s (concat
(cond
(current-prefix-arg
(let ((arg (prefix-numeric-value current-prefix-arg)))
(cond ((< arg 0) (setq arg (1+ arg)))
@gilbertw1
gilbertw1 / gvim
Created October 5, 2017 17:18
GVIM
#!/bin/sh
for file in "$@"
do
if [ -f "$file" ]; then
termite -e "nvim $file"
break
fi
done
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

XMonad Keybindings

Core

  • M-q Reload XMonad configuration
  • M-S-q Exit XMonad

Layout

  • M-SPC Switch to next layout in current workspace
  • M-S-SPC Reset layout in current workspace
  • M-f Switch to fullscreen layout
@gilbertw1
gilbertw1 / mu-index-notify.sh
Last active January 6, 2021 14:32
A simple script that re-indexes emails using mu and sends a notification if new emails are detected.
# puts timestamps into an easily comparable format
extract_timestamp() {
local RAW="$(echo "$1" | cut -c1-31)"
echo "$(date --date="$RAW" '+%Y-%m-%d:%H:%M:%S')"
}
# removes html characters that are interpreted poorly by dunst
format_string() {
echo "$1" | sed 's/>/\&gt;/' | sed 's/</\&lt;/' | sed 's/\$/\\$/'
}
@gilbertw1
gilbertw1 / workspace.el
Last active February 20, 2020 16:07
persp-mode + eyebrowse
(use-package persp-mode :demand t
:config
(setq wg-morph-on nil
persp-autokill-buffer-on-remove 'kill-weak
persp-nil-name "nil"
persp-nil-hidden t
persp-auto-save-fname "autosave"
persp-auto-resume-time 1
persp-auto-save-opt 1