terryma / vim-expand-region Goto Github PK
View Code? Open in Web Editor NEWVim plugin that allows you to visually select increasingly larger regions of text using the same key combination.
License: MIT License
Vim plugin that allows you to visually select increasingly larger regions of text using the same key combination.
License: MIT License
Thanks for the great plugin!
It would be really cool if this worked with HTML/XML tags.
For example, if I have
<div id="foo"><span class=".bar">some content</span></div>
and the cursor is in "some content", it would cool if
pressing + selected the content
and pressing + again selected <span class=".bar">some content</span>
and pressing + again selected <div id="foo"><span class=".bar">some content</span></div>.
Have you seen anything that does this?
instead of expanding / shrinking the selection, i get this inserted:
vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)
Hi,
I've been using this plugin for a while, and I like it very much.
When starting selection inside quoted text, I noticed that at the second selection action, the plugin selects outside of the quotes (space delimited text object), rather than the whole content, if the part selected at first is a word at the beginning or at the end of the quoted text.
Example:
if (method() == "some example text")
If I stand on the word text and select it, the next selection will select text"). The same happens for standing on some and selecting twice: "some will be selected.
The whole content of the quotes (some example text), without them, will be selected only on the third selection action.
Is this a bug, or the designed behavior?
For me it is more intuitive to have the whole content selected right after selecting either of the words in the quotes.
Hi,
Thanks for creating this tool. I've been using it for a long time.
I'm migrating over to neovim, and noticed that it doesn't work in my setup. Below are the relevant lines in my config:
call plug#begin(stdpath('config') . '/plugged')
Plug 'terryma/vim-expand-region'
call plug#end()
nnoremap <space> <Plug>(expand_region_expand)
I'm wondering whether it is known to be incompatible with neovim, or something is wrong with my setup?
This is probably an issue with my configuration but I'm stumped.
I have installed the plugin via Vundle and remapped the expand and shrink functions using vmap
vmap v (expand_region_expand)
vmap (expand_region_shrink)
But now I get :call <SNR>7_NextTextObject('i')
every time I try to expand the selected region. What am I doing wrong?
Do I miss something ?
Thanks for this great plugin that I've just discovered.
Do you support ruby block objects provided by nelstrom/vim-textobj-rubyblock?
I tried using the following configuration:
call expand_region#custom_text_objects('ruby', {
\ 'ir' :0,
\ 'ar' :0,
\ 'im' :0,
\ 'am' :0,
\ })
But it is not working.
Hello there,
Can someone help me & possibly add this to the documentation - what should be the proper settings for visual expansion in Python?
Right now does not respect indentation and the visual expanding is not always correct.
So today I updated all plugins.
When trying to expand region I am getting:
Error detected while processing function expand_region#next[1]..<SNR>57_expand_region[20]..<SNR>57_select_region:
line 2:
E119: Not enough arguments for function: targets#e
I use:
NVIM v0.2.3-dev
Build type: RelWithDebInfo
Lua 5.1
Compilation: /usr/bin/x86_64-linux-gnu-gcc -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/neovim-BZSxou/neovim-0.2.2ubuntu2+git201804092017-84bac9f-f2f288d/build/config -I/build/neovim-BZSxou/neovim-0.2.2ubuntu2+git201804092017-84bac9f-f2f288d/src -I/build/neovim-BZSxou/neovim-0.2.2ubuntu2+git201804092017-84bac9f-f2f288d/.deps/usr/include -I/usr/include -I/build/neovim-BZSxou/neovim-0.2.2ubuntu2+git201804092017-84bac9f-f2f288d/build/src/nvim/auto -I/build/neovim-BZSxou/neovim-0.2.2ubuntu2+git201804092017-84bac9f-f2f288d/build/include
Compiled by buildd@lcy01-amd64-019
Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Edit:
One of following fixed the issue:
pip3 install --upgrade neovim
gem install neovim
I saw a report of something similar (#3) but I'll open this separately anyway, since the other one is closed.
Here are some issues I'm seeing, using this code as an example:
call winrestview(s:candidates[s:cur_index].prev_winview)
winrestview
, viw+
does not grow the selection beyond the initial word. If, however, the cursor is after the first character, viw+
seems to grow the selection. I can only reproduce this ~90% of the time, so it seems that there's some sort of a race going on.winrestview(
, hitting +
actually shrinks the selection.Often users want more fine control on text, currently it's not the case for vim-expand-region.
An example is:
/a/b/c-d/g-f
we often want to be able to expand to c-d
or g-f
Thanks for the great plugin — everything's working well so far.
One question — what do the 0
& 1
values mean in the mappings? Did I just miss something in the docs?
Right now, there are times when pressing +
will shrink the left side of the selection to accomodate a larger selection on the right side:
[submodule "vim/bundle/vim-expand-region"]
path = vim/bundle/vim-expand-region
url = https://github.com/terryma/vim-expand-region.git
If you place the cursor on the second bundle
and continue pressing +
, the selection will large to expand on the left, then suddenly, the selection on the left will shrink in order to accomodate a larger selection on the right.
Avoid that the visual expansion mapping <Plug>(expand_region_expand)
adds a mark to the jump list.
I noticed that some text objects can select unexpected regions. For example, put the following into a file:
index(list, '(')
empty(taginfo)
then put the cursor on top of empty
and press vib
. The parentheses on the first line should now be selected. This is obviously not useful for our case. So it would make sense to check whether the region candidates actually include the original cursor position before trying to use them.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.