|
Hi guys,
I have a minor problem: is there a possibility to indent / unindent a block of code? Thanks in advance, Gabor Urban -- Linux: Choice of a GNU Generation -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
|
On Fri, Jul 8, 2011 at 6:25 AM, Gabor Urban <[hidden email]> wrote:
> Hi guys, > > I have a minor problem: is there a possibility to indent / unindent a > block of code? Yes. You can use some regex magic with :s command, but usually a plugin is better. For instance, I use enhancedcommentify http://www.vim.org/scripts/script.php?script_id=23 , but there are others available also. -- Ivan Sichmann Freitas GNU/Linux user #509059 -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
|
In reply to this post by Gabor Urban
On 07/08/2011 04:25 AM, Gabor Urban wrote:
> I have a minor problem: is there a possibility to indent / > unindent a block of code? Of course :) Vim uses the ">" and "<" operators to shift by 'shiftwidth' and uses tabs-vs-spaces as controlled by the 'expandtab' setting: :help > :help 'sw' :help 'et' Depending on how you define your "block", you can use a variety of Vim's motions such as using the ">" and "<" in visual-mode to do a visual selection; using text objects; using "%" to jump to a matching item (paren/bracket/brace); or any other motion that covers the :help v_> :help aB :help i} :help text-objects :help {motion} So if you're in a "{...}" block of code, you can issue >i} to indent the contents of the braces. -tim -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
|
On Fri, Jul 8, 2011 at 8:17 AM, Tim Chase <[hidden email]> wrote:
> On 07/08/2011 04:25 AM, Gabor Urban wrote: >> >> I have a minor problem: is there a possibility to indent / >> unindent a block of code? Ops, seems I mistook indent for comment. My bad. -- Ivan Sichmann Freitas GNU/Linux user #509059 -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
|
On 07/08/2011 06:23 AM, Ivan S. Freitas wrote:
> On Fri, Jul 8, 2011 at 8:17 AM, Tim Chase<[hidden email]> wrote: >> On 07/08/2011 04:25 AM, Gabor Urban wrote: >>> I have a minor problem: is there a possibility to indent / >>> unindent a block of code? > > Ops, seems I mistook indent for comment. My bad. Ah...well that's different ;-) http://www.vim.org/script.php?script_id=23 is the somewhat go-to solution for commenting blocks of code. Because commenting varies from source to source (C "/* ... */ blocks vs. C inline "//"; shell-script "#" comments; .ini file ";" comments; batch-file "REM" comments; Vim's double-quote comments; etc) it requires a bit of smarts to know what your particular is. -tim -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
| Powered by Nabble | Edit this page |
