-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for other delimiter? #7
Comments
This is a great suggestion. The delimiter variables should probably be globals (or some other variable should exist), which would allow adding new ones. Suggestions welcome, otherwise I'll try to think of a nice interface to expose this as. |
That sounds perfectly reasonable. A global flag with "_" as the only default, and then you could add to them in the vimrc. This also allows for people to turn off _ as a delimiter if they wanted to. |
👍 |
I think I'd like a method to do this, since it involves touching two parts – a left delimiter and a right delimiter, and theoretically those could be different. E.g. I'd do this now, I just forget when for left delimiter for e.g. Patches welcome if anyone has some clarity. |
Is there an easy way to add support for Update: This patch adds support for diff --git i/autoload/textobj/variable_segment.vim w/autoload/textobj/variable_segment.vim
index 5c2995f..ff0ea00 100644
--- i/autoload/textobj/variable_segment.vim
+++ w/autoload/textobj/variable_segment.vim
@@ -1,5 +1,5 @@
function! s:select(object_type, right_boundary)
- let left_boundaries = ['_\+\i', '\<', '\l\u', '\u\u\ze\l', '\a\d', '\d\a']
+ let left_boundaries = ['-\+\i', '_\+\i', '\<', '\l\u', '\u\u\ze\l', '\a\d', '\d\a']
call search(join(left_boundaries, '\|'), 'bce')
let start_position = getpos('.')
@@ -19,7 +19,7 @@ function! s:select(object_type, right_boundary)
endfunction
function! s:select_a()
- let right_boundaries = ['_', '\l\u', '\u\u\l', '\a\d', '\d\a', '\i\>']
+ let right_boundaries = ['-', '_', '\l\u', '\u\u\l', '\a\d', '\d\a', '\i\>']
let right_boundary = join(right_boundaries, '\|')
let [type, start_position, end_position] = s:select('a', right_boundary)
let [_, start_line, start_column, _] = start_position
@@ -46,7 +46,7 @@ function! s:select_a()
endfunction
function! s:select_i()
- let right_boundaries = ['\i_', '\l\u', '\u\u\l', '\a\d', '\d\a', '\i\>']
+ let right_boundaries = ['\i-', '\i_', '\l\u', '\u\u\l', '\a\d', '\d\a', '\i\>']
return s:select('i', join(right_boundaries, '\|'))
endfunction |
Maybe this is too much to do, but for instance, in R the style guide I follow dictates that multi word variables be written as
multi.word.var
I would love to be able to add '.' to the list of delimiters so that this works. Currently doing dav when the cursor is on m' just deletes the whole word. I'd like it to leave word.var instead
The text was updated successfully, but these errors were encountered: