├── LICENSE
├── README.markdown
├── autoload
└── textobj
│ └── sentence.vim
├── plugin
└── textobj
│ └── sentence.vim
└── tests
├── jump_begin.vader
├── jump_end.vader
├── jump_quoted.vader
├── run
├── select_abbreviations.vader
├── select_basic.vader
├── select_brack.vader
├── select_general.vader
├── select_markdown.vader
├── select_paren.vader
├── select_partial.vader
└── select_quoted.vader
/LICENSE:
--------------------------------------------------------------------------------
1 | License: The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Reed Esau
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
24 |
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | # vim-textobj-sentence
2 |
3 | > Improving on Vim's native sentence text object and motion
4 |
5 | Detecting sentences can be tricky, esp. when the words and punctuation of
6 | a sentence are interspersed with abbreviations, “quotations,”
7 | (parentheses), [brackets], the \_\_markup\_\_ from \*\*lightweight\*\*
8 | markup languages, and hard
line
breaks.
9 |
10 | While Vim’s native sentence text object is quite capable, its behavior
11 | remains hard-coded and cannot be extended. Thus arises the need for
12 | a specialized text object offered by this plugin.
13 |
14 | Features of this plugin:
15 |
16 | * Sophisticated sentence text object, supporting selection, motion, and jump
17 | * Implemented with regular expressions via the [vim-textobj-user][vt] plugin
18 | * Supports sentences containing common abbreviations (configurable)
19 | * Support for sentences containing typographical characters, incl. quotes,
20 | em dash, etc.
21 | * Support for lightweight markup languages (markdown, e.g.)
22 | * Buffer scoped configuration
23 |
24 | ## Installation
25 |
26 | You can install using your favorite Vim package manager. (E.g.,
27 | [Pathogen][pathogen], [Vundle][vundle], or [Plug][plug].) If you are using
28 | a recent version of vim or neovim, you can also use native package
29 | support. (See [:help packages][packages].)
30 |
31 | [pathogen]: https://github.com/tpope/vim-pathogen
32 | [vundle]: https://github.com/VundleVim/Vundle.vim
33 | [plug]: https://github.com/junegunn/vim-plug
34 | [packages]: https://vimhelp.org/repeat.txt.html#packages
35 |
36 | This plugin has an essential dependency that you will need to install:
37 |
38 | * [kana/vim-textobj-user][vt] - a Vim plugin to create your own text
39 | objects without pain
40 |
41 | [vt]: https://github.com/kana/vim-textobj-user
42 |
43 | ## Configuration
44 |
45 | Because prose benefits more than code from a sentence text object, the
46 | behavior of this plugin can be configured per file type. For example, to
47 | enable sentence in `markdown` and `textile` files, place in your
48 | `.vimrc`:
49 |
50 | ```vim
51 | set nocompatible " this may already be in your .vimrc
52 | filetype plugin indent on " ...and this too
53 |
54 | augroup textobj_sentence
55 | autocmd!
56 | autocmd FileType markdown call textobj#sentence#init()
57 | autocmd FileType textile call textobj#sentence#init()
58 | augroup END
59 | ```
60 |
61 | ### Decimal numbers and abbreviations
62 |
63 | Though the period `.` glyph/character will normally terminate a sentence,
64 | it also has other uses. For example, the same glyph is used in
65 | abbreviations like ‘M.D.’ for Medical Doctor. These abbreviations, however,
66 | should be tolerated when detecting the boundaries of a sentence. The
67 | following should be considered one text object, rather than four:
68 |
69 | ```
70 | Magnum, P.I. lives at Robin’s Nest, located at 11435 18th Ave., Oahu, HI.
71 | ```
72 |
73 | This plugin detects decimal numbers and common abbreviations. By default,
74 | the following abbreviations will be recognized:
75 |
76 | ```
77 | let g:textobj#sentence#abbreviations = [
78 | \ '[ABCDIMPSUabcdegimpsv]',
79 | \ 'l[ab]', '[eRr]d', 'Ph', '[Ccp]l', '[Lli]n', '[cn]o',
80 | \ '[Oe]p', '[DJMSh]r', '[MVv]s', '[CFMPScfpw]t',
81 | \ 'alt', '[Ee]tc', 'div', 'es[pt]', '[Ll]td', 'min',
82 | \ '[MD]rs', '[Aa]pt', '[Aa]ve?', '[Ss]tr?',
83 | \ '[Aa]ssn', '[Bb]lvd', '[Dd]ept', 'incl', 'Inst', 'Prof', 'Univ',
84 | \ ]
85 | ```
86 |
87 | Note that you can override/modify the above defaults in your `.vimrc`, but
88 | be sure to include the declaration before your call to
89 | `textobj#sentence#init()`.
90 |
91 | ### Motion commands
92 |
93 | Motion commands on text objects are a powerful feature of Vim.
94 |
95 | This plugin overrides Vim’s native commands for sentence selection:
96 |
97 | * `as` - select ‘_around_’ sentence with trailing whitespace
98 | * `is` - select ‘_inside_’ sentence without trailing whitespace
99 |
100 | * `(` - move to start of previous sentence
101 | * `)` - move to start of next sentence
102 |
103 | This plugin adds:
104 |
105 | * `g)` - jump to end of current sentence
106 | * `g(` - jump to end of previous sentence
107 |
108 | You can manipulate text just as with Vim’s original `as` and `is`
109 | commands, such as `cis` for change, `vas` for visual selection, `das` for
110 | deletion, `yas` for yanking to clipboard, etc.. Note that count isn’t
111 | supported at present (due to limitations of the underlying
112 | vim-textobj-user) but repeat with `.` does work.
113 |
114 | If you prefer to retain the native commands, you can assign other
115 | key mappings via your `.vimrc`:
116 |
117 | ```vim
118 | let g:textobj#sentence#select = 's'
119 | let g:textobj#sentence#move_p = '('
120 | let g:textobj#sentence#move_n = ')'
121 | ```
122 |
123 | ## See also
124 |
125 | If you find this plugin useful, check out these others originally by
126 | [@reedes][re]:
127 |
128 | * [vim-colors-pencil][cp] - color scheme for Vim inspired by IA Writer
129 | * [vim-lexical][lx] - building on Vim’s spell-check and
130 | thesaurus/dictionary completion
131 | * [vim-litecorrect][lc] - lightweight auto-correction for Vim
132 | * [vim-pencil][pn] - rethinking Vim as a tool for writers
133 | * [vim-textobj-quote][qu] - extends Vim to support typographic (‘curly’) quotes
134 | * [vim-thematic][th] - modify Vim’s appearance to suit your task and environment
135 | * [vim-wheel][wh] - screen-anchored cursor movement for Vim
136 | * [vim-wordy][wo] - uncovering usage problems in writing
137 | * [vim-wordchipper][wc] - power tool for shredding text in Insert mode
138 |
139 | [re]: https://github.com/reedes
140 | [cp]: https://github.com/preservim/vim-colors-pencil
141 | [lx]: https://github.com/preservim/vim-lexical
142 | [lc]: https://github.com/preservim/vim-litecorrect
143 | [pn]: https://github.com/preservim/vim-pencil
144 | [qu]: https://github.com/preservim/vim-textobj-quote
145 | [th]: https://github.com/preservim/vim-thematic
146 | [wh]: https://github.com/preservim/vim-wheel
147 | [wo]: https://github.com/preservim/vim-wordy
148 | [wc]: https://github.com/preservim/vim-wordchipper
149 |
150 | ## Future development
151 |
152 | If you’ve spotted a problem or have an idea on improving this plugin,
153 | please post it to the [GitHub project issue page][issues].
154 |
155 | [issues]: https://github.com/preservim/vim-textobj-sentence/issues
156 |
157 |
158 |
--------------------------------------------------------------------------------
/autoload/textobj/sentence.vim:
--------------------------------------------------------------------------------
1 | " ============================================================================
2 | " File: textobj_sentence.vim
3 | " Description: load functions for vim-textobj_sentence plugin
4 | " Maintainer: preservim
5 | " Created: January 25, 2013
6 | " License: The MIT License (MIT)
7 | " ============================================================================
8 |
9 | scriptencoding utf-8
10 |
11 | if &cp || (exists('g:autoloaded_textobj_sentence')
12 | \ && !exists('g:force_reload_textobj_sentence'))
13 | finish
14 | endif
15 |
16 | function! s:select(pattern)
17 | call search(a:pattern, 'bc')
18 | let l:start = getpos('.')
19 | call search(a:pattern, 'ce')
20 | let l:end = getpos('.')
21 | return ['v', l:start, l:end]
22 | endfunction
23 |
24 | function! textobj#sentence#select_a()
25 | if !exists('b:textobj_sentence_re_a')
26 | call textobj#sentence#init()
27 | endif
28 | return s:select(b:textobj_sentence_re_a)
29 | endfunction
30 |
31 | function! textobj#sentence#select_i()
32 | if !exists('b:textobj_sentence_re_i')
33 | call textobj#sentence#init()
34 | endif
35 | return s:select(b:textobj_sentence_re_i)
36 | endfunction
37 |
38 | function! textobj#sentence#init(...)
39 | let l:args = a:0 ? a:1 : {}
40 |
41 | let l:double_pair = get(l:args, 'double', g:textobj#sentence#doubleDefault)
42 | let l:single_pair = get(l:args, 'single', g:textobj#sentence#singleDefault)
43 |
44 | " obtain the individual quote characters
45 | let l:d_arg = split(l:double_pair, '\zs')
46 | let l:s_arg = split(l:single_pair, '\zs')
47 | let b:textobj_sentence_quote_dl = l:d_arg[0]
48 | let b:textobj_sentence_quote_dr = l:d_arg[1]
49 | let b:textobj_sentence_quote_sl = l:s_arg[0]
50 | let b:textobj_sentence_quote_sr = l:s_arg[1]
51 |
52 | let l:quotes_std = '"''*_'
53 | let l:leading =
54 | \ '(\[' .
55 | \ l:quotes_std .
56 | \ b:textobj_sentence_quote_sl .
57 | \ b:textobj_sentence_quote_dl
58 | let l:trailing =
59 | \ ')\]' .
60 | \ l:quotes_std .
61 | \ b:textobj_sentence_quote_sr .
62 | \ b:textobj_sentence_quote_dr
63 |
64 | " Avoid matching where more of the sentence can be found on preceding line(s)
65 | let l:re_negative_lookback =
66 | \ '([' .
67 | \ l:leading .
68 | \ '[:alnum:]–—()\[\]_*,;:-]\_s*)@2000'
80 | \ : ''
81 |
82 | let l:max_abbrev_len = 10 " allow for lookback on -1.2345678
83 | let l:re_abbrev_neg_lookback =
84 | \ '([-0-9]+' .
85 | \ l:bounded_abbrs .
86 | \ ')@' . l:max_abbrev_len . '
5 | " Created: January 27, 2013
6 | " License: The MIT License (MIT)
7 | " ============================================================================
8 |
9 | scriptencoding utf-8
10 |
11 | if exists('g:loaded_textobj_sentence') | finish | endif
12 |
13 | if !exists('g:textobj#sentence#select')
14 | let g:textobj#sentence#select = 's'
15 | endif
16 |
17 | if !exists('g:textobj#sentence#move_p')
18 | let g:textobj#sentence#move_p = '('
19 | endif
20 |
21 | if !exists('g:textobj#sentence#move_n')
22 | let g:textobj#sentence#move_n = ')'
23 | endif
24 |
25 | let g:textobj#sentence#doubleStandard = '“”'
26 | let g:textobj#sentence#singleStandard = '‘’'
27 |
28 | if !exists('g:textobj#sentence#doubleDefault')
29 | " “double”
30 | let g:textobj#sentence#doubleDefault = g:textobj#sentence#doubleStandard
31 | endif
32 | if !exists('g:textobj#sentence#singleDefault')
33 | " ‘single’
34 | let g:textobj#sentence#singleDefault = g:textobj#sentence#singleStandard
35 | endif
36 |
37 | if !exists('g:textobj#sentence#abbreviations')
38 | let g:textobj#sentence#abbreviations = [
39 | \ '[ABCDIMPSUabcdegimpsv]',
40 | \ 'l[ab]', '[eRr]d', 'Ph', '[Ccp]l', '[Lli]n', '[cn]o',
41 | \ '[Oe]p', '[DJMSh]r', '[MVv]s', '[CFMPScfpw]t',
42 | \ 'alt', '[Ee]tc', 'div', 'es[pt]', '[Ll]td', 'min',
43 | \ '[MD]rs', '[Aa]pt', '[Aa]ve?', '[Ss]tr?',
44 | \ '[Aa]ssn', '[Bb]lvd', '[Dd]ept', 'incl', 'Inst', 'Prof', 'Univ',
45 | \ 'Messrs',
46 | \ ]
47 | endif
48 |
49 | let g:loaded_textobj_sentence = 1
50 |
--------------------------------------------------------------------------------
/tests/jump_begin.vader:
--------------------------------------------------------------------------------
1 | ###########################################################
2 | # Tests to jump to beginning of sentences using '(' and ')'
3 | ###########################################################
4 |
5 | Execute (Clean up test environment):
6 | call textobj#sentence#init()
7 |
8 | ###########################################################
9 |
10 | Given:
11 | TV's Frank: [shouts] Not the children! Aw-haw-haw!
12 |
13 | Do (jump to start of next sentence):
14 | )viwU
15 |
16 | Expect ():
17 | TV's Frank: [shouts] Not the children! AW-haw-haw!
18 |
19 | ###########################################################
20 |
21 | Given:
22 | We've caulked this, added water, and we've turned it into Water Polo.
23 | Woo!
24 |
25 | Do (jump to start of second sentence):
26 | )rX
27 |
28 | Expect:
29 | We've caulked this, added water, and we've turned it into Water Polo.
30 | Xoo!
31 |
32 | ###########################################################
33 |
34 | Given:
35 | TV's Frank: [shouts] Not the children! Aw-haw-haw!
36 |
37 | The other day, my colon looked up at me and said, “Frank, thank you.”
38 |
39 | Do (jump to start of third sentence, which is at beginning of line):
40 | ))rX
41 |
42 | Expect:
43 | TV's Frank: [shouts] Not the children! Aw-haw-haw!
44 |
45 | Xhe other day, my colon looked up at me and said, “Frank, thank you.”
46 |
47 | ###########################################################
48 |
49 | Given:
50 | So what we've done is taken the whole Foosball concept, and
51 | uh... We've caulked this, added water, and we've turned it
52 | into Water Polo. Woo!
53 |
54 | Do (jump to start of third sentence, which is not at beginning of line):
55 | ))rX
56 |
57 | Expect:
58 | So what we've done is taken the whole Foosball concept, and
59 | uh... We've caulked this, added water, and we've turned it
60 | into Water Polo. Xoo!
61 |
62 | ###########################################################
63 |
64 | Given:
65 | This is a test
66 |
67 | This is a test.
68 |
69 | Do (jump to from sentence without terminator well-formed sentence):
70 | )rX
71 |
72 | Expect:
73 | This is a test
74 |
75 | Xhis is a test.
76 |
77 | ###########################################################
78 |
79 | Given:
80 | This is a test
81 |
82 | This is a test
83 |
84 | Do (jump to from terminator-free sentence to another):
85 | )rX
86 |
87 | Expect:
88 | This is a test
89 |
90 | Xhis is a test
91 |
92 | ###########################################################
93 |
94 | Given:
95 | This is a test.
96 |
97 | this is a test
98 |
99 | Do (do not jump to well-formed to poorly-formed sentence):
100 | )rX
101 |
102 | Expect:
103 | Xhis is a test.
104 |
105 | this is a test
106 |
107 | ###########################################################
108 |
--------------------------------------------------------------------------------
/tests/jump_end.vader:
--------------------------------------------------------------------------------
1 | #############################################################
2 | # Tests to jump to beginning of sentences using 'g(' and 'g)'
3 | #############################################################
4 |
5 | Execute (Clean up test environment):
6 | call textobj#sentence#init()
7 |
8 | ###########################################################
9 |
10 | Given:
11 | TV's Frank: [shouts] Not the children! Aw-haw-haw!
12 |
13 | Do (jump to end of first sentence):
14 | g)rX
15 |
16 | Expect:
17 | TV's Frank: [shouts] Not the childrenX Aw-haw-haw!
18 |
19 | ###########################################################
20 |
21 | Given:
22 | TV's Frank: [shouts] Not the children! Aw-haw-haw!
23 |
24 | Do (from end, jump to end of first sentence):
25 | $g(rX
26 |
27 | Expect:
28 | TV's Frank: [shouts] Not the childrenX Aw-haw-haw!
29 |
30 | ###########################################################
31 |
--------------------------------------------------------------------------------
/tests/jump_quoted.vader:
--------------------------------------------------------------------------------
1 | ###########################################################
2 | # Jumping in quoted sentences
3 | ###########################################################
4 |
5 | Execute (Clean up test environment):
6 | call textobj#sentence#init()
7 |
8 | ###########################################################
9 |
10 | Given:
11 | The other day, my colon looked up at me and said, “Frank, thank you.” I said
12 | “No. Thank YOU.” But now, what am I going to do with all the meat I have
13 | stored in freezers? I figured, “Hey, why not bring the meat back to life?”
14 |
15 | Do (jump three sentences):
16 | 3)visU
17 |
18 | Expect:
19 | The other day, my colon looked up at me and said, “Frank, thank you.” I said
20 | “No. Thank YOU.” BUT NOW, WHAT AM I GOING TO DO WITH ALL THE MEAT I HAVE
21 | STORED IN FREEZERS? I figured, “Hey, why not bring the meat back to life?”
22 |
23 | ###########################################################
24 |
25 | Given:
26 | The other day, my colon looked up at me and said, “Frank, thank you.” I said
27 | “No. Thank YOU.” But now, what am I going to do with all the meat I have
28 | stored in freezers? I figured, “Hey, why not bring the meat back to life?”
29 |
30 | Do (jump four sentences forward and three back):
31 | 4)3(rX
32 |
33 | Expect:
34 | The other day, my colon looked up at me and said, “Frank, thank you.” X said
35 | “No. Thank YOU.” But now, what am I going to do with all the meat I have
36 | stored in freezers? I figured, “Hey, why not bring the meat back to life?”
37 |
38 | ###########################################################
39 |
40 | Given:
41 | The other day, my colon looked up at me and said, “Frank, thank you.” I said
42 | “No. Thank YOU.” But now, what am I going to do with all the meat I have
43 | stored in freezers? I figured, “Hey, why not bring the meat back to life?”
44 |
45 | Do (jump to end of three sentences):
46 | 3g)rX
47 |
48 | Expect:
49 | The other day, my colon looked up at me and said, “Frank, thank you.” I said
50 | “No. Thank YOU.X But now, what am I going to do with all the meat I have
51 | stored in freezers? I figured, “Hey, why not bring the meat back to life?”
52 |
53 | ###########################################################
54 |
55 | Given:
56 | The other day, my colon looked up at me and said, “Frank, thank you.” I said
57 | “No. Thank YOU.” But now, what am I going to do with all the meat I have
58 | stored in freezers? I figured, “Hey, why not bring the meat back to life?”
59 |
60 | Do (from end jump 3 sentences backwards):
61 | G$3g(rX
62 |
63 | Expect:
64 | The other day, my colon looked up at me and said, “Frank, thank you.” I said
65 | “NoX Thank YOU.” But now, what am I going to do with all the meat I have
66 | stored in freezers? I figured, “Hey, why not bring the meat back to life?”
67 |
68 |
--------------------------------------------------------------------------------
/tests/run:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | VIMRC="$TMPDIR/mini-vimrc"
4 | SOURCE="$HOME/.vim/bundle/vim-textobj-sentence"
5 |
6 | cat > $VIMRC << EOF
7 | set nocompatible
8 | syntax on
9 | set shortmess+=I
10 |
11 | for dep in ['vader.vim', 'vim-textobj-user']
12 | execute 'set rtp+=' . finddir(dep, expand('~/.vim').'/**')
13 | endfor
14 | set rtp+=$SOURCE
15 | EOF
16 |
17 | cd $SOURCE/tests
18 | vim -u $VIMRC +Vader*
19 | #vim -u $VIMRC '+Vader!*' && echo Success || echo Failure
20 |
21 | rm -f $VIMRC
22 |
--------------------------------------------------------------------------------
/tests/select_abbreviations.vader:
--------------------------------------------------------------------------------
1 | Execute (Clean up test environment):
2 | call textobj#sentence#init()
3 |
4 | ###########################################################
5 |
6 | Given:
7 | "Why am _I_ Mr. Pink?"
8 |
9 | Do (select sentence with Mr.):
10 | visU
11 |
12 | Expect:
13 | "WHY AM _I_ MR. PINK?"
14 |
15 | ###########################################################
16 |
17 | Given:
18 | "Why am _I_ Mr? Pink?"
19 |
20 | Do (select sentence with Mr?):
21 | visU
22 |
23 | Expect:
24 | "WHY AM _I_ MR? Pink?"
25 |
26 | ###########################################################
27 |
28 | Given:
29 | "A sentence with Mr. Ms. Dr.. Amazing!"
30 |
31 | Do (select sentence with multiple acryonyms):
32 | visU
33 |
34 | Expect:
35 | "A SENTENCE WITH MR. MS. DR.. Amazing!"
36 |
37 | ###########################################################
38 |
39 | Given:
40 | "A sentence with an M.D. and a Ph.D.. Amazing!"
41 |
42 | Do (select sentence with MD and PhD):
43 | visU
44 |
45 | Expect:
46 | "A SENTENCE WITH AN M.D. AND A PH.D.. Amazing!"
47 |
48 | ###########################################################
49 |
50 | Given:
51 | "A sentence with 0.3533, -1.3233, and 23432223.23 meters."
52 |
53 | Do (select sentence decimal numbers):
54 | visU
55 |
56 | Expect:
57 | "A SENTENCE WITH 0.3533, -1.3233, AND 23432223.23 METERS."
58 |
59 | ###########################################################
60 |
61 | Given:
62 | The other day, my colon looked up at me and said, “Frank, thank you.” I said
63 | “No. Thank YOU.” But now, what am I going to do with all the meat I have
64 | stored in freezers? I figured, “Hey, why not bring the meat back to life?”
65 |
66 | Do (YOU. being interpreted as abbrev):
67 | /But now\visU
68 |
69 | Expect:
70 | The other day, my colon looked up at me and said, “Frank, thank you.” I said
71 | “No. Thank YOU.” BUT NOW, WHAT AM I GOING TO DO WITH ALL THE MEAT I HAVE
72 | STORED IN FREEZERS? I figured, “Hey, why not bring the meat back to life?”
73 |
74 | ###########################################################
75 |
76 | Given:
77 | Though the period `.` glyph/character will terminate a sentence, it
78 | doesn’t terminate all sentences. The same glyph is used in
79 | abbreviations like ‘M.D.’ for Medical Doctor, for example.
80 |
81 | Do (M.D. test):
82 | /Doctor\visU
83 |
84 | Expect:
85 | Though the period `.` glyph/character will terminate a sentence, it
86 | doesn’t terminate all sentences. THE SAME GLYPH IS USED IN
87 | ABBREVIATIONS LIKE ‘M.D.’ FOR MEDICAL DOCTOR, FOR EXAMPLE.
88 |
89 | ###########################################################
90 |
91 | Given:
92 | TV's
93 | Magnum, P.I. lives at Robin’s Nest, located at 11435 18th Ave., Oahu, HI.
94 |
95 | Do (P.I. test):
96 | /Nest\visU
97 |
98 | Expect:
99 | TV'S
100 | MAGNUM, P.I. LIVES AT ROBIN’S NEST, LOCATED AT 11435 18TH AVE., OAHU, HI.
101 |
102 |
--------------------------------------------------------------------------------
/tests/select_basic.vader:
--------------------------------------------------------------------------------
1 | Execute (Clean up test environment):
2 | call textobj#sentence#init()
3 |
4 | ###########################################################
5 |
6 | Given:
7 | First sentence. Second sentence. Third sentence.
8 | Fourth Sentence.
9 |
10 | Do (select inside of first sentence):
11 | /rst\visrX
12 |
13 | Expect:
14 | XXXXXXXXXXXXXXX Second sentence. Third sentence.
15 | Fourth Sentence.
16 |
17 | ###########################################################
18 |
19 | Given:
20 | First sentence. Second sentence. Third sentence.
21 | Fourth Sentence.
22 |
23 | Do (select inside of second sentence):
24 | /ond\visrX
25 |
26 | Expect:
27 | First sentence. XXXXXXXXXXXXXXXX Third sentence.
28 | Fourth Sentence.
29 |
30 | ###########################################################
31 |
32 | Given:
33 | First sentence. Second sentence. Third sentence.
34 | Fourth Sentence.
35 |
36 | Do (select inside of third sentence):
37 | /ird\visrX
38 |
39 | Expect:
40 | First sentence. Second sentence. XXXXXXXXXXXXXXX
41 | Fourth Sentence.
42 |
43 | ###########################################################
44 |
45 | Given:
46 | First sentence. Second sentence. Third sentence.
47 | Fourth Sentence.
48 |
49 | Do (select inside of fourth sentence):
50 | /our\visrX
51 |
52 | Expect:
53 | First sentence. Second sentence. Third sentence.
54 | XXXXXXXXXXXXXXXX
55 |
56 | ###########################################################
57 |
58 | Given:
59 | First sentence. Second sentence. Third sentence.
60 | Fourth Sentence.
61 |
62 | Do (select around first sentence):
63 | /rst\vasrX
64 |
65 | Expect:
66 | XXXXXXXXXXXXXXXXSecond sentence. Third sentence.
67 | Fourth Sentence.
68 |
69 | ###########################################################
70 |
71 | Given:
72 | First sentence. Second sentence. Third sentence.
73 | Fourth Sentence.
74 |
75 | Do (select around second sentence):
76 | /ond\vasrX
77 |
78 | Expect:
79 | First sentence. XXXXXXXXXXXXXXXXXThird sentence.
80 | Fourth Sentence.
81 |
82 | ###########################################################
83 |
84 | Given:
85 | First sentence. Second sentence. Third sentence.
86 | Fourth Sentence.
87 |
88 | Do (select around third sentence):
89 | /ird\vasrX
90 |
91 | Expect:
92 | First sentence. Second sentence. XXXXXXXXXXXXXXX
93 | Fourth Sentence.
94 |
95 | ###########################################################
96 |
97 | Given:
98 | First sentence. Second sentence. Third sentence.
99 | Fourth Sentence.
100 |
101 | Do (select around fourth sentence):
102 | /our\vasrX
103 |
104 | Expect:
105 | First sentence. Second sentence. Third sentence.
106 | XXXXXXXXXXXXXXXX
107 |
108 | ###########################################################
109 |
--------------------------------------------------------------------------------
/tests/select_brack.vader:
--------------------------------------------------------------------------------
1 | Execute (Clean up test environment):
2 | call textobj#sentence#init()
3 |
4 | ###########################################################
5 |
6 | Given:
7 | [TV's Frank [shouts] "Not the children, Aw-haw-haw".]
8 |
9 | Do (select traditional bracket sentence):
10 | visrX
11 |
12 | Expect:
13 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
14 |
15 | ###########################################################
16 |
17 | Given:
18 | [TV's Frank [shouts] "Not the children, Aw-haw-haw."]
19 |
20 | Do (select traditional bracket sentence, with quotes):
21 | visrX
22 |
23 | Expect:
24 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
25 |
26 | ###########################################################
27 |
28 | Given:
29 | [TV's Frank [shouts] "Not the children, Aw-haw-haw"].
30 |
31 | Do (select nouveau bracket sentence):
32 | visrX
33 |
34 | Expect:
35 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
36 |
37 | ###########################################################
38 |
39 | Given:
40 | [[TV's Frank [shouts]]
41 | "Not the children, Aw-haw-haw."]
42 |
43 | Do (select double bracket, on two lines, from first line):
44 | visrX
45 |
46 | Expect:
47 | XXXXXXXXXXXXXXXXXXXXXX
48 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
49 |
50 | ###########################################################
51 |
52 | Given:
53 | [[TV's Frank [shouts]]
54 | "Not the children, Aw-haw-haw."]
55 |
56 | Do (select double bracket, on two lines, with close, from second line):
57 | jvisrX
58 |
59 | Expect:
60 | XXXXXXXXXXXXXXXXXXXXXX
61 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
62 |
63 | ###########################################################
64 |
65 | Given:
66 | [TV's Frank [shouts][
67 | "Not the children, Aw-haw-haw."]]
68 |
69 | Do (select double bracket, on two lines, with open, from second line):
70 | jvisrX
71 |
72 | Expect:
73 | XXXXXXXXXXXXXXXXXXXXX
74 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
75 |
76 | ###########################################################
77 |
78 | Given:
79 | It was five in the morning [5 A.M. to be specific.]
80 |
81 | Do (abbreviation in brackets):
82 | visrX
83 |
84 | Expect:
85 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
86 |
87 | ###########################################################
88 |
--------------------------------------------------------------------------------
/tests/select_general.vader:
--------------------------------------------------------------------------------
1 | Execute (Clean up test environment):
2 | call textobj#sentence#init()
3 |
4 | ###########################################################
5 |
6 | Given:
7 | So what we've done is taken the whole Foosball concept, and
8 | uh... We've caulked this, added water, and we've turned it
9 | into Water Polo. Woo!
10 |
11 | Do (select first sentence):
12 | visU
13 |
14 | Expect:
15 | SO WHAT WE'VE DONE IS TAKEN THE WHOLE FOOSBALL CONCEPT, AND
16 | UH... We've caulked this, added water, and we've turned it
17 | into Water Polo. Woo!
18 |
19 | ###########################################################
20 |
21 | Given:
22 | So what we've done is taken the whole Foosball concept, and
23 | uh... We've caulked this, added water, and we've turned it
24 | into Water Polo. Woo!
25 |
26 | Do (select second sentence):
27 | /caulked\visU
28 |
29 | Expect:
30 | So what we've done is taken the whole Foosball concept, and
31 | uh... WE'VE CAULKED THIS, ADDED WATER, AND WE'VE TURNED IT
32 | INTO WATER POLO. Woo!
33 |
34 | ###########################################################
35 |
36 | Given:
37 | So what we've done is taken the whole Foosball concept, and
38 | uh... We've caulked this, added water, and we've turned it
39 | into Water Polo. Woo!
40 |
41 | Do (select third sentence):
42 | /Woo\visU
43 |
44 | Expect:
45 | So what we've done is taken the whole Foosball concept, and
46 | uh... We've caulked this, added water, and we've turned it
47 | into Water Polo. WOO!
48 |
49 | ###########################################################
50 |
51 | Given:
52 | We've caulked this, added water, and we've turned it into Water Polo. TV's
53 | Frank not the children. Aw-haw-haw. The other day, my colon looked up
54 | at me and said, “Frank, thank you.”
55 |
56 | Do (select line starting with upper):
57 | /Frank\visu
58 |
59 | Expect:
60 | We've caulked this, added water, and we've turned it into Water Polo. tv's
61 | frank not the children. Aw-haw-haw. The other day, my colon looked up
62 | at me and said, “Frank, thank you.”
63 |
64 | ###########################################################
65 |
66 | Given:
67 | Frank:
68 | We've caulked this, added water, and we've turned it into
69 | Water Polo! Aw-haw-haw.
70 |
71 | Do (select line ending with colon):
72 | visU
73 |
74 | Expect:
75 | FRANK:
76 | WE'VE CAULKED THIS, ADDED WATER, AND WE'VE TURNED IT INTO
77 | WATER POLO! Aw-haw-haw.
78 |
79 | ###########################################################
80 |
81 | Given:
82 | We've caulked this—
83 | Added water, and we've turned it into
84 | Water Polo! Aw-haw-haw.
85 |
86 | Do (select sentence with em dash):
87 | visU
88 |
89 | Expect:
90 | WE'VE CAULKED THIS—
91 | ADDED WATER, AND WE'VE TURNED IT INTO
92 | WATER POLO! Aw-haw-haw.
93 |
94 | ###########################################################
95 |
96 | Given:
97 | We've caulked this—
98 | Added water, and we've turned it into
99 | Water Polo! Aw-haw-haw.
100 |
101 | Do (from below, select sentence with em dash):
102 | jjvisU
103 |
104 | Expect:
105 | WE'VE CAULKED THIS—
106 | ADDED WATER, AND WE'VE TURNED IT INTO
107 | WATER POLO! Aw-haw-haw.
108 |
109 | ###########################################################
110 |
111 | Given:
112 | We've caulked this–
113 | Added water, and we've turned it into
114 | Water Polo! Aw-haw-haw.
115 |
116 | Do (from below, select sentence with en dash):
117 | jjvisU
118 |
119 | Expect:
120 | WE'VE CAULKED THIS–
121 | ADDED WATER, AND WE'VE TURNED IT INTO
122 | WATER POLO! Aw-haw-haw.
123 |
124 | ###########################################################
125 |
126 | Given:
127 | The number 12abc34
128 | We've caulked this, added water, and we've turned it into
129 | Water Polo! Aw-haw-haw.
130 |
131 | Do (select line preceded by number):
132 | jvisU
133 |
134 | Expect:
135 | THE NUMBER 12ABC34
136 | WE'VE CAULKED THIS, ADDED WATER, AND WE'VE TURNED IT INTO
137 | WATER POLO! Aw-haw-haw.
138 |
139 | ###########################################################
140 |
141 | Given:
142 | Frank:
143 |
144 | We've caulked this, added water, and we've turned it into
145 | Water Polo! Aw-haw-haw.
146 |
147 | Do (select isolated line ending with colon):
148 | visU
149 |
150 | Expect:
151 | FRANK:
152 |
153 | We've caulked this, added water, and we've turned it into
154 | Water Polo! Aw-haw-haw.
155 |
156 | ###########################################################
157 |
158 | Given:
159 | The other day, my colon looked up
160 | at me and said, Frank, thank you.
161 |
162 | Do (comma before upper case):
163 | /Frank\visU
164 |
165 | Expect:
166 | THE OTHER DAY, MY COLON LOOKED UP
167 | AT ME AND SAID, FRANK, THANK YOU.
168 |
169 | ###########################################################
170 |
171 | Given:
172 | The other day, my colon looked up
173 | at me and said-Frank-thank you.
174 |
175 | Do (dash before upper case):
176 | /Frank\visU
177 |
178 | Expect:
179 | THE OTHER DAY, MY COLON LOOKED UP
180 | AT ME AND SAID-FRANK-THANK YOU.
181 |
182 | ###########################################################
183 |
184 | Given:
185 | The other day, my colon looked up
186 | at me and said;Frank;thank you.
187 |
188 | Do (semi-colon before upper case):
189 | /Frank\visU
190 |
191 | Expect:
192 | THE OTHER DAY, MY COLON LOOKED UP
193 | AT ME AND SAID;FRANK;THANK YOU.
194 |
195 | ###########################################################
196 |
197 | Given:
198 | The other day, my colon looked up
199 | at me and said: Frank, thank you.
200 |
201 | Do (colon before upper case):
202 | /Frank\visU
203 |
204 | Expect:
205 | THE OTHER DAY, MY COLON LOOKED UP
206 | AT ME AND SAID: FRANK, THANK YOU.
207 |
208 | ###########################################################
209 |
210 | Given:
211 | So what we've done is taken the whole Foosball concept, and
212 | uh... We've caulked this, added water, and we've turned it
213 | into Water Polo. Woo!
214 |
215 | Do (select all of first sentence):
216 | vasrX
217 |
218 | Expect:
219 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
220 | XXXXXXWe've caulked this, added water, and we've turned it
221 | into Water Polo. Woo!
222 |
223 | ###########################################################
224 |
225 | Given:
226 | So what we've done is taken the whole Foosball concept, and
227 | uh... We've caulked this, added water, and we've turned it
228 | into Water Polo. Woo!
229 |
230 | Do (select all of third sentence):
231 | /Woo\vasrX
232 |
233 | Expect:
234 | So what we've done is taken the whole Foosball concept, and
235 | uh... We've caulked this, added water, and we've turned it
236 | into Water Polo. XXXX
237 |
238 | ###########################################################
239 |
--------------------------------------------------------------------------------
/tests/select_markdown.vader:
--------------------------------------------------------------------------------
1 | Execute (Clean up test environment):
2 | call textobj#sentence#init()
3 |
4 | ###########################################################
5 |
6 | Given:
7 | _TV's Frank _shouts_ "Not the children, Aw-haw-haw"._
8 |
9 | Do (select traditional _markdown_ sentence):
10 | visrX
11 |
12 | Expect:
13 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
14 |
15 | ###########################################################
16 |
17 | Given:
18 | _TV's Frank _shouts_ "Not the children, Aw-haw-haw."_
19 |
20 | Do (select traditional _markdown_ sentence, with quotes):
21 | visrX
22 |
23 | Expect:
24 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
25 |
26 | ###########################################################
27 |
28 | Given:
29 | __TV's Frank _shouts_ "Not the children, Aw-haw-haw."__
30 |
31 | Do (select traditional __markdown__ sentence, with quotes):
32 | visrX
33 |
34 | Expect:
35 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
36 |
37 | ###########################################################
38 |
39 | Given:
40 | _TV's Frank _shouts_ "Not the children, Aw-haw-haw"_.
41 |
42 | Do (select nouveau _markdown_ sentence):
43 | visrX
44 |
45 | Expect:
46 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
47 |
48 | ###########################################################
49 |
50 | Given:
51 | __TV's Frank _shouts__
52 | "Not the children, Aw-haw-haw."_
53 |
54 | Do (select double _markdown_, on two lines, from first line):
55 | visrX
56 |
57 | Expect:
58 | XXXXXXXXXXXXXXXXXXXXXX
59 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
60 |
61 | ###########################################################
62 |
63 | Given:
64 | __TV's Frank _shouts__
65 | "Not the children, Aw-haw-haw."_
66 |
67 | Do (select double _markdown_, on two lines, with close, from second line):
68 | jvisrX
69 |
70 | Expect:
71 | XXXXXXXXXXXXXXXXXXXXXX
72 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
73 |
74 | ###########################################################
75 |
76 | Given:
77 | _TV's Frank _shouts__
78 | "Not the children, Aw-haw-haw."__
79 |
80 | Do (select double _markdown_, on two lines, with open, from second line):
81 | jvisrX
82 |
83 | Expect:
84 | XXXXXXXXXXXXXXXXXXXXX
85 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
86 |
87 | ###########################################################
88 |
89 | Given:
90 | It was five in the morning _5 A.M. to be specific._
91 |
92 | Do (abbreviation in _markdown_s):
93 | visrX
94 |
95 | Expect:
96 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
97 |
98 | ###########################################################
99 |
100 | Given:
101 | *TV's Frank *shouts* "Not the children, Aw-haw-haw".*
102 |
103 | Do (select traditional *markdown* sentence):
104 | visrX
105 |
106 | Expect:
107 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
108 |
109 | ###########################################################
110 |
111 | Given:
112 | *TV's Frank *shouts* "Not the children, Aw-haw-haw."*
113 |
114 | Do (select traditional *markdown* sentence, with quotes):
115 | visrX
116 |
117 | Expect:
118 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
119 |
120 | ###########################################################
121 |
122 | Given:
123 | **TV's Frank *shouts* "Not the children, Aw-haw-haw."**
124 |
125 | Do (select traditional **markdown** sentence, with quotes):
126 | visrX
127 |
128 | Expect:
129 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
130 |
131 | ###########################################################
132 |
133 | Given:
134 | *TV's Frank *shouts* "Not the children, Aw-haw-haw"*.
135 |
136 | Do (select nouveau *markdown* sentence):
137 | visrX
138 |
139 | Expect:
140 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
141 |
142 | ###########################################################
143 |
144 | Given:
145 | **TV's Frank *shouts**
146 | "Not the children, Aw-haw-haw."*
147 |
148 | Do (select double *markdown*, on two lines, from first line):
149 | visrX
150 |
151 | Expect:
152 | XXXXXXXXXXXXXXXXXXXXXX
153 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
154 |
155 | ###########################################################
156 |
157 | Given:
158 | **TV's Frank *shouts**
159 | "Not the children, Aw-haw-haw."*
160 |
161 | Do (select double *markdown*, on two lines, with close, from second line):
162 | jvisrX
163 |
164 | Expect:
165 | XXXXXXXXXXXXXXXXXXXXXX
166 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
167 |
168 | ###########################################################
169 |
170 | Given:
171 | *TV's Frank *shouts**
172 | "Not the children, Aw-haw-haw."**
173 |
174 | Do (select double *markdown*, on two lines, with open, from second line):
175 | jvisrX
176 |
177 | Expect:
178 | XXXXXXXXXXXXXXXXXXXXX
179 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
180 |
181 | ###########################################################
182 |
183 | Given:
184 | It was five in the morning *5 A.M. to be specific.*
185 |
186 | Do (abbreviation in *markdown*):
187 | visrX
188 |
189 | Expect:
190 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
191 |
192 | ###########################################################
193 |
--------------------------------------------------------------------------------
/tests/select_paren.vader:
--------------------------------------------------------------------------------
1 | Execute (Clean up test environment):
2 | call textobj#sentence#init()
3 |
4 | ###########################################################
5 |
6 | Given:
7 | (TV's Frank [shouts] "Not the children, Aw-haw-haw".)
8 |
9 | Do (select traditional parenthesized sentence):
10 | visrX
11 |
12 | Expect:
13 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
14 |
15 | ###########################################################
16 |
17 | Given:
18 | (TV's Frank [shouts] "Not the children, Aw-haw-haw.")
19 |
20 | Do (select traditional parenthesized sentence, with quotes):
21 | visrX
22 |
23 | Expect:
24 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
25 |
26 | ###########################################################
27 |
28 | Given:
29 | (TV's Frank [shouts] "Not the children, Aw-haw-haw").
30 |
31 | Do (select nouveau parenthesized sentence):
32 | visrX
33 |
34 | Expect:
35 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
36 |
37 | ###########################################################
38 |
39 | Given:
40 | ((TV's Frank [shouts])
41 | "Not the children, Aw-haw-haw.")
42 |
43 | Do (select double paren, on two lines, from first line):
44 | visrX
45 |
46 | Expect:
47 | XXXXXXXXXXXXXXXXXXXXXX
48 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
49 |
50 | ###########################################################
51 |
52 | Given:
53 | ((TV's Frank [shouts])
54 | "Not the children, Aw-haw-haw.")
55 |
56 | Do (select double paren, on two lines, with close, from second line):
57 | jvisrX
58 |
59 | Expect:
60 | XXXXXXXXXXXXXXXXXXXXXX
61 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
62 |
63 | ###########################################################
64 |
65 | Given:
66 | (TV's Frank [shouts](
67 | "Not the children, Aw-haw-haw."))
68 |
69 | Do (select double paren, on two lines, with open, from second line):
70 | jvisrX
71 |
72 | Expect:
73 | XXXXXXXXXXXXXXXXXXXXX
74 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
75 |
76 | ###########################################################
77 |
78 | Given:
79 | It was five in the morning (5 A.M. to be specific.)
80 |
81 | Do (abbreviation in parens):
82 | visrX
83 |
84 | Expect:
85 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
86 |
87 | ###########################################################
88 |
--------------------------------------------------------------------------------
/tests/select_partial.vader:
--------------------------------------------------------------------------------
1 | Execute (Clean up test environment):
2 | call textobj#sentence#init()
3 |
4 | ###########################################################
5 |
6 | Given:
7 | Here comes the end of file:
8 |
9 | Do (select incomplete sentence ending in colon at end of buffer):
10 | visU
11 |
12 | Expect:
13 | HERE COMES THE END OF FILE:
14 |
15 | ###########################################################
16 |
17 | Given:
18 | Here comes the end of file-
19 |
20 | Do (select incomplete sentence ending in dash at end of buffer):
21 | visU
22 |
23 | Expect:
24 | HERE COMES THE END OF FILE-
25 |
26 | ###########################################################
27 |
28 | Given:
29 | Here comes the end of file;
30 |
31 | Do (select incomplete sentence ending in semi-colon at end of buffer):
32 | visU
33 |
34 | Expect:
35 | HERE COMES THE END OF FILE;
36 |
37 | ###########################################################
38 |
39 | Given:
40 | Here comes the end of file
41 |
42 | Do (select incomplete sentence at end of buffer):
43 | visU
44 |
45 | Expect:
46 | HERE COMES THE END OF FILE
47 |
48 | Given:
49 | of this software.
50 |
51 | Do (partial at beginning):
52 | visU
53 |
54 | Expect:
55 | OF THIS SOFTWARE.
56 |
57 | ###########################################################
58 |
59 | Given:
60 | of this software.
61 |
62 | Do (tab partial at beginning):
63 | visU
64 |
65 | Expect:
66 | OF THIS SOFTWARE.
67 |
68 | ###########################################################
69 |
70 | Given:
71 | Frank:
72 | - Crow
73 | - Servo
74 | - Gypsy
75 |
76 | TV's Frank shouts Not the children. Aw-haw-haw.
77 |
78 | Do (select isolated line ending with colon):
79 | visU
80 |
81 | Expect:
82 | FRANK:
83 | - CROW
84 | - SERVO
85 | - GYPSY
86 |
87 | TV's Frank shouts Not the children. Aw-haw-haw.
88 |
89 | ###########################################################
90 |
91 |
--------------------------------------------------------------------------------
/tests/select_quoted.vader:
--------------------------------------------------------------------------------
1 | Execute (Clean up test environment):
2 | call textobj#sentence#init()
3 |
4 | ###########################################################
5 |
6 | Given:
7 | TV's Frank [shouts] "Not the children, Aw-haw-haw."
8 |
9 | Do (select sentence with double straight trailing quotes):
10 | visAX
11 |
12 | Expect:
13 | TV's Frank [shouts] "Not the children, Aw-haw-haw."X
14 |
15 | ###########################################################
16 |
17 | Given:
18 | TV's Frank [shouts] 'Not the children, Aw-haw-haw.'
19 |
20 | Do (select sentence with single straight trailing quotes):
21 | visAX
22 |
23 | Expect:
24 | TV's Frank [shouts] 'Not the children, Aw-haw-haw.'X
25 |
26 | ###########################################################
27 |
28 | Given:
29 | TV's Frank [shouts] “Not the children, Aw-haw-haw.”
30 |
31 | Do (select sentence with curly trailing quotes):
32 | visAX
33 |
34 | Expect:
35 | TV's Frank [shouts] “Not the children, Aw-haw-haw.”X
36 |
37 | ###########################################################
38 |
39 | Given:
40 | Scene. "Not the children, Aw-haw-haw," shouted TV's Frank.
41 |
42 | Do (select sentence with double straight leading quote):
43 | /Not\vis\`vis\`vis\`vis\``>aX
89 |
90 | Expect:
91 | I said
92 | “No.X THANK YOU.”
93 |
94 | ###########################################################
95 |
96 | Given:
97 | “I said”
98 | No. THANK YOU.
99 |
100 | Do (two sentences within curly quotes, first):
101 | vis\`>aX
102 |
103 | Expect:
104 | “I said”
105 | No.X THANK YOU.
106 |
107 | ###########################################################
108 |
109 | Given:
110 | Of this software and associated documentation files (the "Software"), to deal
111 | in the Software without restriction, including without limitation the rights.
112 |
113 | Do (select sentence with earlier double straight quotes):
114 | jvisU
115 |
116 | Expect:
117 | OF THIS SOFTWARE AND ASSOCIATED DOCUMENTATION FILES (THE "SOFTWARE"), TO DEAL
118 | IN THE SOFTWARE WITHOUT RESTRICTION, INCLUDING WITHOUT LIMITATION THE RIGHTS.
119 |
120 | ###########################################################
121 |
122 | Given:
123 | Of this software and associated documentation files (the 'Software'), to deal
124 | in the Software without restriction, including without limitation the rights.
125 |
126 | Do (select sentence with earlier single straight quotes):
127 | jvisU
128 |
129 | Expect:
130 | OF THIS SOFTWARE AND ASSOCIATED DOCUMENTATION FILES (THE 'SOFTWARE'), TO DEAL
131 | IN THE SOFTWARE WITHOUT RESTRICTION, INCLUDING WITHOUT LIMITATION THE RIGHTS.
132 |
133 | ###########################################################
134 |
135 | Given:
136 | Of this software and associated documentation files (the “Software”), to deal
137 | in the Software without restriction, including without limitation the rights.
138 |
139 | Do (select sentence with earlier double curly quotes):
140 | jvisU
141 |
142 | Expect:
143 | OF THIS SOFTWARE AND ASSOCIATED DOCUMENTATION FILES (THE “SOFTWARE”), TO DEAL
144 | IN THE SOFTWARE WITHOUT RESTRICTION, INCLUDING WITHOUT LIMITATION THE RIGHTS.
145 |
146 | ###########################################################
147 |
148 | Given:
149 | Of this software and associated documentation files (the ‘Software’), to deal
150 | in the Software without restriction, including without limitation the rights.
151 |
152 | Do (select sentence with earlier single curly quotes):
153 | jvisU
154 |
155 | Expect:
156 | OF THIS SOFTWARE AND ASSOCIATED DOCUMENTATION FILES (THE ‘SOFTWARE’), TO DEAL
157 | IN THE SOFTWARE WITHOUT RESTRICTION, INCLUDING WITHOUT LIMITATION THE RIGHTS.
158 |
159 | ###########################################################
160 |
161 | Given:
162 | G
163 | “F.”
164 |
165 | Do (Selected typographic double quoted at end of sentence):
166 | jlllvisu
167 |
168 | Expect:
169 | g
170 | “f.”
171 |
172 | ###########################################################
173 |
174 | Given:
175 | G
176 | ‘H.’
177 |
178 | Do (Selected typographic single quoted at end of sentence):
179 | jlllvisu
180 |
181 | Expect:
182 | g
183 | ‘h.’
184 |
185 | ###########################################################
186 |
187 | Given:
188 | Said. ‘TV’s Frank [shouts] “Not the children, Aw-haw-haw.”’
189 |
190 | Do (select sentence with compound curly quotes):
191 | /TV\visU
192 |
193 | Expect:
194 | Said. ‘TV’S FRANK [SHOUTS] “NOT THE CHILDREN, AW-HAW-HAW.”’
195 |
196 | ###########################################################
197 |
198 | Given:
199 | Said. 'TV's Frank [shouts] "Not the children, Aw-haw-haw."'
200 |
201 | Do (select sentence with compound straight quotes):
202 | /TV\visU
203 |
204 | Expect:
205 | Said. 'TV'S FRANK [SHOUTS] "NOT THE CHILDREN, AW-HAW-HAW."'
206 |
207 | ###########################################################
208 |
--------------------------------------------------------------------------------