Comments (6)
You can always do something like:
xnoremap io iw
xnoremap ao aw
onoremap io iw
onoremap ao aw
and do cio
, where o
means original.
from vim-wordmotion.
Do you mean you want to use ciw
on [a_really_huge_variable_using_the_normal_w_vim_motion]
?
Why not ci[
?
I'm not sure this is necessary.
- If you use this plugin's word motions more often, then you use it with the default mappings and
nnoremap
something else to the regular word motions. - On the other hand, if you use regular word motions more often, then you can use this plugin's word motions with a prefix or something.
You could also consider applying a custom mapping only on the iw
and aw
commands, so the regular vim word objects are available, but you still use this plugin's word motions by default.
i(
, i[
, i{
, i"
, iW
(WORD
not word
), etc, seems to cover most cases where you want larger text objects than provided by this plugin.
from vim-wordmotion.
I'm leaving this open.I will consider it if you can provide reasonable examples where the suggestions I gave above don't work.
from vim-wordmotion.
You are right. The example was poor because you could circumvent the problem using ci[
or similar bindings. But having a convenient surrounding arround the big word will not always be the case.
let us consider this snippet for a moment:
if [[ -n ${GIT_USER_NAME+x} ]]; then
git config --global user.name $GIT_USER_NAME
export GIT_USER_NAME
fi
let us suppose that user wants to refactor GIT_USER_NAME
. With vim-wordmotion
defaults there is no easy way to do that. Of course that :norm! ciw
would function here. But dropping a whole ex-command to achieve the solution does feel clunky. You ct+
if you were on the beggining of the word. But what if the cursor is above the N
of git user name? bbct+
? clunky.
For completeness sake, I'll drop yet another example:
local plug_dir=$(realpath -m $really_poorly_named_user_directory)
if [[! -d $sytem_wide_plug_horrendous_named_dir]]; then
echo -e "installing ${Yellow}vim${Rst} plugins..."
vim +PlugInstall +qall
fi
Now imagine you want to rename those awful named variables. I think now I managed to get the picture across. That's the nagging issue.
from vim-wordmotion.
This works too:
let g:wordmotion_mappings = { 'iw' : 'ii', 'aw' : '' }
and continue to use ciw
for regular words, but use cii
for "inner" words.
from vim-wordmotion.
hum, yeah. The cio
bind solves the problem nicely. Thanks for pointing out that free bind, by the way. Finding free bindings like that in vim is an art form.
from vim-wordmotion.
Related Issues (20)
- Request: Make hex color ocdes easier to move around (like `#0f0f0f`)
- Unexpected behaviour for dw on files with a shebang and no extension HOT 8
- Error detected while processing function wordmotion#init HOT 4
- cw and dw revert to default vim behavior HOT 3
- Leading underscore as non-whitespace? HOT 4
- Meta word motions HOT 31
- cw with count not work correctly HOT 1
- #define is considered two words HOT 2
- Warn users if they copied the example configurations from the README HOT 3
- Broken lsp rename HOT 3
- Wrong behavior with folds HOT 1
- cw HOT 5
- around word does not select prior separator characters.
- use vim default word definition for `WORD` HOT 4
- wordmotion_prefix not working when using Lazy plugin manager HOT 2
- Hex color codes not recognized as single words HOT 2
- Make w recognize - and CamelCase and W do what w used to do? HOT 4
- Absolutely perfect, thank you HOT 1
- Change or extend pattern to handle text end with 2 or more punctuations? HOT 2
- Last letter left for ciw command
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-wordmotion.