Vimscript - Surround word under cursor with quotesVimscript insert after cursorHow to add a control character inside a string executed by the execute command?Mapping { with VimscriptSearching with vimscript functionIdentify syntax region under cursormystery cursor motionTrouble using <cword> in mappingGet the column that the cursor is on in vimscriptHow to write a vimscript to replace the word under cursor in i mode?Vi shortcut to execute line under cursor as a command
Why don't they build airplanes from 3D printer plastic?
Is a paralyzed creature limp or rigid?
Are treasury bonds more liquid than USD?
Why is に used with this verb?
Is it possible to observe space debris with Binoculars?
To which airspace does the border of two adjacent airspaces belong to?
Do 643,000 Americans go bankrupt every year due to medical bills?
Numerical minimum of a one-valued function
How could a planet have one hemisphere way warmer than the other without the planet being tidally locked?
Never make public members virtual/abstract - really?
If I sell my PS4 game disc and buy a digital version, can I still access my saved game?
What drugs were used in England during the High Middle Ages?
MOSFET broke after attaching capacitor bank
Project Euler Problem 45
Why are all volatile liquids combustible
Comparing elements in a nested list to generate a new list
Why doesn't GMAC/GCM encrypt its authentication tag?
What quests do you need to stop at before you make an enemy of a faction for each faction?
Does blackhole merging breaks their event horizon seggregation?
Was Rosie the Riveter sourced from a Michelangelo painting?
First Number to Contain Each Letter
Why there is no wireless switch?
In-universe, why does Doc Brown program the time machine to go to 1955?
How can I oppose my advisor granting gift authorship to a collaborator?
Vimscript - Surround word under cursor with quotes
Vimscript insert after cursorHow to add a control character inside a string executed by the execute command?Mapping { with VimscriptSearching with vimscript functionIdentify syntax region under cursormystery cursor motionTrouble using <cword> in mappingGet the column that the cursor is on in vimscriptHow to write a vimscript to replace the word under cursor in i mode?Vi shortcut to execute line under cursor as a command
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm writing a Vim plugin which will need to surround the word directly under your cursor with a quotes. I have tried using simple solutions which use commands like "b" and "e" executed in normal mode, in combination with other cursor position commands, though those felt clunky and non-robust.
I wondered if there was perhaps, a builtin way to surround text, or a more expedient method of doing so.
vimscript
New contributor
Ryan Fredez 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 |
I'm writing a Vim plugin which will need to surround the word directly under your cursor with a quotes. I have tried using simple solutions which use commands like "b" and "e" executed in normal mode, in combination with other cursor position commands, though those felt clunky and non-robust.
I wondered if there was perhaps, a builtin way to surround text, or a more expedient method of doing so.
vimscript
New contributor
Ryan Fredez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
Welcome to Vi and Vim! As it stands, your question asks for answers for which it is hard to judge the best—words like simplest and fastest can be subjective and solicit answers based on opinion rather than fact and experience. That doesnt work well with the StackExchange mode. Please edit your question to clarify your goals and make them objective. [side note: have a look at tpope’s surround.vim on github]
– D. Ben Knoble
8 hours ago
add a comment |
I'm writing a Vim plugin which will need to surround the word directly under your cursor with a quotes. I have tried using simple solutions which use commands like "b" and "e" executed in normal mode, in combination with other cursor position commands, though those felt clunky and non-robust.
I wondered if there was perhaps, a builtin way to surround text, or a more expedient method of doing so.
vimscript
New contributor
Ryan Fredez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm writing a Vim plugin which will need to surround the word directly under your cursor with a quotes. I have tried using simple solutions which use commands like "b" and "e" executed in normal mode, in combination with other cursor position commands, though those felt clunky and non-robust.
I wondered if there was perhaps, a builtin way to surround text, or a more expedient method of doing so.
vimscript
vimscript
New contributor
Ryan Fredez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ryan Fredez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 7 hours ago
Ryan Fredez
New contributor
Ryan Fredez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 9 hours ago
Ryan FredezRyan Fredez
133 bronze badges
133 bronze badges
New contributor
Ryan Fredez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ryan Fredez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
Welcome to Vi and Vim! As it stands, your question asks for answers for which it is hard to judge the best—words like simplest and fastest can be subjective and solicit answers based on opinion rather than fact and experience. That doesnt work well with the StackExchange mode. Please edit your question to clarify your goals and make them objective. [side note: have a look at tpope’s surround.vim on github]
– D. Ben Knoble
8 hours ago
add a comment |
2
Welcome to Vi and Vim! As it stands, your question asks for answers for which it is hard to judge the best—words like simplest and fastest can be subjective and solicit answers based on opinion rather than fact and experience. That doesnt work well with the StackExchange mode. Please edit your question to clarify your goals and make them objective. [side note: have a look at tpope’s surround.vim on github]
– D. Ben Knoble
8 hours ago
2
2
Welcome to Vi and Vim! As it stands, your question asks for answers for which it is hard to judge the best—words like simplest and fastest can be subjective and solicit answers based on opinion rather than fact and experience. That doesnt work well with the StackExchange mode. Please edit your question to clarify your goals and make them objective. [side note: have a look at tpope’s surround.vim on github]
– D. Ben Knoble
8 hours ago
Welcome to Vi and Vim! As it stands, your question asks for answers for which it is hard to judge the best—words like simplest and fastest can be subjective and solicit answers based on opinion rather than fact and experience. That doesnt work well with the StackExchange mode. Please edit your question to clarify your goals and make them objective. [side note: have a look at tpope’s surround.vim on github]
– D. Ben Knoble
8 hours ago
add a comment |
2 Answers
2
active
oldest
votes
You can surround the word currently under the cursor in quotes with the following normal mode commands:
ciw""EscP
Replace iw with any other Vim motion/text object to surround other things with quotes*. Or "" with any other pair of characters to surround the object with different things.
If you want to surround the object with a longer piece of text, such as an HTML <p> tag, you can use Ctrl-R instead of the P put command:
ciw<p>Ctrl-R"</p>Esc
See :help i_CTRL-R for more details.
This latter command performs the change as a single edit, and thus is repeatable with the . command, but as discussed in the comments, when you repeat the command, it will enter the text from the original change command. However, as @user938271 explains, you can workaround this by using Ctrl-RCtrl-O or Ctrl-RCtrl-P instead of a plain Ctrl-R when inserting the contents of the register, making it easy to apply the edit quickly in several different places.
* Or use c from visual mode to surround text that is hard to describe with a single motion.
1
+1 for the second answer using<C-r>"(also possible:<C-r>-, when you're changing less than a line.) Using that combination allows you to undo the operation with a singleu. It also allows you to repeat with., though in that case the repeat will insert the same text as the first time, which can be useful if you're quoting the same exact word over and over again.
– filbranden
6 hours ago
2
@filbranden: If you want the dot command to use the last deleted word (and not always the first), during the first edition, you can pressC-r C-o "orC-r C-p "(instead of justC-r ") to insert the deleted word back into the buffer.
– user938271
4 hours ago
@user938271 That is just AMAZING!!! So glad I learned about this one today. I'm still reading the docs, trying to understand why this works. But it's so great that it does! Thanks for pointing this out. If you write this as an answer, I'll upvote it for sure, as far as I can tell that's the best way to execute this operation!
– filbranden
3 hours ago
1
@filbranden: Reading the docs, it's unclear to me, too. But I think the difference is thatC-rinserts the text "as if you typed it, but mappings and abbreviations are not used" - meaning that.doesn't "remember" the commandC-r ", just the actual text that it expanded to (because that's what would have happened if you had typed it). But IMHO the docs really ought to call that out, if that's what is meant.
– Kevin
7 mins ago
add a comment |
Yes, a plug-in for surrounding with quotes exists! vim-surround is what you're looking for.
To surround the current word in double quotes, you can use ysiw" once you have the plug-in installed.
ys is the command to surround and object (there's also cs to replace one delmiter with another, ds to remove surrounding), then iw is a text-object defining what to surround and finally " is what to surround it with.
You might want to read the docs for vim-surround to see all that it can do. It's really a lot!
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "599"
;
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
);
);
Ryan Fredez is a new contributor. Be nice, and check out our Code of Conduct.
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%2fvi.stackexchange.com%2fquestions%2f21113%2fvimscript-surround-word-under-cursor-with-quotes%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 surround the word currently under the cursor in quotes with the following normal mode commands:
ciw""EscP
Replace iw with any other Vim motion/text object to surround other things with quotes*. Or "" with any other pair of characters to surround the object with different things.
If you want to surround the object with a longer piece of text, such as an HTML <p> tag, you can use Ctrl-R instead of the P put command:
ciw<p>Ctrl-R"</p>Esc
See :help i_CTRL-R for more details.
This latter command performs the change as a single edit, and thus is repeatable with the . command, but as discussed in the comments, when you repeat the command, it will enter the text from the original change command. However, as @user938271 explains, you can workaround this by using Ctrl-RCtrl-O or Ctrl-RCtrl-P instead of a plain Ctrl-R when inserting the contents of the register, making it easy to apply the edit quickly in several different places.
* Or use c from visual mode to surround text that is hard to describe with a single motion.
1
+1 for the second answer using<C-r>"(also possible:<C-r>-, when you're changing less than a line.) Using that combination allows you to undo the operation with a singleu. It also allows you to repeat with., though in that case the repeat will insert the same text as the first time, which can be useful if you're quoting the same exact word over and over again.
– filbranden
6 hours ago
2
@filbranden: If you want the dot command to use the last deleted word (and not always the first), during the first edition, you can pressC-r C-o "orC-r C-p "(instead of justC-r ") to insert the deleted word back into the buffer.
– user938271
4 hours ago
@user938271 That is just AMAZING!!! So glad I learned about this one today. I'm still reading the docs, trying to understand why this works. But it's so great that it does! Thanks for pointing this out. If you write this as an answer, I'll upvote it for sure, as far as I can tell that's the best way to execute this operation!
– filbranden
3 hours ago
1
@filbranden: Reading the docs, it's unclear to me, too. But I think the difference is thatC-rinserts the text "as if you typed it, but mappings and abbreviations are not used" - meaning that.doesn't "remember" the commandC-r ", just the actual text that it expanded to (because that's what would have happened if you had typed it). But IMHO the docs really ought to call that out, if that's what is meant.
– Kevin
7 mins ago
add a comment |
You can surround the word currently under the cursor in quotes with the following normal mode commands:
ciw""EscP
Replace iw with any other Vim motion/text object to surround other things with quotes*. Or "" with any other pair of characters to surround the object with different things.
If you want to surround the object with a longer piece of text, such as an HTML <p> tag, you can use Ctrl-R instead of the P put command:
ciw<p>Ctrl-R"</p>Esc
See :help i_CTRL-R for more details.
This latter command performs the change as a single edit, and thus is repeatable with the . command, but as discussed in the comments, when you repeat the command, it will enter the text from the original change command. However, as @user938271 explains, you can workaround this by using Ctrl-RCtrl-O or Ctrl-RCtrl-P instead of a plain Ctrl-R when inserting the contents of the register, making it easy to apply the edit quickly in several different places.
* Or use c from visual mode to surround text that is hard to describe with a single motion.
1
+1 for the second answer using<C-r>"(also possible:<C-r>-, when you're changing less than a line.) Using that combination allows you to undo the operation with a singleu. It also allows you to repeat with., though in that case the repeat will insert the same text as the first time, which can be useful if you're quoting the same exact word over and over again.
– filbranden
6 hours ago
2
@filbranden: If you want the dot command to use the last deleted word (and not always the first), during the first edition, you can pressC-r C-o "orC-r C-p "(instead of justC-r ") to insert the deleted word back into the buffer.
– user938271
4 hours ago
@user938271 That is just AMAZING!!! So glad I learned about this one today. I'm still reading the docs, trying to understand why this works. But it's so great that it does! Thanks for pointing this out. If you write this as an answer, I'll upvote it for sure, as far as I can tell that's the best way to execute this operation!
– filbranden
3 hours ago
1
@filbranden: Reading the docs, it's unclear to me, too. But I think the difference is thatC-rinserts the text "as if you typed it, but mappings and abbreviations are not used" - meaning that.doesn't "remember" the commandC-r ", just the actual text that it expanded to (because that's what would have happened if you had typed it). But IMHO the docs really ought to call that out, if that's what is meant.
– Kevin
7 mins ago
add a comment |
You can surround the word currently under the cursor in quotes with the following normal mode commands:
ciw""EscP
Replace iw with any other Vim motion/text object to surround other things with quotes*. Or "" with any other pair of characters to surround the object with different things.
If you want to surround the object with a longer piece of text, such as an HTML <p> tag, you can use Ctrl-R instead of the P put command:
ciw<p>Ctrl-R"</p>Esc
See :help i_CTRL-R for more details.
This latter command performs the change as a single edit, and thus is repeatable with the . command, but as discussed in the comments, when you repeat the command, it will enter the text from the original change command. However, as @user938271 explains, you can workaround this by using Ctrl-RCtrl-O or Ctrl-RCtrl-P instead of a plain Ctrl-R when inserting the contents of the register, making it easy to apply the edit quickly in several different places.
* Or use c from visual mode to surround text that is hard to describe with a single motion.
You can surround the word currently under the cursor in quotes with the following normal mode commands:
ciw""EscP
Replace iw with any other Vim motion/text object to surround other things with quotes*. Or "" with any other pair of characters to surround the object with different things.
If you want to surround the object with a longer piece of text, such as an HTML <p> tag, you can use Ctrl-R instead of the P put command:
ciw<p>Ctrl-R"</p>Esc
See :help i_CTRL-R for more details.
This latter command performs the change as a single edit, and thus is repeatable with the . command, but as discussed in the comments, when you repeat the command, it will enter the text from the original change command. However, as @user938271 explains, you can workaround this by using Ctrl-RCtrl-O or Ctrl-RCtrl-P instead of a plain Ctrl-R when inserting the contents of the register, making it easy to apply the edit quickly in several different places.
* Or use c from visual mode to surround text that is hard to describe with a single motion.
edited 1 hour ago
answered 6 hours ago
RichRich
16.3k1 gold badge23 silver badges70 bronze badges
16.3k1 gold badge23 silver badges70 bronze badges
1
+1 for the second answer using<C-r>"(also possible:<C-r>-, when you're changing less than a line.) Using that combination allows you to undo the operation with a singleu. It also allows you to repeat with., though in that case the repeat will insert the same text as the first time, which can be useful if you're quoting the same exact word over and over again.
– filbranden
6 hours ago
2
@filbranden: If you want the dot command to use the last deleted word (and not always the first), during the first edition, you can pressC-r C-o "orC-r C-p "(instead of justC-r ") to insert the deleted word back into the buffer.
– user938271
4 hours ago
@user938271 That is just AMAZING!!! So glad I learned about this one today. I'm still reading the docs, trying to understand why this works. But it's so great that it does! Thanks for pointing this out. If you write this as an answer, I'll upvote it for sure, as far as I can tell that's the best way to execute this operation!
– filbranden
3 hours ago
1
@filbranden: Reading the docs, it's unclear to me, too. But I think the difference is thatC-rinserts the text "as if you typed it, but mappings and abbreviations are not used" - meaning that.doesn't "remember" the commandC-r ", just the actual text that it expanded to (because that's what would have happened if you had typed it). But IMHO the docs really ought to call that out, if that's what is meant.
– Kevin
7 mins ago
add a comment |
1
+1 for the second answer using<C-r>"(also possible:<C-r>-, when you're changing less than a line.) Using that combination allows you to undo the operation with a singleu. It also allows you to repeat with., though in that case the repeat will insert the same text as the first time, which can be useful if you're quoting the same exact word over and over again.
– filbranden
6 hours ago
2
@filbranden: If you want the dot command to use the last deleted word (and not always the first), during the first edition, you can pressC-r C-o "orC-r C-p "(instead of justC-r ") to insert the deleted word back into the buffer.
– user938271
4 hours ago
@user938271 That is just AMAZING!!! So glad I learned about this one today. I'm still reading the docs, trying to understand why this works. But it's so great that it does! Thanks for pointing this out. If you write this as an answer, I'll upvote it for sure, as far as I can tell that's the best way to execute this operation!
– filbranden
3 hours ago
1
@filbranden: Reading the docs, it's unclear to me, too. But I think the difference is thatC-rinserts the text "as if you typed it, but mappings and abbreviations are not used" - meaning that.doesn't "remember" the commandC-r ", just the actual text that it expanded to (because that's what would have happened if you had typed it). But IMHO the docs really ought to call that out, if that's what is meant.
– Kevin
7 mins ago
1
1
+1 for the second answer using
<C-r>" (also possible: <C-r>-, when you're changing less than a line.) Using that combination allows you to undo the operation with a single u. It also allows you to repeat with ., though in that case the repeat will insert the same text as the first time, which can be useful if you're quoting the same exact word over and over again.– filbranden
6 hours ago
+1 for the second answer using
<C-r>" (also possible: <C-r>-, when you're changing less than a line.) Using that combination allows you to undo the operation with a single u. It also allows you to repeat with ., though in that case the repeat will insert the same text as the first time, which can be useful if you're quoting the same exact word over and over again.– filbranden
6 hours ago
2
2
@filbranden: If you want the dot command to use the last deleted word (and not always the first), during the first edition, you can press
C-r C-o " or C-r C-p " (instead of just C-r ") to insert the deleted word back into the buffer.– user938271
4 hours ago
@filbranden: If you want the dot command to use the last deleted word (and not always the first), during the first edition, you can press
C-r C-o " or C-r C-p " (instead of just C-r ") to insert the deleted word back into the buffer.– user938271
4 hours ago
@user938271 That is just AMAZING!!! So glad I learned about this one today. I'm still reading the docs, trying to understand why this works. But it's so great that it does! Thanks for pointing this out. If you write this as an answer, I'll upvote it for sure, as far as I can tell that's the best way to execute this operation!
– filbranden
3 hours ago
@user938271 That is just AMAZING!!! So glad I learned about this one today. I'm still reading the docs, trying to understand why this works. But it's so great that it does! Thanks for pointing this out. If you write this as an answer, I'll upvote it for sure, as far as I can tell that's the best way to execute this operation!
– filbranden
3 hours ago
1
1
@filbranden: Reading the docs, it's unclear to me, too. But I think the difference is that
C-r inserts the text "as if you typed it, but mappings and abbreviations are not used" - meaning that . doesn't "remember" the command C-r ", just the actual text that it expanded to (because that's what would have happened if you had typed it). But IMHO the docs really ought to call that out, if that's what is meant.– Kevin
7 mins ago
@filbranden: Reading the docs, it's unclear to me, too. But I think the difference is that
C-r inserts the text "as if you typed it, but mappings and abbreviations are not used" - meaning that . doesn't "remember" the command C-r ", just the actual text that it expanded to (because that's what would have happened if you had typed it). But IMHO the docs really ought to call that out, if that's what is meant.– Kevin
7 mins ago
add a comment |
Yes, a plug-in for surrounding with quotes exists! vim-surround is what you're looking for.
To surround the current word in double quotes, you can use ysiw" once you have the plug-in installed.
ys is the command to surround and object (there's also cs to replace one delmiter with another, ds to remove surrounding), then iw is a text-object defining what to surround and finally " is what to surround it with.
You might want to read the docs for vim-surround to see all that it can do. It's really a lot!
add a comment |
Yes, a plug-in for surrounding with quotes exists! vim-surround is what you're looking for.
To surround the current word in double quotes, you can use ysiw" once you have the plug-in installed.
ys is the command to surround and object (there's also cs to replace one delmiter with another, ds to remove surrounding), then iw is a text-object defining what to surround and finally " is what to surround it with.
You might want to read the docs for vim-surround to see all that it can do. It's really a lot!
add a comment |
Yes, a plug-in for surrounding with quotes exists! vim-surround is what you're looking for.
To surround the current word in double quotes, you can use ysiw" once you have the plug-in installed.
ys is the command to surround and object (there's also cs to replace one delmiter with another, ds to remove surrounding), then iw is a text-object defining what to surround and finally " is what to surround it with.
You might want to read the docs for vim-surround to see all that it can do. It's really a lot!
Yes, a plug-in for surrounding with quotes exists! vim-surround is what you're looking for.
To surround the current word in double quotes, you can use ysiw" once you have the plug-in installed.
ys is the command to surround and object (there's also cs to replace one delmiter with another, ds to remove surrounding), then iw is a text-object defining what to surround and finally " is what to surround it with.
You might want to read the docs for vim-surround to see all that it can do. It's really a lot!
answered 7 hours ago
filbrandenfilbranden
2,9325 silver badges19 bronze badges
2,9325 silver badges19 bronze badges
add a comment |
add a comment |
Ryan Fredez is a new contributor. Be nice, and check out our Code of Conduct.
Ryan Fredez is a new contributor. Be nice, and check out our Code of Conduct.
Ryan Fredez is a new contributor. Be nice, and check out our Code of Conduct.
Ryan Fredez is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Vi and Vim 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%2fvi.stackexchange.com%2fquestions%2f21113%2fvimscript-surround-word-under-cursor-with-quotes%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
2
Welcome to Vi and Vim! As it stands, your question asks for answers for which it is hard to judge the best—words like simplest and fastest can be subjective and solicit answers based on opinion rather than fact and experience. That doesnt work well with the StackExchange mode. Please edit your question to clarify your goals and make them objective. [side note: have a look at tpope’s surround.vim on github]
– D. Ben Knoble
8 hours ago