What is difference between w and W in escape mode of vim?
I am looking at the vim help quickref commands for moving cursor. Following lines confuse me because I find both of them working same. Could some one elaborate me difference with an example.
N w N words forward
N W N blank-separated WORDS forward
Same question is true for e and E as well.
vim
add a comment |
I am looking at the vim help quickref commands for moving cursor. Following lines confuse me because I find both of them working same. Could some one elaborate me difference with an example.
N w N words forward
N W N blank-separated WORDS forward
Same question is true for e and E as well.
vim
add a comment |
I am looking at the vim help quickref commands for moving cursor. Following lines confuse me because I find both of them working same. Could some one elaborate me difference with an example.
N w N words forward
N W N blank-separated WORDS forward
Same question is true for e and E as well.
vim
I am looking at the vim help quickref commands for moving cursor. Following lines confuse me because I find both of them working same. Could some one elaborate me difference with an example.
N w N words forward
N W N blank-separated WORDS forward
Same question is true for e and E as well.
vim
vim
edited Dec 24 '13 at 1:20
slm♦
252k70531685
252k70531685
asked Dec 24 '13 at 0:07
rahul.deshmukhpatilrahul.deshmukhpatil
19719
19719
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
According to this cheat sheet it would seem to come down to punctuation.
w jump by start of words (punctuation considered words)
W jump by words (spaces separate words)
e jump to end of words (punctuation considered words)
E jump to end of words (no punctuation)
Example
demo using w

demo using W

Notice in the first demo how when w is continuously hit that the cursor lands on the punctuation, while in the 2nd demo the punctuation is skipped. This is the difference between the lowercase commands and their upper case equivalents.
@slm: thanks a lot for such a great demo. with such demo no need to read ans as well
– rahul.deshmukhpatil
Dec 24 '13 at 13:19
add a comment |
It's actually fairly simple, w just skips to the next word, but any sort of punctuation or whitespace breaks up words. W is like the industrial-strength next-word command, words are only delimited by whitespace, be it tab, space or newline. w stops at the delimiting punctuation also, in case you want to deal with that.
I find the difference useful most often with hostnames:
birdman.cartoons.fictional.com # Fictional host
With w, you stop on each part of the hostname and the dots. W just skips the entire hostname and goes onto the #. These both also apply to d and c for deleting and changing words.
If positioned at the beginning of the above line, if you wanted to replace birdman.cartoons with something else, you would use 3cw to replace both of the first two parts and the dot in the middle. You couldn't do it with W without retyping the whole hostname.
add a comment |
It is a difference that is best understood by considering how punctuation can impact on Vim's concept of what delimits a word.
In the case of this example text:
This line is space separated with no commas
however, this line is—note—comma, separated,seew will happily skip to the first letter of each word in the first line, as there is only space to negotiate. It will fail badly on line 2 with the punctuation, alighting on the first letters of each word and the commas and en dashes. To move from word to word on line 2, you would need to use Shiftw1.
1. Even then, Vim sees "is–note–comma" as a single word.
add a comment |
The difference can be found within the vim's internal help pages.
Lets's first get a description of w and W with :help w or :help W:
- w [count] words forward. |exclusive| motion.
- W [count] WORDS forward. |exclusive| motion.
Now we want to know what are the definitions of word and WORD. Lookup the manual again with :help word and :help WORD, we find them.
- A word consists of
a sequence of letters, digits and underscores, ora(spaces,
sequence of other non-blank characters, separated with white space
tabs, ). This can be changed with the 'iskeyword' option. An empty line
is also considered to be a word. - A WORD consists of
a sequence of non-blank characters, separated with white. An empty line is also considered to be a WORD.
space
New contributor
user9154844 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f106425%2fwhat-is-difference-between-w-and-w-in-escape-mode-of-vim%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
According to this cheat sheet it would seem to come down to punctuation.
w jump by start of words (punctuation considered words)
W jump by words (spaces separate words)
e jump to end of words (punctuation considered words)
E jump to end of words (no punctuation)
Example
demo using w

demo using W

Notice in the first demo how when w is continuously hit that the cursor lands on the punctuation, while in the 2nd demo the punctuation is skipped. This is the difference between the lowercase commands and their upper case equivalents.
@slm: thanks a lot for such a great demo. with such demo no need to read ans as well
– rahul.deshmukhpatil
Dec 24 '13 at 13:19
add a comment |
According to this cheat sheet it would seem to come down to punctuation.
w jump by start of words (punctuation considered words)
W jump by words (spaces separate words)
e jump to end of words (punctuation considered words)
E jump to end of words (no punctuation)
Example
demo using w

demo using W

Notice in the first demo how when w is continuously hit that the cursor lands on the punctuation, while in the 2nd demo the punctuation is skipped. This is the difference between the lowercase commands and their upper case equivalents.
@slm: thanks a lot for such a great demo. with such demo no need to read ans as well
– rahul.deshmukhpatil
Dec 24 '13 at 13:19
add a comment |
According to this cheat sheet it would seem to come down to punctuation.
w jump by start of words (punctuation considered words)
W jump by words (spaces separate words)
e jump to end of words (punctuation considered words)
E jump to end of words (no punctuation)
Example
demo using w

demo using W

Notice in the first demo how when w is continuously hit that the cursor lands on the punctuation, while in the 2nd demo the punctuation is skipped. This is the difference between the lowercase commands and their upper case equivalents.
According to this cheat sheet it would seem to come down to punctuation.
w jump by start of words (punctuation considered words)
W jump by words (spaces separate words)
e jump to end of words (punctuation considered words)
E jump to end of words (no punctuation)
Example
demo using w

demo using W

Notice in the first demo how when w is continuously hit that the cursor lands on the punctuation, while in the 2nd demo the punctuation is skipped. This is the difference between the lowercase commands and their upper case equivalents.
edited Dec 24 '13 at 3:39
answered Dec 24 '13 at 0:30
slm♦slm
252k70531685
252k70531685
@slm: thanks a lot for such a great demo. with such demo no need to read ans as well
– rahul.deshmukhpatil
Dec 24 '13 at 13:19
add a comment |
@slm: thanks a lot for such a great demo. with such demo no need to read ans as well
– rahul.deshmukhpatil
Dec 24 '13 at 13:19
@slm: thanks a lot for such a great demo. with such demo no need to read ans as well
– rahul.deshmukhpatil
Dec 24 '13 at 13:19
@slm: thanks a lot for such a great demo. with such demo no need to read ans as well
– rahul.deshmukhpatil
Dec 24 '13 at 13:19
add a comment |
It's actually fairly simple, w just skips to the next word, but any sort of punctuation or whitespace breaks up words. W is like the industrial-strength next-word command, words are only delimited by whitespace, be it tab, space or newline. w stops at the delimiting punctuation also, in case you want to deal with that.
I find the difference useful most often with hostnames:
birdman.cartoons.fictional.com # Fictional host
With w, you stop on each part of the hostname and the dots. W just skips the entire hostname and goes onto the #. These both also apply to d and c for deleting and changing words.
If positioned at the beginning of the above line, if you wanted to replace birdman.cartoons with something else, you would use 3cw to replace both of the first two parts and the dot in the middle. You couldn't do it with W without retyping the whole hostname.
add a comment |
It's actually fairly simple, w just skips to the next word, but any sort of punctuation or whitespace breaks up words. W is like the industrial-strength next-word command, words are only delimited by whitespace, be it tab, space or newline. w stops at the delimiting punctuation also, in case you want to deal with that.
I find the difference useful most often with hostnames:
birdman.cartoons.fictional.com # Fictional host
With w, you stop on each part of the hostname and the dots. W just skips the entire hostname and goes onto the #. These both also apply to d and c for deleting and changing words.
If positioned at the beginning of the above line, if you wanted to replace birdman.cartoons with something else, you would use 3cw to replace both of the first two parts and the dot in the middle. You couldn't do it with W without retyping the whole hostname.
add a comment |
It's actually fairly simple, w just skips to the next word, but any sort of punctuation or whitespace breaks up words. W is like the industrial-strength next-word command, words are only delimited by whitespace, be it tab, space or newline. w stops at the delimiting punctuation also, in case you want to deal with that.
I find the difference useful most often with hostnames:
birdman.cartoons.fictional.com # Fictional host
With w, you stop on each part of the hostname and the dots. W just skips the entire hostname and goes onto the #. These both also apply to d and c for deleting and changing words.
If positioned at the beginning of the above line, if you wanted to replace birdman.cartoons with something else, you would use 3cw to replace both of the first two parts and the dot in the middle. You couldn't do it with W without retyping the whole hostname.
It's actually fairly simple, w just skips to the next word, but any sort of punctuation or whitespace breaks up words. W is like the industrial-strength next-word command, words are only delimited by whitespace, be it tab, space or newline. w stops at the delimiting punctuation also, in case you want to deal with that.
I find the difference useful most often with hostnames:
birdman.cartoons.fictional.com # Fictional host
With w, you stop on each part of the hostname and the dots. W just skips the entire hostname and goes onto the #. These both also apply to d and c for deleting and changing words.
If positioned at the beginning of the above line, if you wanted to replace birdman.cartoons with something else, you would use 3cw to replace both of the first two parts and the dot in the middle. You couldn't do it with W without retyping the whole hostname.
answered Dec 24 '13 at 3:34
kurtmkurtm
4,13511619
4,13511619
add a comment |
add a comment |
It is a difference that is best understood by considering how punctuation can impact on Vim's concept of what delimits a word.
In the case of this example text:
This line is space separated with no commas
however, this line is—note—comma, separated,seew will happily skip to the first letter of each word in the first line, as there is only space to negotiate. It will fail badly on line 2 with the punctuation, alighting on the first letters of each word and the commas and en dashes. To move from word to word on line 2, you would need to use Shiftw1.
1. Even then, Vim sees "is–note–comma" as a single word.
add a comment |
It is a difference that is best understood by considering how punctuation can impact on Vim's concept of what delimits a word.
In the case of this example text:
This line is space separated with no commas
however, this line is—note—comma, separated,seew will happily skip to the first letter of each word in the first line, as there is only space to negotiate. It will fail badly on line 2 with the punctuation, alighting on the first letters of each word and the commas and en dashes. To move from word to word on line 2, you would need to use Shiftw1.
1. Even then, Vim sees "is–note–comma" as a single word.
add a comment |
It is a difference that is best understood by considering how punctuation can impact on Vim's concept of what delimits a word.
In the case of this example text:
This line is space separated with no commas
however, this line is—note—comma, separated,seew will happily skip to the first letter of each word in the first line, as there is only space to negotiate. It will fail badly on line 2 with the punctuation, alighting on the first letters of each word and the commas and en dashes. To move from word to word on line 2, you would need to use Shiftw1.
1. Even then, Vim sees "is–note–comma" as a single word.
It is a difference that is best understood by considering how punctuation can impact on Vim's concept of what delimits a word.
In the case of this example text:
This line is space separated with no commas
however, this line is—note—comma, separated,seew will happily skip to the first letter of each word in the first line, as there is only space to negotiate. It will fail badly on line 2 with the punctuation, alighting on the first letters of each word and the commas and en dashes. To move from word to word on line 2, you would need to use Shiftw1.
1. Even then, Vim sees "is–note–comma" as a single word.
answered Dec 24 '13 at 0:50
jasonwryanjasonwryan
50.2k14134189
50.2k14134189
add a comment |
add a comment |
The difference can be found within the vim's internal help pages.
Lets's first get a description of w and W with :help w or :help W:
- w [count] words forward. |exclusive| motion.
- W [count] WORDS forward. |exclusive| motion.
Now we want to know what are the definitions of word and WORD. Lookup the manual again with :help word and :help WORD, we find them.
- A word consists of
a sequence of letters, digits and underscores, ora(spaces,
sequence of other non-blank characters, separated with white space
tabs, ). This can be changed with the 'iskeyword' option. An empty line
is also considered to be a word. - A WORD consists of
a sequence of non-blank characters, separated with white. An empty line is also considered to be a WORD.
space
New contributor
user9154844 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
The difference can be found within the vim's internal help pages.
Lets's first get a description of w and W with :help w or :help W:
- w [count] words forward. |exclusive| motion.
- W [count] WORDS forward. |exclusive| motion.
Now we want to know what are the definitions of word and WORD. Lookup the manual again with :help word and :help WORD, we find them.
- A word consists of
a sequence of letters, digits and underscores, ora(spaces,
sequence of other non-blank characters, separated with white space
tabs, ). This can be changed with the 'iskeyword' option. An empty line
is also considered to be a word. - A WORD consists of
a sequence of non-blank characters, separated with white. An empty line is also considered to be a WORD.
space
New contributor
user9154844 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
The difference can be found within the vim's internal help pages.
Lets's first get a description of w and W with :help w or :help W:
- w [count] words forward. |exclusive| motion.
- W [count] WORDS forward. |exclusive| motion.
Now we want to know what are the definitions of word and WORD. Lookup the manual again with :help word and :help WORD, we find them.
- A word consists of
a sequence of letters, digits and underscores, ora(spaces,
sequence of other non-blank characters, separated with white space
tabs, ). This can be changed with the 'iskeyword' option. An empty line
is also considered to be a word. - A WORD consists of
a sequence of non-blank characters, separated with white. An empty line is also considered to be a WORD.
space
New contributor
user9154844 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
The difference can be found within the vim's internal help pages.
Lets's first get a description of w and W with :help w or :help W:
- w [count] words forward. |exclusive| motion.
- W [count] WORDS forward. |exclusive| motion.
Now we want to know what are the definitions of word and WORD. Lookup the manual again with :help word and :help WORD, we find them.
- A word consists of
a sequence of letters, digits and underscores, ora(spaces,
sequence of other non-blank characters, separated with white space
tabs, ). This can be changed with the 'iskeyword' option. An empty line
is also considered to be a word. - A WORD consists of
a sequence of non-blank characters, separated with white. An empty line is also considered to be a WORD.
space
New contributor
user9154844 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user9154844 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 8 mins ago
user9154844user9154844
1
1
New contributor
user9154844 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user9154844 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
user9154844 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f106425%2fwhat-is-difference-between-w-and-w-in-escape-mode-of-vim%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown