89 Commits

Author SHA1 Message Date
machakann 7ebffd4555 Revert "Make magicchar-t more context-cognitive"
This reverts commit 7bdd7fc4b4.

This commit is somehow broken. Repoted at #149
2022-07-23 00:51:45 +09:00
machakann 7bdd7fc4b4 Make magicchar-t more context-cognitive
This commit make, for example, sr(tp<CR> works as follows.
(foo) -> <p>foo</p>
2022-03-12 22:48:34 +09:00
machakann 70022d9277 Implement g:sandwich#input_fallback option 2022-02-06 22:35:23 +09:00
machakann 39673fb3ce Elect textobjects by representative length
Textobj-auto has elected text by wrapped text excluding surroundings. However, this method works unintentionally, for example, reported at #127. This commit changes the election algorithm to use representative lengths; it is the length of wrapped text excluding surroundings if the cursor inside or including surroundings if the cursor is on either one of the surroundings.
2022-01-30 21:38:21 +09:00
machakann b0a4a10f15 Define keymappings explicitly in tests 2022-01-29 22:17:43 +09:00
machakann 95d41c9ab1 Revert "Change the rule to select by auto-textobject"
This reverts commit a68205cdc7.
It's not so easy to understand the rules to select buffer text.
2021-12-31 18:54:51 +09:00
machakann a68205cdc7 Change the rule to select by auto-textobject
It has been chosen only by the length of inner wrapped text.
Now a text under the cursor will be prioritized.
2021-12-26 02:14:59 +09:00
machakann ac3affcb8f Could not cancel action with Esc if input is not a character 2021-11-28 20:15:32 +09:00
machakann b00d98d35a Add test for surround-style keymappings 2021-10-23 23:37:43 +09:00
machakann 04f7755100 External textobject may cause unanticipated error
Reported in #114 and patched by @obcat
2021-08-29 23:26:07 +09:00
machakann f0bb324395 Fix wrong test condition for magic character "f"
#99
2020-07-28 00:29:02 +09:00
machakann ce24d28819 Fix tests 2020-07-27 00:34:56 +09:00
machakann 0f5278e58b Magic character "t" and "T" doesn't work well with :set selection=exclusive
Reported at #98
2020-07-26 22:31:14 +09:00
machakann 02e3b6d1ff Ignore arrow keys (and non-printable) inputs
Close #90
2020-02-14 00:19:21 +08:00
machakann d037c6ed13 Fix tests
The results for the tests depends on the version of Vim. Just skip.
2019-03-02 21:02:08 +08:00
Unknown d441cf5a45 Allow users to customize magicchar-f (#71)
Use `g:sandwich#magicchar#f#patterns` or `b:sandwich_magicchar_f_patterns`.
Each of those are a list of patterns dictionary like:
	let g:sandwich#magicchar#f#patterns = [
	\   {
	\     'header' : '\<\h\k*',
	\     'bra'    : '(',
	\     'ket'    : ')',
	\     'footer' : '',
	\   },
	\ ]
2019-02-02 16:20:56 +08:00
machakann 558b858706 Suppress autoformatting in a surrounding operation (#71) 2019-01-29 21:56:13 +08:00
machakann 5dd57dbf8a s:get_assigned_region() doesn't work well with cp932 (#66) 2018-05-29 17:55:04 +08:00
machakann 39a098f4dc Add an option to keep indent level anyway (#54) 2017-11-22 00:22:32 +08:00
machakann 80b15ded06 The calculation of indent level was wrong (#53) 2017-11-11 13:16:06 +08:00
machakann 5e3fc273a2 Fix test: Do not use runtime files. It may behave differently with versions. (#52) 2017-10-28 19:59:44 +08:00
machakann 15ff877b92 Autoindent breaks the operator-add (#52) 2017-10-28 16:01:17 +08:00
machakann 4b085c84f9 Update tests (#45) 2017-08-21 23:51:12 +08:00
machakann e1467e2e4d Fix a bug when canceled. 2017-03-18 16:04:44 +08:00
machakann d3076134b8 Support multiple operator modifications and custom attributes.
Issue #30
2016-10-31 00:14:23 +09:00
machakann 1fa19101f8 Delete surroundings selectively when 'synchro' option is on. (#21) 2016-10-11 00:47:43 +09:00
machakann 0cc8fde99a Add workaround to pass tests. 2016-09-22 12:34:19 +08:00
machakann 47e9432725 Fix a bug on linewise-add action.
For example, saiw<Enter> add empty lines incorrectly, because "\<Enter>" =~# '\n' is *not* true.
Pointed out in issue #20.
2016-09-15 19:11:25 +09:00
machakann 3101679854 Make the dot-repeat test more safer. 2016-08-17 14:02:16 +08:00
machakann 03308424cf Make 'listexpr' option valid also with textobj-sandwich. (#16) 2016-08-16 18:59:19 +08:00
machakann 92bf7c791b Fix a bug when a 'listexpr' buns are dot-repeated. 2016-08-15 20:08:17 +08:00
masaaki nakamura c038192bf7 Fix a bug on 'external' textobject handling. 2016-05-12 19:32:16 +08:00
machakann 82c06f0bd3 Revise notification and error messaging. 2016-04-10 18:55:17 +08:00
machakann dbeaae3339 Add a new local option "listexpr". (#16) 2016-04-10 18:55:08 +08:00
machakann f8b353b0ea Add 'default' to a local option 'cursor' and set it as default.
It is almost same as 'inner_head' but move cursor to the first non-space character if the cursor is on the head of line.
2016-04-05 15:48:16 +08:00
machakann 1de59a01ca Drop funcref support of buns.
It is nothing convenient. Make the source codes messing up.
2016-04-05 11:35:46 +08:00
machakann 3fff0f9103 Fix wrong test of 'quoteescape' option for textobjects. 2016-04-05 00:16:29 +08:00
machakann 2b5bb9c34d Disable several test.
Problem: 'cindent' behaves differently in old vim?
2016-04-03 16:27:43 +08:00
machakann 4fe1774807 Fix wrong command in tests for the delete operator. 2016-04-03 16:26:43 +08:00
machakann 10c8474656 Fix a bug on local option 'skip_space'. 2016-04-02 22:41:33 +08:00
machakann 9a5c5f1c8f Test more strictly. 2016-04-02 20:30:20 +08:00
machakann 2e3ce54c13 Define the behavior of replace operator with linewise == 2. 2016-03-28 00:58:41 +08:00
machakann 34e4ee4442 Change option handlings.
- Drop opt.integrate() and use opt.of() func to get an option value.
- Manage recipe local options for add and delete actions sepalately to avoid option conflict in replace operator.
2016-03-28 00:58:38 +08:00
machakann 47701a6766 Test dot-repeating more strictly. 2016-03-28 00:56:28 +08:00
machakann b861d0e689 Fix weird behaviors with autoindent. (Close #7)
Since these operators edit a text from tail to head to avoid shifting target region, autoindent features haven't worked well. This commit changes that let the operators edit from head to tail with computing shift, it makes more similar as user does and reasonable for autoindent functions.

At the same time, because the problem has been solved, default values of a local option 'autoindent' are set to -1 (as user is using).
2016-03-28 00:56:05 +08:00
machakann 81d07deef2 Change numbering for tests. 2016-03-15 22:43:05 +08:00
machakann 54763117ca Refactoring.
- Split a massive function to small functions.
- Do not freeze global options.
- Use empty() to check a returned value from getchar().
2016-03-15 13:31:22 +08:00
machakann 25d68c58e4 Revert dbe23a3843.
From the commit, the options of the deletion recipe has been always ignored, for example 'command', 'linewise'. For the problem tried to solve by the commit, I need more underlying solution.
2016-02-23 23:32:54 +08:00
machakann 9f7a9c3298 Fix a bug on 'skip_break' option.
If line-breaking is not included in the region, textobjects should not skip.
2015-10-25 14:40:34 +08:00
machakann b3e183d7f2 Visual mode selection area extending condition was wrong.
When two recipe like {'buns': [a,b]} and {'buns': [b,c]} exists, the selection a to b is unintentionally switched to b to c.
2015-10-25 11:25:50 +08:00