Vim tab settings per file type


















Collectives on Stack Overflow. Learn more. Setting Vim whitespace preferences by filetype Ask Question. Asked 12 years, 3 months ago. Active 3 years, 5 months ago. Viewed 46k times. Improve this question. All these answers just made me more confused. The problem is that the options are up to preference. The accepted answer has a nice syntax though. This was an excellent guide: vimcasts. Add a comment. I don't know if there's a way to do what you want, but I've just learned that that's not the way you're supposed to use tabs.

Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Learn more. Asked 4 years, 5 months ago. Active 4 years, 5 months ago. Viewed times. Learn more. How do I change tab size in Vim? Ask Question. Asked 12 years ago. Active 5 months ago. Viewed k times. Improve this question. Do you want one tab of 4 spaces width? Four spaces? Or four tabs of 1 space width? They're different things, and you aren't clear. In any case, start with reading :he ts , :he sw , and :he expandt — abeyer. Add a comment. Active Oldest Votes.

Improve this answer. Yes, but tabs are semantic each tab means 1 layer of indentation , while spaces are purely presentational. Or in other words, using tabs will let other people viewing your code to display however wide they're comfortable with, whereas spaces wouldn't allow this. Tabs are better than spaces, you can't change my mind. Community Bot 1 1 1 silver badge. With the following in your vimrc , you can switch to the next buffer by pressing F8, or the previous buffer by pressing Shift-F8.

If the target buffer is already displayed in a window in one of the tabs, that window will be displayed. Otherwise, the current window will be split, and the target buffer will be displayed in the new window. If you prefer to open a new tab instead of a new split window, you can set switchbuf to usetab,newtab. Using this technique will cycle between buffers without disturbing the current window or tab layout, providing each buffer is already in a window in a tab.

Each listed buffer :help 'buflisted' is visited in order of buffer number. Note, that this option affects more than just the commands mapped above. Particularly, it affects the quickfix window.

See the help for details. Here are some ideas for entries you may want to add to your vimrc. With the following mappings which require gvim , you can press Ctrl-Left or Ctrl-Right to go to the previous or next tabs, and can press Alt-Left or Alt-Right to move the current tab to the left or right. With the following, you can press F8 to show all buffers in tabs, or to close all tabs toggle: it alternately executes :tab ball and :tabo.

The following command abbreviation allows typing :tabv myfile.



0コメント

  • 1000 / 1000