Is there a way to force vim to use tabs to do the initial indent, but when running the retab! command NOT replace inner word spacing with tabs?
相关问题
- Emacs shell: save commit message
- How to change the first two uppercase characters o
- Insert text into current buffer from function
- Hot reload on save
- Substituting zero-width match in vim script
相关文章
- 如何让 vim 支持 .cshtml 文件的代码高亮
- Auto-save in VIM as you type
- How can I use gcc's -I command to add recursiv
- Vim: overloaded mapping for multiple modes
- vi editor is not responding
- How to use relative line numbering universally in
- How to copy the value of a vim option to a registe
- E185: Cannot find color scheme*
From my answer to this other (*) question:
Than you need to redo the search with
@:
or10@:
Its better explained in the link bellow.
(*) How can I convert spaces to tabs in Vim or Linux?
In my experience the best way to do this is with a custom function:
You can then use:
to replace all leading spaces as tabs but not to affect tabs after other characters. It assumes that 'ts' is set correctly. You can go a long way to making files that are misaligned better by doing something like this:
You'll end up with a file where all the leading whitespace is tabs so people can look at it in whatever format they want, but where all the trailing whitespace is spaces so that all the end-of-line comments, tables etc line up properly with any tab width.
Edit
Explanation of the 'exe' line: