vim FOLDER SPACE

来源:互联网 发布:淘宝客在哪里推广 编辑:程序博客网 时间:2024/06/01 15:54

:set foldmethod=indent first

Personally I can't convince myself to litter my code with the markers. I've become pretty used to (and efficient) at using indent-folding. Together with my mapping of space bar (see below) to open/close folds and the zR and zM commands, I'm right at home. Perfect for Python!

nnoremap <space> za

vnoremap <space> zf

share|edit|flag


###display only matched lines 1   :/g/searched_text

2   If you pattern happens to be word, then you can place cursor over the 

word and then press [I



regular replace

-----------

1033303 -> 1233303
1033213 -> 1233213

You're very close

%s/103\(\d\{4}\)/123\1/g

The pattern between \( and \) is a sub-match that can be accessed by \1\2 etc in the order of appearance. See :help \( for more information.



Simple commands to remove unwanted whitespaceEdit

In a search, \s finds whitespace (a space or a tab), and \+ finds one or more occurrences.

Delete all trailing whitespace (at the end of each line) with:

:%s/\s\+$//

Like with ed(1), the substitution text can be omitted if blank:

:%s/\s\+$

More rarely, a user might want to delete (leading) whitespace at the beginning of each line:

:%s/^\s\+" Same thing (:le = :left = left-align given range)::%le

0 0
原创粉丝点击