From 462a800064058d1b0134ac003371c4b8308c1465 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 30 Nov 2013 11:41:11 +0900 Subject: [PATCH] Generic operator function with interactive mode --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b5a762c..8cbe7dc 100644 --- a/README.md +++ b/README.md @@ -294,6 +294,19 @@ since the same can be easily done using the negative N-th parameter: `-=` You can define an operator function which executes EasyAlign command, so that it can be used with a Vim movement. +```vim +function! s:easy_align_op(type, ...) + '[,']EasyAlign +endfunction +nnoremap a :set opfunc=easy_align_opg@ +``` + +Now without going into visual mode, you can align the lines in the paragraph by +`aip=` or `aip:`. + +Or you can be more specific as follows, so you can do `=ip` or +`:ip`. + ```vim function! s:easy_align_1st_eq(type, ...) '[,']EasyAlign= @@ -306,9 +319,6 @@ endfunction nnoremap : :set opfunc=easy_align_1st_colong@ ``` -Now without going into visual mode, you can align the lines in the paragraph -by `=ip` or `:ip`. - Alignment options -----------------