Regarding the tab size in vim [closed] - linux

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have already setup vim size to 4 in ~/.vimrc. It is working when I enter tab, but the original file display tab in size 8. How to make them all in size 4?
Thank you,

:verbose setlocal tabstop? softtabstop? expandtab? shiftwidth?
will show you the current indent settings (and where it got defined). Since these are buffer-local settings, it's not enough to set this once in your ~/.vimrc. Several filetype plugins change these indent settings. (Though typically not 'tabstop', but rather 'softtabstop'.
You could avoid that by turning off filetype plugins altogether (drop :filetype plugin on from your ~/.vimrc), but it's better to selectively override this in the after directory.
Put your :setlocal ... commands into ~/.vim/after/ftplugin/{filetype}.vim. (This requires that you have :filetype plugin on; use of the after directory allows you to override any default filetype settings done by $VIMRUNTIME/ftplugin/{filetype}.vim.) Alternatively, you could define an :autocmd FileType {filetype\} ... directly in your ~/.vimrc, but this tends to become unwieldy once you have many customizations.

Related

Can not get vim to work like i want [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have tried fixing vim to my likings but I alawys encountered a lot of problems due to my lack of knowldege.The most commons ones are:
Powerline font not rendering properly example here
Syntax Highlighting not giving the expected color
Background color not being rendered properly
I am aiming for a result which would look pretty similiar to this when I currently have this.
If the information given is not enough I will give you additional information in the comments. Any help would be greatly appreciated!
You seem to be asking 2 questions:
How do you get fancy font characters for *line plugins?
Where are my syntax highlighting colors?
Fancy font patching
You will need to refer to your status line plugin for how it wants you to patch a font and setup your terminal. vim-powerline for example has instructions on how to do this.
Syntax highlighting colors
You need to make sure you have the following lines in your vimrc file:
filetype plugin indent on
syntax on
This will turn on syntax highlighting and filetype specific plugins (aka ftplugins). As long as you have a color terminal and $TERM is set correctly then the colors should show.
Make sure you also specify a colorscheme via :colorscheme in your vimrc file as well:
colorscheme nord
It should also be noted that nord colorscheme requires you to update your terminal's theme as well in order to work properly.

stackoverflow syntax highlighting in vim [duplicate]

This question already has answers here:
Enabling markdown highlighting in Vim
(5 answers)
Closed 9 years ago.
Today i woke up with a simple idea.
It would great to have "stackoverflow synthax highlighting in vim".
Do you know a simple way to go SO style ?
Stack Overflow uses Markdown syntax, so this should do it (in Vim versions 7.3+, which ship with it):
:setf markdown
as separate filetype
If you want to do customizations, it's best to define your own custom stackoverflow filetype by creating a file ~/.vim/syntax/stackoverflow.vim with the following contents (and defining corresponding filetype detection rules):
" Quit when a syntax file was already loaded.
if exists('b:current_syntax') | finish | endif
runtime! syntax/markdown.vim syntax/markdown/*.vim
filetype setting from browser
Since Stack Overflow is browser-based, you probably use a browser plugin to do the editing in Vim. I've described such a setup that can automatically set the filetype based on the currently edited URL for Firefox in my blog post Pentadactyl set filetype in external Vim editor based on URL.
Your question is fuzzy; if you mean to mark certain blocks as having a certain syntax (which on Stack Overflow can be done with language: lang-js HTML comments), my SyntaxRange plugin enables you to define a different filetype syntax on regions of a buffer, either manually or automatically based on markers.

How to enable vim-latex-suite plugin in markdown? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
In vim, the latex-suite plugin is for tex filetype. I want to apply the convenience of vim latex-suite plugin for markdown filetype. How can I do it?
EDIT: I want to use markdown syntax to take notes. But It's not convenient for me to type formula in the markdown file. It will be very convenient If the latex-suite macros/shortcuts can be used in markdown file(with the markdown highlight syntax).
In vim I set this
:set ft=tex
:set syntax=markdown
and then I have all the latex-suite macros and shortcuts working, while the syntax highlighting is set to markdown.

Vim closing a file with defaults [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Is there a way to tell Vim what to do every time I'm about to close a file? Specifically I am asking because I don't want to make a call to :mkview all the time, especially since I forget it most of the time...
So can I tell Vim to call :loadview when I open a file and :mkview when I close it?
The best answers are often in Vim's help, if you know what to search for. In this case, one possible solution is at :h :loadview:
To automatically save and restore views for *.c files:
au BufWinLeave *.c mkview
au BufWinEnter *.c silent loadview
You can modify this to suit your own needs. To make it apply to all filetypes, use * instead of *.c. To make this happen at Vim startup and exit, use the events VimLeave and VimEnter instead of BufWinLeave and BufWinEnter.

Where vim searches for its filename completion ctrl-x ctrl-f? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a bunch of files in (project)/src and (project)/inc.
When I press <C-x><C-f> vim should give me suggestions about filenames from there but I couldn't find how to set the directories it searches in.
The documentation I read says only that <C-p> and <C-n> moves inside the list but nothing about calibrating the search path.
set autochdir
automatically sets the "current directory" to the one containing the current file. Put it in your vimrc, enjoy life.
Its the pwd or the path from where the vim was launched.Its not configurable.
Although a new feature called path-support will be available in vim soon:
http://vimdoc.sourceforge.net/htmldoc/options.html#%27path%27
That might help you configure more.
In the meantime try these vim plugins:
FuzzyFinder
http://www.vim.org/scripts/script.php?script%5Fid=1984
zvim
https://bitbucket.org/ZyX_I/zvim
t-command
http://www.vim.org/scripts/script.php?script_id=3025
Or you can write your own vim plugin.
Refer:
http://vim.wikia.com/wiki/Searching_for_files_in_a_directory_listing
And
http://vim.wikia.com/wiki/Source_vimrc_and_use_tags_in_a_parent_directory
This is what I've done to solve the problem, seems much more easier than #askmish solution.
Edit vimrc and add this mapping :
map <F4> :cd %:h<CR>
from now on, press F4 to switch to current directory.
Now when you press <C-X><C-F> you can see a list of all files in your current working directory.

Resources