Automatically go to next line in vim
One frustrating behavior in vim is that when i move my cursor right or left (respectively "l" or "h)" and i am at the end or the beginning of the line, my cursor doesn't move to first column of next line or last column of previous line.
Is there a way to change this behavior ?
vim
add a comment |
One frustrating behavior in vim is that when i move my cursor right or left (respectively "l" or "h)" and i am at the end or the beginning of the line, my cursor doesn't move to first column of next line or last column of previous line.
Is there a way to change this behavior ?
vim
1
This isn't exactly a programming question but...
– Matti Virkkunen
Apr 4 '10 at 9:33
...but it is a question regarding "software tools commonly used by programmers". :) (admittedly it's not a "problem that is unique to software development").
– lindhe
Mar 9 '15 at 9:32
1
set nocompatible
had disabled that feature in myvim
configuration
– Paschalis
Jul 11 '15 at 16:56
add a comment |
One frustrating behavior in vim is that when i move my cursor right or left (respectively "l" or "h)" and i am at the end or the beginning of the line, my cursor doesn't move to first column of next line or last column of previous line.
Is there a way to change this behavior ?
vim
One frustrating behavior in vim is that when i move my cursor right or left (respectively "l" or "h)" and i am at the end or the beginning of the line, my cursor doesn't move to first column of next line or last column of previous line.
Is there a way to change this behavior ?
vim
vim
asked Apr 4 '10 at 9:31
jneyjney
87721119
87721119
1
This isn't exactly a programming question but...
– Matti Virkkunen
Apr 4 '10 at 9:33
...but it is a question regarding "software tools commonly used by programmers". :) (admittedly it's not a "problem that is unique to software development").
– lindhe
Mar 9 '15 at 9:32
1
set nocompatible
had disabled that feature in myvim
configuration
– Paschalis
Jul 11 '15 at 16:56
add a comment |
1
This isn't exactly a programming question but...
– Matti Virkkunen
Apr 4 '10 at 9:33
...but it is a question regarding "software tools commonly used by programmers". :) (admittedly it's not a "problem that is unique to software development").
– lindhe
Mar 9 '15 at 9:32
1
set nocompatible
had disabled that feature in myvim
configuration
– Paschalis
Jul 11 '15 at 16:56
1
1
This isn't exactly a programming question but...
– Matti Virkkunen
Apr 4 '10 at 9:33
This isn't exactly a programming question but...
– Matti Virkkunen
Apr 4 '10 at 9:33
...but it is a question regarding "software tools commonly used by programmers". :) (admittedly it's not a "problem that is unique to software development").
– lindhe
Mar 9 '15 at 9:32
...but it is a question regarding "software tools commonly used by programmers". :) (admittedly it's not a "problem that is unique to software development").
– lindhe
Mar 9 '15 at 9:32
1
1
set nocompatible
had disabled that feature in my vim
configuration– Paschalis
Jul 11 '15 at 16:56
set nocompatible
had disabled that feature in my vim
configuration– Paschalis
Jul 11 '15 at 16:56
add a comment |
2 Answers
2
active
oldest
votes
You can use the whichwrap
setting to make h
and l
wrap around the start and end of individual lines:
set whichwrap+=h,l
However, Vim's documentation recommends against this, probably because it could have unexpected side effects (like breaking plugins, or changing how common key mappings work).
As an alternative, you can do what what Matti Virkkunen recommended:
set whichwrap+=<,>,[,]
This leaves h
and l
with their default behavior, but allows the left and right arrow keys to wrap around lines. (This is what I do, and it works well.)
You might also want to take a look at the backspace
setting, to control how Backspace, Delete, Control+W, and Control+U work in Insert mode. I set mine like this:
set backspace=indent,eol,start
That allows me to backspace over pretty much everything.
For more info, see these topics in the Vim help:
:help 'whichwrap
:help 'backspace
Can you explain what these do? (specifically, what do<
,>
,[
, and]
mean?)
– Nic Hartley
Aug 20 '16 at 19:54
Here is a browser-friendly version of:help 'whichwrap
: vimhelp.appspot.com/options.txt.html#%27whichwrap%27
– Adam Monsen
Jul 28 '17 at 14:27
add a comment |
Put the following into your .vimrc:
set whichwrap+=<,>,[,]
Can you explain what this does?
– Nic Hartley
Aug 20 '16 at 19:55
@QPaysTaxes: The whichwrap setting specifies which keys will wrap to the next/previous line when pressed, and the character afterwards refer to the cursor keys in normal mode and insert mode respectively. You can add e.g.h,l
to also have the vim movement keys wrap, if you wish.
– Matti Virkkunen
Aug 22 '16 at 11:25
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fstackoverflow.com%2fquestions%2f2574027%2fautomatically-go-to-next-line-in-vim%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use the whichwrap
setting to make h
and l
wrap around the start and end of individual lines:
set whichwrap+=h,l
However, Vim's documentation recommends against this, probably because it could have unexpected side effects (like breaking plugins, or changing how common key mappings work).
As an alternative, you can do what what Matti Virkkunen recommended:
set whichwrap+=<,>,[,]
This leaves h
and l
with their default behavior, but allows the left and right arrow keys to wrap around lines. (This is what I do, and it works well.)
You might also want to take a look at the backspace
setting, to control how Backspace, Delete, Control+W, and Control+U work in Insert mode. I set mine like this:
set backspace=indent,eol,start
That allows me to backspace over pretty much everything.
For more info, see these topics in the Vim help:
:help 'whichwrap
:help 'backspace
Can you explain what these do? (specifically, what do<
,>
,[
, and]
mean?)
– Nic Hartley
Aug 20 '16 at 19:54
Here is a browser-friendly version of:help 'whichwrap
: vimhelp.appspot.com/options.txt.html#%27whichwrap%27
– Adam Monsen
Jul 28 '17 at 14:27
add a comment |
You can use the whichwrap
setting to make h
and l
wrap around the start and end of individual lines:
set whichwrap+=h,l
However, Vim's documentation recommends against this, probably because it could have unexpected side effects (like breaking plugins, or changing how common key mappings work).
As an alternative, you can do what what Matti Virkkunen recommended:
set whichwrap+=<,>,[,]
This leaves h
and l
with their default behavior, but allows the left and right arrow keys to wrap around lines. (This is what I do, and it works well.)
You might also want to take a look at the backspace
setting, to control how Backspace, Delete, Control+W, and Control+U work in Insert mode. I set mine like this:
set backspace=indent,eol,start
That allows me to backspace over pretty much everything.
For more info, see these topics in the Vim help:
:help 'whichwrap
:help 'backspace
Can you explain what these do? (specifically, what do<
,>
,[
, and]
mean?)
– Nic Hartley
Aug 20 '16 at 19:54
Here is a browser-friendly version of:help 'whichwrap
: vimhelp.appspot.com/options.txt.html#%27whichwrap%27
– Adam Monsen
Jul 28 '17 at 14:27
add a comment |
You can use the whichwrap
setting to make h
and l
wrap around the start and end of individual lines:
set whichwrap+=h,l
However, Vim's documentation recommends against this, probably because it could have unexpected side effects (like breaking plugins, or changing how common key mappings work).
As an alternative, you can do what what Matti Virkkunen recommended:
set whichwrap+=<,>,[,]
This leaves h
and l
with their default behavior, but allows the left and right arrow keys to wrap around lines. (This is what I do, and it works well.)
You might also want to take a look at the backspace
setting, to control how Backspace, Delete, Control+W, and Control+U work in Insert mode. I set mine like this:
set backspace=indent,eol,start
That allows me to backspace over pretty much everything.
For more info, see these topics in the Vim help:
:help 'whichwrap
:help 'backspace
You can use the whichwrap
setting to make h
and l
wrap around the start and end of individual lines:
set whichwrap+=h,l
However, Vim's documentation recommends against this, probably because it could have unexpected side effects (like breaking plugins, or changing how common key mappings work).
As an alternative, you can do what what Matti Virkkunen recommended:
set whichwrap+=<,>,[,]
This leaves h
and l
with their default behavior, but allows the left and right arrow keys to wrap around lines. (This is what I do, and it works well.)
You might also want to take a look at the backspace
setting, to control how Backspace, Delete, Control+W, and Control+U work in Insert mode. I set mine like this:
set backspace=indent,eol,start
That allows me to backspace over pretty much everything.
For more info, see these topics in the Vim help:
:help 'whichwrap
:help 'backspace
answered Apr 4 '10 at 11:00
Bill OdomBill Odom
3,6651919
3,6651919
Can you explain what these do? (specifically, what do<
,>
,[
, and]
mean?)
– Nic Hartley
Aug 20 '16 at 19:54
Here is a browser-friendly version of:help 'whichwrap
: vimhelp.appspot.com/options.txt.html#%27whichwrap%27
– Adam Monsen
Jul 28 '17 at 14:27
add a comment |
Can you explain what these do? (specifically, what do<
,>
,[
, and]
mean?)
– Nic Hartley
Aug 20 '16 at 19:54
Here is a browser-friendly version of:help 'whichwrap
: vimhelp.appspot.com/options.txt.html#%27whichwrap%27
– Adam Monsen
Jul 28 '17 at 14:27
Can you explain what these do? (specifically, what do
<
, >
, [
, and ]
mean?)– Nic Hartley
Aug 20 '16 at 19:54
Can you explain what these do? (specifically, what do
<
, >
, [
, and ]
mean?)– Nic Hartley
Aug 20 '16 at 19:54
Here is a browser-friendly version of
:help 'whichwrap
: vimhelp.appspot.com/options.txt.html#%27whichwrap%27– Adam Monsen
Jul 28 '17 at 14:27
Here is a browser-friendly version of
:help 'whichwrap
: vimhelp.appspot.com/options.txt.html#%27whichwrap%27– Adam Monsen
Jul 28 '17 at 14:27
add a comment |
Put the following into your .vimrc:
set whichwrap+=<,>,[,]
Can you explain what this does?
– Nic Hartley
Aug 20 '16 at 19:55
@QPaysTaxes: The whichwrap setting specifies which keys will wrap to the next/previous line when pressed, and the character afterwards refer to the cursor keys in normal mode and insert mode respectively. You can add e.g.h,l
to also have the vim movement keys wrap, if you wish.
– Matti Virkkunen
Aug 22 '16 at 11:25
add a comment |
Put the following into your .vimrc:
set whichwrap+=<,>,[,]
Can you explain what this does?
– Nic Hartley
Aug 20 '16 at 19:55
@QPaysTaxes: The whichwrap setting specifies which keys will wrap to the next/previous line when pressed, and the character afterwards refer to the cursor keys in normal mode and insert mode respectively. You can add e.g.h,l
to also have the vim movement keys wrap, if you wish.
– Matti Virkkunen
Aug 22 '16 at 11:25
add a comment |
Put the following into your .vimrc:
set whichwrap+=<,>,[,]
Put the following into your .vimrc:
set whichwrap+=<,>,[,]
answered Apr 4 '10 at 9:33
Matti VirkkunenMatti Virkkunen
52.6k5100138
52.6k5100138
Can you explain what this does?
– Nic Hartley
Aug 20 '16 at 19:55
@QPaysTaxes: The whichwrap setting specifies which keys will wrap to the next/previous line when pressed, and the character afterwards refer to the cursor keys in normal mode and insert mode respectively. You can add e.g.h,l
to also have the vim movement keys wrap, if you wish.
– Matti Virkkunen
Aug 22 '16 at 11:25
add a comment |
Can you explain what this does?
– Nic Hartley
Aug 20 '16 at 19:55
@QPaysTaxes: The whichwrap setting specifies which keys will wrap to the next/previous line when pressed, and the character afterwards refer to the cursor keys in normal mode and insert mode respectively. You can add e.g.h,l
to also have the vim movement keys wrap, if you wish.
– Matti Virkkunen
Aug 22 '16 at 11:25
Can you explain what this does?
– Nic Hartley
Aug 20 '16 at 19:55
Can you explain what this does?
– Nic Hartley
Aug 20 '16 at 19:55
@QPaysTaxes: The whichwrap setting specifies which keys will wrap to the next/previous line when pressed, and the character afterwards refer to the cursor keys in normal mode and insert mode respectively. You can add e.g.
h,l
to also have the vim movement keys wrap, if you wish.– Matti Virkkunen
Aug 22 '16 at 11:25
@QPaysTaxes: The whichwrap setting specifies which keys will wrap to the next/previous line when pressed, and the character afterwards refer to the cursor keys in normal mode and insert mode respectively. You can add e.g.
h,l
to also have the vim movement keys wrap, if you wish.– Matti Virkkunen
Aug 22 '16 at 11:25
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f2574027%2fautomatically-go-to-next-line-in-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
1
This isn't exactly a programming question but...
– Matti Virkkunen
Apr 4 '10 at 9:33
...but it is a question regarding "software tools commonly used by programmers". :) (admittedly it's not a "problem that is unique to software development").
– lindhe
Mar 9 '15 at 9:32
1
set nocompatible
had disabled that feature in myvim
configuration– Paschalis
Jul 11 '15 at 16:56