Hi! If you see an error or something is missing (like :focus-within
for few years :P) please let me know ❤️
Element -- selects all h2
elements on the page
h2 {
function! GetTextObject(type) | |
let saved_register = @@ | |
if a:type == 'v' | |
normal! `<v`>y | |
elseif a:type ==# 'char' || a:type ==# 'line' | |
normal! `[v`]y | |
endif | |
let text = @@ | |
let @@ = saved_register | |
return text |
" Zip Right | |
" | |
" Moves the character under the cursor to the end of the line. Handy when you | |
" have something like: | |
" | |
" foo | |
" | |
" And you want to wrap it in a method call, so you type: | |
" | |
" println()foo |
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses #-} | |
import Data.Monoid | |
import Data.Monoid.Action | |
import Data.Monoid.MList (SM(..)) | |
import Control.Monad.Trans.Class | |
newtype UpdateT p s m a = UpdateT { runUpdateT :: s -> m (p, a) } |
" Next and Last {{{ | |
" Motion for "next/last object". "Last" here means "previous", not "final". | |
" Unfortunately the "p" motion was already taken for paragraphs. | |
" | |
" Next acts on the next object of the given type in the current line, last acts | |
" on the previous object of the given type in the current line. | |
" | |
" Currently only works for (, [, {, b, r, B, ', and ". | |
" |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
" Motion for "next/last object". For example, "din(" would go to the next "()" pair | |
" and delete its contents. | |
onoremap an :<c-u>call <SID>NextTextObject('a', 'f')<cr> | |
xnoremap an :<c-u>call <SID>NextTextObject('a', 'f')<cr> | |
onoremap in :<c-u>call <SID>NextTextObject('i', 'f')<cr> | |
xnoremap in :<c-u>call <SID>NextTextObject('i', 'f')<cr> | |
onoremap al :<c-u>call <SID>NextTextObject('a', 'F')<cr> | |
xnoremap al :<c-u>call <SID>NextTextObject('a', 'F')<cr> |