Skip to content

Instantly share code, notes, and snippets.

View AdamWagner's full-sized avatar

Adam Wagner AdamWagner

View GitHub Profile
@numToStr
numToStr / au.lua
Last active August 20, 2023 05:15
Neovim autocmd in lua
--
-- Move this file to your neovim lua runtime path ie. ~/.config/nvim/lua/au.lua
--
local cmd = vim.api.nvim_command
local function autocmd(this, event, spec)
local is_table = type(spec) == 'table'
local pattern = is_table and spec[1] or '*'
local action = is_table and spec[2] or spec
if type(action) == 'function' then

Some useful custom text objects for vim

Collection of my custom text objects I use quite often.

97975602 6e90ee00 1dda 11eb 9286 6894300457e3

Numbers

Put it into your .vimrc:

@kristijanhusak
kristijanhusak / 1. Toggle-kitty-and-neovim-colors.md
Last active March 6, 2024 18:15
Toggle between light and dark colorschemes for both neovim and kitty

Requirements:

  • Neovim v0.4+
  • Python 3.4+ and pynvim
  • Kitty
  • Zsh, but would probably work with any shell if configured properly
  • Your favorite dark and light colorschemes

Installation

  1. Add below python script to ~/.config/kitty/ folder. Make sure to make it executable (chmod +x ~/.config/kitty/colors)
  2. Set up your dark/light colorscheme, and where to store kitty colors configuration (line 4 to 9)
@vn-ki
vn-ki / Instructions.md
Last active February 29, 2024 13:48
Use ranger as chrome file chooser

Use ranger as chrome file chooser

  1. Copy the contents of kdialog to /usr/local/bin/kdialog
  2. Copy the contents of chrome_chooser.py to ~/.config/ranger/plugins/chrome_chooser.py
  3. Optionally map appropriately
  4. Run chrome with XDG_CURRENT_DESKTOP=KDE
@FractalWire
FractalWire / nvrp
Last active September 5, 2020 03:32
preview file with fzf and nvr
#!/bin/bash
# simple script to preview files with the help of fzf
cwd=$(pwd)
# set up
nvr --nostart -cc 'let nvrp_buffer=""'
set_variables='mime_list=( "application/json" "text/" ); mime=$(file --mime-type {} | cut -d " " -f 2)'
f_is_text='for m in ${mime_list[@]}; do test "${mime#$m}" != "$mime" && break || false; done'

Vim will move the cursor to the beginning of an object after invoking operator upon it. From an interactive editing perspective this may be considered annoying however it is the consistent choice as operators can be destructive. As such restoring the cursor to its prior position after invoking an operator on an object may not make sense.

There are many ways possible to alter this behaviour to your preference with mappings and/or scripting. But with custom operator mappings this can be particularly ugly.

@pirate
pirate / alfred-clipboard.sh
Last active December 5, 2023 18:12
Script to manage searching, backing up, and collecting infinite clipboard history from the Alfred Clipboard History on macOS.
#!/usr/bin/env bash
# This is a script that provides infinite history to get around Alfred's 3-month limit.
# It works by regularly backing up and appending the items in the alfred db to a
# sqlite database in the user's home folder. It also provides search functionality.
# https://www.alfredforum.com/topic/10969-keep-clipboard-history-forever/?tab=comments#comment-68859
# https://www.reddit.com/r/Alfred/comments/cde29x/script_to_manage_searching_backing_up_and/
# Example Usage:
# alfred-clipboard.sh backup
# This is heavily based in the code here:
# https://gist.github.com/enpassant/0496e3db19e32e110edca03647c36541
# Special thank you to the user enpassant for starting it https://github.com/enpassant
#!/bin/bash
SYNTAX="$2"
EXTENSION="$3"
OUTPUTDIR="$4"
INPUT="$5"
@bool3max
bool3max / kitty.conf
Created March 6, 2019 11:05
My kitty terminal config
font_family Iosevka Term
bold_font Iosevka Term Bold
italic_font Iosevka Term Italic
bold_italic_font Iosevka Term Bold Italic
font_size 10.0
background #141414
foreground #F8F8F0
active_border_color #b2b2b0
inactive_text_alpha 0.85
@focusaurus
focusaurus / fuzzball.sh
Created November 25, 2018 18:22
Fuzzball desktop automation script
#!/usr/bin/env bash
# Please Use Google Shell Style: https://google.github.io/styleguide/shell.xml
# ---- Start unofficial bash strict mode boilerplate
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o errexit # always exit on error
set -o errtrace # trap errors in functions as well
set -o pipefail # don't ignore exit codes when piping output
set -o posix # more strict failures in subshells