Permalink
Browse files

Merge pull request #183 from wellle/174-deprecate-NL-modifiers

174 Deprecate N and L modifiers
  • Loading branch information...
wellle committed Oct 5, 2017
2 parents 0f91613 + 3b8c7d4 commit 7c6cf49b4305dac57e368b1000a5cf667b97b881
Showing with 61 additions and 3,201 deletions.
  1. +13 −25 README.md
  2. +3 −7 autoload/targets.vim
  3. +11 −21 cheatsheet.md
  4. +18 −56 doc/targets.txt
  5. +10 −14 plugin/targets.vim
  6. +4 −4 test/test.vim
  7. +0 −1,536 test/test1.ok
  8. +0 −1,536 test/test1.out
  9. +1 −1 test/testM.ok
  10. +1 −1 test/testM.out
View
@@ -231,7 +231,7 @@ a ' bbbbbbbb ' c ' d ' e
### Next and Last Quote
`in' In' An' il' Il' Al' iN' IN' AN' iL' IL' AL' ...`
`in' In' An' il' Il' Al' ...`
Work directly on distant quotes without moving there separately.
@@ -240,19 +240,14 @@ including the letter `n`. The command `in'` selects inside of the next
single quotes. Use the letter `l` instead to work on the previous (last)
quote. Uses a count to skip multiple quotation characters.
Use uppercase `N` and `L` to jump from within one quote into the next
proper quote, instead of into the pseudo quote in between. (Using `N`
instead of `n` is actually just doubling the count to achieve this.)
See our [Cheat Sheet][cheatsheet] for a chart summarizing all quote mappings.
### Quote Seek
If any of the normal quote commands (not containing `n`, `l`, `N` or `L`) is
executed when the cursor is not positioned inside a quote, it seeks for quotes
before or after the cursor by searching for the appropriate delimiter on the
current line. This is similar to using the explicit version containing `n` or
`l`.
If any of the normal quote commands (not containing `n` or `l`) is executed
when the cursor is not positioned inside a quote, it seeks for quotes before or
after the cursor by searching for the appropriate delimiter on the current
line. This is similar to using the explicit version containing `n` or `l`.
## Separator Text Objects
@@ -328,7 +323,7 @@ a , b , cccccccc , d , e
### Next and Last Separator
`in, an, In, An, il, al, Il, Al, iN, aN, IN, AN, iL, aL, IL, AL, ...`
`in, an, In, An, il, al, Il, Al, ...`
Work directly on distant separators without moving there separately.
@@ -337,10 +332,6 @@ including the letter `n`. The command `in,` selects inside of the next commas.
Use the letter `l` instead to work on the previous (last) separators. Uses the
count to skip multiple separator characters.
Use uppercase `N` and `L` to jump from within one pair of separators into
the next distinct pair, instead of into the adjacent one. (Using `N`
instead of `n` is actually just doubling the count to achieve this.)
See our [Cheat Sheet][cheatsheet] for a chart summarizing all separator mappings.
### Separator Seek
@@ -474,7 +465,7 @@ Available options:
```vim
g:targets_aiAI
g:targets_nlNL
g:targets_nl
g:targets_pairs
g:targets_quotes
g:targets_separators
@@ -499,26 +490,23 @@ Controls the normal mode operator mode maps that get created for In Pair (`i`),
A Pair (`a`), Inside Pair (`I`), and Around Pair (`A`). Required to be a 4
character long list. Use a space to deactivate a mode.
### g:targets_nlNL
### g:targets_nl
Default:
```vim
let g:targets_nlNL = 'nlNL'
let g:targets_nl = 'nl'
```
Controls the keys used in maps for seeking next and last text objects. For
example, if you don't wish to use the `N` and `L` seeks, and instead wish for
`n` to always search for the next object and `N` to search for the last, you
could set:
example, if you want `n` to always search for the next object and `N` to search
for the last, you could set:
```vim
let g:targets_nlNL = 'nN '
let g:targets_nl = 'nN'
```
Note that two extra spaces are still required on the end, indicating you wish
to disable the default functionality of `N` and `L`. Required to be a 4
character long list.
Required to be a 4 character long list. Use a space to deactivate a direction.
### g:targets_pairs
View
@@ -64,11 +64,11 @@ function! targets#e(modifier)
let char1 = nr2char(getchar())
let [delimiter, which, chars] = [char1, 'c', char1]
let i = 0
while i < 4
if g:targets_nlNL[i] ==# delimiter
while i < 2
if g:targets_nl[i] ==# delimiter
" delimiter was which, get another char for delimiter
let char2 = nr2char(getchar())
let [delimiter, which, chars] = [char2, 'nlNL'[i], chars . char2]
let [delimiter, which, chars] = [char2, 'nl'[i], chars . char2]
break
endif
let i = i + 1
@@ -200,10 +200,6 @@ function! s:findRawTarget(context, kind, which, count)
return s:nextselect(a:count)
elseif a:which ==# 'l'
return s:lastselect(a:count)
elseif a:which ==# 'N'
return s:nextselect(a:count * 2)
elseif a:which ==# 'L'
return s:lastselect(a:count * 2)
else
return targets#target#withError('findRawTarget s')
endif
View
@@ -48,10 +48,10 @@ a ( b ( cccccccc ) d ) ( e ( ffffff ) g ) ( h ( iiiiiiii ) j ) k
Available mappings
```
i' i" i` in' in" in` il' il" il` iL' iL" iL`
a' a" a` an' an" an` al' al" al` aL' aL" aL`
I' I" I` In' In" In` Il' Il" Il` IL' IL" IL`
A' A" A` An' An" An` Al' Al" Al` AL' AL" AL`
i' i" i` in' in" in` il' il" il`
a' a" a` an' an" an` al' al" al`
I' I" I` In' In" In` Il' Il" Il`
A' A" A` An' An" An` Al' Al" Al`
```
Chart for a list of quotes
@@ -84,28 +84,18 @@ il, il. il; il: il+ il- il= il~ il_ il* il# il/ il| il\ il& il$
al, al. al; al: al+ al- al= al~ al_ al* al# al/ al| al\ al& al$
Il, Il. Il; Il: Il+ Il- Il= Il~ Il_ Il* Il# Il/ Il| Il\ Il& Il$
Al, Al. Al; Al: Al+ Al- Al= Al~ Al_ Al* Al# Al/ Al| Al\ Al& Al$
iN, iN. iN; iN: iN+ iN- iN= iN~ iN_ iN* iN# iN/ iN| iN\ iN& iN$
aN, aN. aN; aN: aN+ aN- aN= aN~ aN_ aN* aN# aN/ aN| aN\ aN& aN$
IN, IN. IN; IN: IN+ IN- IN= IN~ IN_ IN* IN# IN/ IN| IN\ IN& IN$
AN, AN. AN; AN: AN+ AN- AN= AN~ AN_ AN* AN# AN/ AN| AN\ AN& AN$
iL, iL. iL; iL: iL+ iL- iL= iL~ iL_ iL* iL# iL/ iL| iL\ iL& iL$
aL, aL. aL; aL: aL+ aL- aL= aL~ aL_ aL* aL# aL/ aL| aL\ aL& aL$
IL, IL. IL; IL: IL+ IL- IL= IL~ IL_ IL* IL# IL/ IL| IL\ IL& IL$
AL, AL. AL; AL: AL+ AL- AL= AL~ AL_ AL* AL# AL/ AL| AL\ AL& AL$
```
Chart for a list of separators
```
.........
a , bbbbbbb , ccccccc , dddddd , eeeeeee , fffffff , g
││└ IL, ┘│││└ Il, ┘│││└ I, ┘│││└ In, ┘│││└ IN, ┘│ │
│└─ iL, ─┤│├─ il, ─┤│├─ i, ─┤│├─ in, ─┤│├─ iN, ─┤ │
├── aL, ─┘├┼─ al, ─┘├┼─ a, ─┘├┼─ an, ─┘├┼─ aN, ─┘ │
└── AL, ──┼┘ └┼─ A, ──┼┘ └┼─ AN, ───┘
└─ Al, ──┘ └─ An, ──┘
.........
a , bbbbbbbb , ccccccc , dddddd , eeeeeee , ffffffff , g
││└ 2Il, ┘│││└ Il, ┘│││└ I, ┘│││└ In, ┘│││└ 2In, ┘│ │
│└─ 2il, ─┤│├─ il, ─┤│├─ i, ─┤│├─ in, ─┤│├─ 2in, ─┤ │
├── 2al, ─┘├┼─ al, ─┘├┼─ a, ─┘├┼─ an, ─┘├┼─ 2an, ─┘ │
└── 2Al, ──┼┘ └┼─ A, ──┼┘ └┼─ 2An, ───┘
└─ Al, ──┘ └─ An, ──┘
```
## Argument mappings
View
@@ -242,18 +242,11 @@ Work directly on distant quotes without moving there separately.
in' in" in` il' il" il` *in`* *in'* *inquote* *il`* *il'* *ilquote*
an' an" an` al' al" al` *an`* *an'* *anquote* *al`* *al'* *alquote*
In' In" In` Il' Il" Il` *In`* *In'* *Inquote* *Il`* *Il'* *Ilquote*
iN' iN" iN` iL' iL" iL` *iN`* *iN'* *iNquote* *iL`* *iL'* *iLquote*
aN' aN" aN` aL' aL" aL` *aN`* *aN'* *aNquote* *aL`* *aL'* *aLquote*
IN' IN" IN` IL' IL" IL` *IN`* *IN'* *INquote* *IL`* *IL'* *ILquote*
All the above pair text objects can be shifted to the next quote by
including the letter `n`. The command `in'` selects inside of the next
single quotes. Use the letter `l` instead to work on the previous (last)
quote. Uses a [count] to skip multiple quotation characters.
Use uppercase `N` and `L` to jump from within one quote into the next
proper quote, instead of into the pseudo quote in between. (Using `N`
instead of `n` is actually just doubling the count to achieve this.)
*targets-quote-chart*
The following chart summarizes all quote mappings:
@@ -267,10 +260,10 @@ The following chart summarizes all quote mappings:
------------------------------------------------------------------------------
QUOTE SEEK *targets-quote-seek*
If any of the normal quote commands (not containing `n`, `l`, `N` or `L`) is
executed when the cursor is not positioned inside a quote, it seeks for quotes
before or after the cursor by searching for the appropriate delimiter on the
current line. Similar to using the explicit version containing `n` or `l`.
If any of the normal quote commands (not containing `n` or `l`) is executed
when the cursor is not positioned inside a quote, it seeks for quotes before
or after the cursor by searching for the appropriate delimiter on the current
line. Similar to using the explicit version containing `n` or `l`.
==============================================================================
SEPARATOR TEXT OBJECTS *targets-separator-text-objects*
@@ -340,14 +333,6 @@ Work directly on distant separators without moving there separately.
*al,* *al.* *al;* *al:* *al+* *al-* *al=* *al~*
*Il,* *Il.* *Il;* *Il:* *Il+* *Il-* *Il=* *Il~*
*Al,* *Al.* *Al;* *Al:* *Al+* *Al-* *Al=* *Al~*
*iN,* *iN.* *iN;* *iN:* *iN+* *iN-* *iN=* *iN~*
*aN,* *aN.* *aN;* *aN:* *aN+* *aN-* *aN=* *aN~*
*IN,* *IN.* *IN;* *IN:* *IN+* *IN-* *IN=* *IN~*
*AN,* *AN.* *AN;* *AN:* *AN+* *AN-* *AN=* *AN~*
*iL,* *iL.* *iL;* *iL:* *iL+* *iL-* *iL=* *iL~*
*aL,* *aL.* *aL;* *aL:* *aL+* *aL-* *aL=* *aL~*
*IL,* *IL.* *IL;* *IL:* *IL+* *IL-* *IL=* *IL~*
*AL,* *AL.* *AL;* *AL:* *AL+* *AL-* *AL=* *AL~*
*in_* *in/* *in|* *in\* *in&* *in$* *in#* *instar*
*an_* *an/* *an|* *an\* *an&* *an$* *an#* *anstar*
@@ -357,14 +342,6 @@ Work directly on distant separators without moving there separately.
*al_* *al/* *al|* *al\* *al&* *al$* *al#* *alstar*
*Il_* *Il/* *Il|* *Il\* *Il&* *Il$* *Il#* *Ilstar*
*Al_* *Al/* *Al|* *Al\* *Al&* *Al$* *Al#* *Alstar*
*iN_* *iN/* *iN|* *iN\* *iN&* *iN$* *iN#* *iNstar*
*aN_* *aN/* *aN|* *aN\* *aN&* *aN$* *aN#* *aNstar*
*IN_* *IN/* *IN|* *IN\* *IN&* *IN$* *IN#* *INstar*
*AN_* *AN/* *AN|* *AN\* *AN&* *AN$* *AN#* *ANstar*
*iL_* *iL/* *iL|* *iL\* *iL&* *iL$* *iL#* *iLstar*
*aL_* *aL/* *aL|* *aL\* *aL&* *aL$* *aL#* *aLstar*
*IL_* *IL/* *IL|* *IL\* *IL&* *IL$* *IL#* *ILstar*
*AL_* *AL/* *AL|* *AL\* *AL&* *AL$* *AL#* *ALstar*
in, in. in; in: in+ in- in= in~ in_ in/ in| in\ in& in$ in# in*
an, an. an; an: an+ an- an= an~ an_ an/ an| an\ an& an$ an# an*
@@ -374,34 +351,22 @@ il, il. il; il: il+ il- il= il~ il_ il/ il| il\ il& il$ il# il*
al, al. al; al: al+ al- al= al~ al_ al/ al| al\ al& al$ al# al*
Il, Il. Il; Il: Il+ Il- Il= Il~ Il_ Il/ Il| Il\ Il& Il$ Il# Il*
Al, Al. Al; Al: Al+ Al- Al= Al~ Al_ Al/ Al| Al\ Al& Al$ Al# Al*
iN, iN. iN; iN: iN+ iN- iN= iN~ iN_ iN/ iN| iN\ iN& iN$ iN# iN*
aN, aN. aN; aN: aN+ aN- aN= aN~ aN_ aN/ aN| aN\ aN& aN$ aN# aN*
IN, IN. IN; IN: IN+ IN- IN= IN~ IN_ IN/ IN| IN\ IN& IN$ IN# IN*
AN, AN. AN; AN: AN+ AN- AN= AN~ AN_ AN/ AN| AN\ AN& AN$ AN# AN*
iL, iL. iL; iL: iL+ iL- iL= iL~ iL_ iL/ iL| iL\ iL& iL$ iL# iL*
aL, aL. aL; aL: aL+ aL- aL= aL~ aL_ aL/ aL| aL\ aL& aL$ aL# aL*
IL, IL. IL; IL: IL+ IL- IL= IL~ IL_ IL/ IL| IL\ IL& IL$ IL# IL*
AL, AL. AL; AL: AL+ AL- AL= AL~ AL_ AL/ AL| AL\ AL& AL$ AL# AL*
All the above separator text objects can be shifted to the next separator
by including the letter `n`. The command `in,` selects inside of the next
commas. Use the letter `l` instead to work on the previous (last)
separators. Uses a [count] to skip multiple separator characters.
Use uppercase `N` and `L` to jump from within one pair of separators into
the next distinct pair, instead of into the adjacent one. (Using `N`
instead of `n` is actually just doubling the count to achieve this.)
*targets-separator-chart*
The following chart summarizes all separator mappings:
.........
a , bbbbbbb , ccccccc , dddddd , eeeeeee , fffffff , g ~
││└ IL, ┘│││└ Il, ┘│││└ I, ┘│││└ In, ┘│││└ IN, ┘│ │
│└─ iL, ─┤│├─ il, ─┤│├─ i, ─┤│├─ in, ─┤│├─ iN, ─┤ │
├── aL, ─┘├┼─ al, ─┘├┼─ a, ─┘├┼─ an, ─┘├┼─ aN, ─┘ │
└── AL, ──┼┘ └┼─ A, ──┼┘ └┼─ AN, ───┘
└─ Al, ──┘ └─ An, ──┘
.........
a , bbbbbbbb , ccccccc , dddddd , eeeeeee , ffffffff , g ~
││└ 2Il, ┘│││└ Il, ┘│││└ I, ┘│││└ In, ┘│││└ 2In, ┘│ │
│└─ 2il, ─┤│├─ il, ─┤│├─ i, ─┤│├─ in, ─┤│├─ 2in, ─┤ │
├── 2al, ─┘├┼─ al, ─┘├┼─ a, ─┘├┼─ an, ─┘├┼─ 2an, ─┘ │
└── 2Al, ──┼┘ └┼─ A, ──┼┘ └┼─ 2An, ───┘
└─ Al, ──┘ └─ An, ──┘
------------------------------------------------------------------------------
SEPARATOR SEEK *targets-separator-seek*
@@ -506,7 +471,7 @@ The provided examples also indicate the default values.
Available options: ~
|g:targets_aiAI|
|g:targets_nlNL|
|g:targets_nl|
|g:targets_pairs|
|g:targets_quotes|
|g:targets_separators|
@@ -527,20 +492,17 @@ Controls the normal mode operator mode maps that get created for In Pair (i),
A Pair (a), Inside Pair (I), and Around Pair (A). Required to be a 4 character
long list. Use a space to deactivate a mode.
*g:targets_nlNL*
*g:targets_nl*
Default:
let g:targets_nlNL = 'nlNL' ~
let g:targets_nl = 'nl' ~
Controls the keys used in maps for seeking next and last text objects. For
example, if you don't wish to use the N and L seeks, and instead wish for 'n'
to always search for the next object and `N` to search for the last, you could
set:
example, if you want 'n' to always search for the next object and `N` to
search for the last, you could set:
let g:targets_nlNL = 'nN ' ~
let g:targets_nl = 'nN' ~
Note that two extra spaces are still required on the end, indicating you wish
to disable the default functionality of N and L. Required to be a 4 character
long list.
Required to be a 4 character long list. Use a space to deactivate a direction.
*g:targets_pairs*
Default:
View
@@ -15,9 +15,9 @@ function! s:addMapping1(mapType, mapping, aiAI)
endif
endfunction
function! s:addMapping2(mapType, mapping, aiAI, nlNL)
if a:aiAI !=# ' ' && a:nlNL !=# ' '
silent! execute a:mapType . 'noremap <silent> <unique>' . a:aiAI . a:nlNL . a:mapping
function! s:addMapping2(mapType, mapping, aiAI, nl)
if a:aiAI !=# ' ' && a:nl !=# ' '
silent! execute a:mapType . 'noremap <silent> <unique>' . a:aiAI . a:nl . a:mapping
endif
endfunction
@@ -153,14 +153,6 @@ function! s:createSeparatorTextObjects(mapType)
call s:addMapping2(a:mapType, triggerMap . "la', v:count1)<CR>", s:a, s:l)
call s:addMapping2(a:mapType, triggerMap . "lI', v:count1)<CR>", s:I, s:l)
call s:addMapping2(a:mapType, triggerMap . "lA', v:count1)<CR>", s:A, s:l)
call s:addMapping2(a:mapType, triggerMap . "Ni', v:count1)<CR>", s:i, s:N)
call s:addMapping2(a:mapType, triggerMap . "Na', v:count1)<CR>", s:a, s:N)
call s:addMapping2(a:mapType, triggerMap . "NI', v:count1)<CR>", s:I, s:N)
call s:addMapping2(a:mapType, triggerMap . "NA', v:count1)<CR>", s:A, s:N)
call s:addMapping2(a:mapType, triggerMap . "Li', v:count1)<CR>", s:i, s:L)
call s:addMapping2(a:mapType, triggerMap . "La', v:count1)<CR>", s:a, s:L)
call s:addMapping2(a:mapType, triggerMap . "LI', v:count1)<CR>", s:I, s:L)
call s:addMapping2(a:mapType, triggerMap . "LA', v:count1)<CR>", s:A, s:L)
endfor
endfunction
@@ -215,8 +207,12 @@ function! s:loadSettings()
if !exists('g:targets_aiAI')
let g:targets_aiAI = 'aiAI'
endif
if !exists('g:targets_nlNL')
let g:targets_nlNL = 'nlNL'
if !exists('g:targets_nl')
if exists('g:targets_nlNL')
let g:targets_nl = g:targets_nlNL[0:2] " legacy fallback
else
let g:targets_nl = 'nl'
endif
endif
if !exists('g:targets_pairs')
let g:targets_pairs = '()b {}B [] <>'
@@ -250,7 +246,7 @@ function! s:loadSettings()
endif
let [s:a, s:i, s:A, s:I] = split(g:targets_aiAI, '\zs')
let [s:n, s:l, s:N, s:L] = split(g:targets_nlNL, '\zs')
let [s:n, s:l] = split(g:targets_nl, '\zs')
endfunction
call s:loadSettings()
View
@@ -57,10 +57,10 @@ function! s:testBasic()
for op in [ 'c', 'd', 'y', 'v' ]
for cnt in [ '', '1', '2' ]
for LlnN in [ 'l', '', 'n' ]
for ln in [ 'l', '', 'n' ]
for iaIA in [ 'I', 'i', 'a', 'A' ]
execute "normal \"lpfx"
call s:execute(op, cnt . iaIA . LlnN . del)
call s:execute(op, cnt . iaIA . ln . del)
endfor
endfor
endfor
@@ -76,10 +76,10 @@ function! s:testBasic()
for op in [ 'c', 'd', 'y', 'v' ]
for cnt in [ '', '1', '2' ]
for LlnN in [ 'L', 'l', '', 'n', 'N' ]
for ln in [ 'l', '', 'n' ]
for iaIA in [ 'I', 'i', 'a', 'A' ]
execute "normal \"lpfx"
call s:execute(op, cnt . iaIA . LlnN . del)
call s:execute(op, cnt . iaIA . ln . del)
endfor
endfor
endfor
Oops, something went wrong.

0 comments on commit 7c6cf49

Please sign in to comment.