Skip to content

Instantly share code, notes, and snippets.

Tommy Allen tweekmonster

Block or report user

Report or block tweekmonster

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tweekmonster / relativenumber_op.vim
Created Jan 26, 2018
Show relative number column when using certain operator keys
View relativenumber_op.vim
" Requires 'timeoutlen' to be low enough for this to be practical:
" set timeoutlen=100
function! s:relative_number_op(key) abort
let old_rn = &l:relativenumber
let &l:relativenumber = 1
let seq = a:key
while 1
View toggle_comments.vim
highlight default NonComment ctermfg=8 ctermbg=none cterm=none guifg=#333333 guibg=none gui=none
function! s:toggle_comments() abort
if exists('w:toggle_comments')
silent! call matchdelete(w:toggle_comments)
unlet! w:toggle_comments
let w:toggle_comments = matchadd('NonComment', '^\%(\s*'.split(escape(&commentstring, '^$.*/"'''), '%s')[0].'\)\@!.*')
tweekmonster / .nvimrc
Last active Feb 5, 2017
.nvimrc script for Neovim development using Neomake
View .nvimrc
if !has('nvim')
let s:path = expand('<sfile>:p:h')
let s:target = 'all'
let s:error_path = s:path.'/tmp/errors.json'
let s:errors_url = ''
let g:neomake_make_maker = {
tweekmonster /
Created Jul 6, 2016
I like python, but you can write some awful shit with it.
# This illustrates how ridiculous python functions can get.
# It is far from a common way to write functions.
# Though, I've seen comments inside of multiline arguments
# in the stdlib modules.
def hello \
( # This starts the hello function
arg1, # This is arg1
# I'm an extra comment
tweekmonster /
Created May 24, 2016
Enable italics and standout in tmux
# Generate xterm-256color and screen-256color terminfo files that supports
# italicized text and standout display style. This will override the system's
# descriptions of xterm-256color and screen-256color for your shell.
# To enable in tmux:
# set -g default-terminal "xterm-256color"
# tmux recommends creating an `tmux-256color` terminfo file and setting the
# default-terminal to "xterm", but this causes ssh sessions to not display
tweekmonster / python-imports.vim
Created Apr 27, 2016
Vim script to quickly edit the top portion of Python scripts using NrrwRgn
View python-imports.vim
" A little annoying becuase NrrwRgn doesn't seem to be well suited for this.
" But, it gets the job done.
" Uses <leader>i in normal mode to open the split.
function! s:nrrw_head() abort
let saved = winsaveview()
keepjumps normal! 1G
let start = 1
let end = search('^\%(def\|class\)\s', 'ncW')
if !end
tweekmonster / edit-command-line.zsh
Created Apr 22, 2016
zsh edit-command-line zle widget that sets the cursor position in Vim
View edit-command-line.zsh
function edit-command-line() {
tmpfile=$(mktemp -t
print -R - "$PREBUFFER$BUFFER" > $tmpfile
if [[ "$editor" =~ vim ]]; then
(( b=pb+CURSOR ))
args+=("-c" ":call cursor(byte2line($b), ($b - $pb) + 1)")
tweekmonster / AutoIndent_Demo.scpt
Created Feb 24, 2016
Script for creating the autoindent GIF for braceless.vim
View AutoIndent_Demo.scpt
-- Script for creating the autoindent GIF for braceless.vim
to slowType(someText)
tell application "System Events"
repeat with i from 1 to count characters of someText
keystroke (character i of someText)
delay 0.15
end repeat
end tell
tweekmonster /
Created Sep 26, 2015
Monitor FIFO pipe with Bash
echo -en "${@}\x04" > /tmp/fifo_queue
tweekmonster / agtrunc
Created May 18, 2015
A script to truncate the_silver_searcher's output in Vim
View agtrunc
#!/usr/bin/env python
'''Truncates matches from ag
Place this script somewhere in your $PATH, like ~/bin and pipe ag into it.
Vim could be setup like this:
if executable('ag')
set grepprg=ag\ --vimgrep\ -w\ $*
if executable('agtrunc')
You can’t perform that action at this time.