Skip to content

Instantly share code, notes, and snippets.

@emiasims
emiasims / yankring.vim
Created June 13, 2019 22:02
A simple yankring. A much needed improvement on the numbered registers.
function! yankring#reset() abort
let s:yankring = []
for l:i in range(1, 9)
execute 'let l:contents = @' . l:i
call add(s:yankring, l:contents)
endfor
endfunction
call yankring#reset()
function! yankring#yank(contents) abort
@emiasims
emiasims / rename.vim
Last active June 13, 2019 19:28
Simple language agnostic refactoring for "Oh I should make this textobject a variable"
function! rename#opfunc(type) abort
if a:type == 'line'
return
endif
normal! `[v`]d
augroup rename_insert
autocmd!
autocmd InsertLeave * call s:refactor_var() | autocmd! rename_insert
augroup END
startinsert
@emiasims
emiasims / winresize.vim
Created June 13, 2019 17:51
Tmux-like vim window resizing
function! s:is_edge_window(direction) abort
" If window is on the 'edge'
let l:win = winnr()
execute 'noautocmd wincmd ' . a:direction
let l:edge_window = winnr() == l:win
if !l:edge_window
execute 'noautocmd ' . l:win . 'wincmd w'
endif
return l:edge_window
endfunction
@emiasims
emiasims / neovim-edit.reg
Created February 11, 2019 22:41
Registry edit to have 'edit with neovim' on the right click menu
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\NeoVim]
@="Edit with &NeoVim"
"Icon"="\"D:\\Applications\\Neovim\\bin\\nvim-qt.exe\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\NeoVim\command]
@="D:\\Applications\\Neovim\\bin\\nvim-qt.exe \"%1\" "