Vim ã® textobj ãã©ã°ã¤ã³ãã¾ã¨ãã
ãã®è¨äºã¯ Vim Advent Calendar 2012 229æ¥ç®ã®è¨äºã«ãªãã¾ãã
æè¿ãã£ã¨ textobj ãå©ç¨ãå§ããæ
弱㪠Vimmer ãªãã§ãããã©ã㪠textobj ãããã®ãç¥ããªãã£ãã®ã§èª¿ã¹ãããç¯å²ã§ã¾ã¨ãã¦ã¿ã¾ããã
åºæ¬çã« kana ããã® vim-textobj-user ã使ç¨ãã¦ãããã©ã°ã¤ã³ãä¸ãã¦ããã¾ãã
ã覧ã®éãéãå¤ãã®ã§ typo ãªã©ããã£ããããããªãã(ã»Ï<)
[textobj ä¸è¦§]
ãã©ã°ã¤ã³ | ç¯å² | ãããã³ã° | åè |
---|---|---|---|
user | |||
entire | ãããã¡å ¨ä½ | ae, ie | |
line | ã«ã¼ã½ã«è¡ | al, il | 参照 |
function | é¢æ°å | af, if | |
syntax | ã·ã³ã¿ãã¯ã¹ | ay, iy | |
jabraces | ãfooã or ãbarããªã© | ajb, ijb | |
lastpat | æå¾ã«æ¤ç´¢ããããã¿ã¼ã³ | a/, i/ | |
indent | ã«ã¼ã½ã«ä½ç½®ã¨åãã¤ã³ãã³ã | al, il | 参照 |
fold | fold | az, iz | |
diff | diff(1) | adf, idf | |
datetime | æ¥ä»ã¨æå» | ada, ida | |
underscore | ã¢ã³ãã¼ã¹ã³ã¢ã®é | a_, i_ | |
django-template | django_template | adb, idb | |
between | ä»»æã®åºåãæåã®é | af, if | 参照 |
comment | ã³ã¡ã³ã | ac, ic | |
function-javascript | JavaScript ã®é¢æ°å | af, if | |
function-perl | Perl ã®é¢æ°å | af, if | |
textobj-lastpaste | ç´åã«å¤æ´ã¾ãã¯ã¤ã³ã¯ãããããã¹ã | af, if | |
textobj-mbboundary.vim | ASCIIæåã¨ãã«ããã¤ãæåã®å¢çãåºåã | am, im | |
textobj-nonblankchars.vim | æ¥æ¬èªã«å¯¾å¿ãã¦ãã WORD | am, im | |
xml-attribute | XML ã®å±æ§ | axa, ixa | |
php | phpã¿ã°ã«å²ã¾ããé¨å | aP, iP | 参照 |
space | é£ç¶ããã¹ãã¼ã¹ | aS, iS | 参照 |
url | URL | au, iu | |
wiw | snake_case ä¸ã® word | a,w, i,w | 参照 |
lastinserted | ããã¹ããªãã¸ã§ã¯ãã¨ãã¦æå¾ã«æ¿å ¥ãããç¯å² | au, iu | |
continuous-line | è¡ç¶ç¶ãç¨ãã¦ããè¡ | av, iv | |
ruby | Ruby ã®ããã㯠| arr, irr | 参照 |
xbrackets | x() ã x<> ãªã© | axb, ixb | 参照 |
textobj-motionmotion.vim | ä»»æã®2ã¤ã® motion ã®é | am, im | |
enclosedsyntax | Perl ã Ruby ã®æ£è¦è¡¨ç¾ | aq, iq | 参照 |
headwordofline | è¡ã®å é ã® word | ah, ih | |
latex | LaTeX | ae, ie | |
parameter | é¢æ°ã®å¼æ° | a, , i, | 参照 |
cell | åå¾ã®ã¹ãã¼ã¹ãåãé¤ããã«ã¼ã½ã«è¡ | ac, ic | |
context | å¥ã® filetype ã®ã³ã³ããã¹ã | icx | 参照 |
multiblock | ä»»æã®è¤æ°ã®æ¬å¼§ã®ãããã | asb, isb | 参照 |
indblock | ã¤ã³ãã³ãã®ç©ºç½è¡ | ao, io | |
dash | ããã·ã¥è¨å·ã®é | a-, i- | |
python | Python | af, if | |
ifdef | #ifdef | a#, i# | |
html-textobjects | HTML | ahf, ihf | |
keyvalue | ããã·ã¥ã® key 㨠value | dak, dik, dav, div | 参照 |
â»ãããã³ã°ã¯ä¸é¨ã®ã¿è¨è¼
å
¨é¨ã¤ã³ã¹ãã¼ã«ãã¦è©¦ããããã§ã¯ãªãã®ã§ééã£ã¦ããè¨è¿°ãããã°æãã¦ããããã¨å©ããã¾ãã
[neobundle.vim]
" textobj ã®ãã¼ã¹ NeoBundle "kana/vim-textobj-user" " ãããã¡å ¨ä½ " ae, ie NeoBundle "kana/vim-textobj-entire" " ã«ã¼ã½ã«è¡ " al, il NeoBundle "kana/vim-textobj-line" " é¢æ°å " af, if NeoBundle "kana/vim-textobj-function" " ã·ã³ã¿ãã¯ã¹ " ay, iy NeoBundle "kana/vim-textobj-syntax" " ãfooã or ãbarããªã© " ajb, ijb NeoBundle "kana/vim-textobj-jabraces" " æå¾ã«æ¤ç´¢ããããã¿ã¼ã³ " a/, i/ NeoBundle "kana/vim-textobj-lastpat" " ã«ã¼ã½ã«ä½ç½®ã¨åãã¤ã³ãã³ã " al, il NeoBundle "kana/vim-textobj-indent" " fold " az, iz NeoBundle "kana/vim-textobj-fold" " diff(1) " adf, idf NeoBundle "kana/vim-textobj-syntax" " æ¥ä»ã¨æå» " ada, ida NeoBundle "kana/vim-textobj-datetime" " ã¢ã³ãã¼ã¹ã³ã¢ã®é " NeoBundle "kana/vim-textobj-syntax" " django_template " adb, idb NeoBundle "kana/vim-textobj-django-template" " ä»»æã®åºåãæå " af, if NeoBundle "thinca/vim-textobj-between" " ã³ã¡ã³ã " ac, ic NeoBundle "thinca/vim-textobj-comment" " JavaScript ã®é¢æ°å " af, if NeoBundle "thinca/vim-textobj-function-javascript" " Perl ã®é¢æ°å " af, if NeoBundle "thinca/vim-textobj-function-perl" " ç´åã«å¤æ´ã¾ãã¯ã¤ã³ã¯ãããããã¹ã " ip NeoBundle "gilligan/textobj-lastpaste" " ASCIIæåã¨ãã«ããã¤ãæåã®å¢çãåºåã " am, im NeoBundle "deton/textobj-mbboundary.vim" " XML ã®å±æ§ " axa, ixa NeoBundle "akiyan/vim-textobj-xml-attribute" " phpã¿ã°ã«å²ã¾ããé¨å " aP, iP NeoBundle "akiyan/vim-textobj-php" " é£ç¶ããã¹ãã¼ã¹ " aS, iS NeoBundle "saihoooooooo/vim-textobj-space" " URL " au, iu NeoBundle "mattn/vim-textobj-url" " snake_case ä¸ã® word " a,w, i,w NeoBundle "h1mesuke/textobj-wiw" " ããã¹ããªãã¸ã§ã¯ãã¨ãã¦æå¾ã«æ¿å ¥ãããç¯å² " au, iu NeoBundle "rhysd/vim-textobj-lastinserted" " è¡ç¶ç¶ãç¨ãã¦ããè¡ " av, iv NeoBundle "rhysd/vim-textobj-continuous-line" " Ruby ã®ããã㯠" arr, brr NeoBundle "rhysd/vim-textobj-ruby" " x() ã x<> ãªã© " axb, ixb NeoBundle "https://bitbucket.org/anyakichi/vim-textobj-xbrackets" " ä»»æã®2ã¤ã® motion ã®é " am, im NeoBundle "hchbaw/textobj-motionmotion.vim" " Perl ã Ruby ã®æ£è¦è¡¨ç¾ " aq, iq NeoBundle "deris/vim-textobj-enclosedsyntax" " è¡ã®å é ã® word " ah, ih NeoBundle "deris/vim-textobj-headwordofline" " LaTeX " ae, ie NeoBundle "rbonvall/vim-textobj-latex" " é¢æ°ã®å¼æ° " a, i, NeoBundle "sgur/vim-textobj-parameter" " åå¾ã®ã¹ãã¼ã¹ãåãé¤ããã«ã¼ã½ã«è¡ " ac, ic NeoBundle "mattn/vim-textobj-cell" " å¥ã® filetype ã®ã³ã³ããã¹ã " icx NeoBundle "osyo-manga/vim-textobj-context" " ä»»æã®è¤æ°ã®æ¬å¼§ã®ãããã " asb, isb NeoBundle "osyo-manga/vim-textobj-multiblock" " ã¤ã³ãã³ãã®ç©ºç½è¡ " ao, io NeoBundle "glts/vim-textobj-indblock" " ããã·ã¥è¨å·ã®é " a-, i- NeoBundle "RyanMcG/vim-textobj-dash" " Python " af, if NeoBundle "bps/vim-textobj-python" " #ifdef " a#, i# NeoBundle "anyakichi/vim-textobj-ifdef2 " HTML " ahf, ihf NeoBundle "mjbrownie/html-textobjects" " ããã·ã¥ã® key 㨠value " dak, dik, dav, div NeoBundle "vimtaku/vim-textobj-keyvalue"
[ç¯å²]
å人çã«ãããã¥ããã£ã textobj ã®ç¯å²ããããããããã¦ã¿ã¾ããã
: ã«ã¼ã½ã«ä½ç½®
: ç¯å²
" vim-textobj-wiw
" i,w
word_neocomplete_word
" vim-textobj-indent
" ii
if
homu
mami
madoend
" vim-textobj-datetime
" ida
time2013-07-17now
time17:36now
" vim-textobj-multiblock
" asb
pre(multiblock)suf
pre'multiblock'suf
pre"multiblock"suf
" vim-textobj-lastinserted
" iv
homu
mado
\mami
saya
" textobj-xbrackets.vim
" ix)
printf("%f\n", (sqrt(value) + 1));
" ax)
printf("%f\n", (sqrt(value) + 1));" vim-textobj-parameter
" a,
printf("homu%f\n", (sqrt(value) + 1));
" i,
printf("homu%f\n", (sqrt(value) + 1));
" vim-textobj-indblock
" io
if
homu
mami
mado
end
ã¨ãããæã㧠textobj ãã¾ã¨ãã¦ã¿ã¾ããã
kana ããã® vim-textobj-user ã使ç¨ãã㨠textobj ããµã¯ãã¨ã¤ãããã¨ããã®ããã£ã¦ã ãã¶éãå¤ãã§ãã
Vim æ¬ä½ã§çµã¿è¾¼ã¾ãã¦ãããã®ãåãããã¨ã©ããããã®éã«ãªãã®ãâ¦ã
textobj 㯠Vim ã使ç¨ããä¸ã§ã¨ã¦ã便å©ãªæ©è½ãªã®ã§ãããããå¹çãã使ã£ã¦ããããã§ããã