|
|
| Line 3: |
Line 3: |
| |
|id=1014 |
|
|id=1014 |
| |
|previous=1012 |
|
|previous=1012 |
| − |
|next=1015 |
+ |
|next=1016 |
| − |
|created=October 8, 2005 |
+ |
|created=2005 |
| |
|complexity=basic |
|
|complexity=basic |
| |
|author=Robert Schols |
|
|author=Robert Schols |
| Line 13: |
Line 13: |
| |
}} |
|
}} |
| |
This command will make a visual selection of the lines that have the same indent level or more as the current line. |
|
This command will make a visual selection of the lines that have the same indent level or more as the current line. |
| − |
|
|
| |
<pre> |
|
<pre> |
| |
:exe "normal V" | let temp_var=indent(line(".")) | while indent(line(".")+1) >= temp_var | exe "normal j" | endwhile |
|
:exe "normal V" | let temp_var=indent(line(".")) | while indent(line(".")+1) >= temp_var | exe "normal j" | endwhile |
| Line 20: |
Line 19: |
| |
==Comments== |
|
==Comments== |
| |
A slight modification, to select the area above the cursor position as well, and the whole thing wrapped in a function (and nmapped to <Space>): |
|
A slight modification, to select the area above the cursor position as well, and the whole thing wrapped in a function (and nmapped to <Space>): |
| − |
|
|
| |
<pre> |
|
<pre> |
| |
function! SelectIndent () |
|
function! SelectIndent () |
Revision as of 02:12, May 16, 2012
This command will make a visual selection of the lines that have the same indent level or more as the current line.
:exe "normal V" | let temp_var=indent(line(".")) | while indent(line(".")+1) >= temp_var | exe "normal j" | endwhile
A slight modification, to select the area above the cursor position as well, and the whole thing wrapped in a function (and nmapped to <Space>):
function! SelectIndent ()
let temp_var=indent(line("."))
while indent(line(".")-1) >= temp_var
exe "normal k"
endwhile
exe "normal V"
while indent(line(".")+1) >= temp_var
exe "normal j"
endwhile
endfun
nmap <Space> :call SelectIndent()<CR>
Currently, I just set foldmethod=indent and select the folded area.