I just installed spf13 vim on my machine with CentOS. One thing I noticed is that I was not able to set "syntax on" by default.
The difference are the parenthesis color and the GLOB color. The default color is very light on my monitor, so really want to set syntax on by default.
I am not sure what went wrong. Here is my ~/.vimrc.local
filetype plugin on
syntax on
Setting up vim defaults can be funky on new installs.
First, confirm that the rc is being sourced.
Place the line echom "file is sourced on startup" into your .vimrc.
Open a new instance of vim. Type :messages then <return>. If you don't see that line, the file isn't being sourced.
To find out where vim is looking for your .vimrc:
Enter the command :echo $HOME. The folder it outputs is a good place to try putting a .vimrc or .vimrc.local file. Try both of those.
Also try :e $MYVIMRC, which might find the file you need to edit anyway.
Finally, make sure to put set nocompatible in your rc.
Related
System = OSX 10.9.4
I am trying to turn on syntax highlighting in vim while using the terminal. However, I am unable to get it to work properly.
Things I've tried:
located the vimrc file and added the following code:
set ai " auto indenting
set history=100 " keep 100 lines of history
set ruler " show the cursor position
syntax on " syntax highlighting
set hlsearch " highlight the last searched term
filetype plugin on " use the file type plugins
Located vimrc under directory:
cd /usr/share/vim/
The interesting thing is that once I add the code to the vimrc using vim, followed by exiting (x), and re-opening the file again, syntax is correctly highlighted in the vimrc.
However, when I try to make a new vim file called "test", copy the same code, save and exit. Re-open it, the syntax is not highlighted at all.
It appears that syntax highlighting only works when I open the actually vimrc file---and not when I try to create a new one or open another file that should have syntax highlighting.
I've also tried to create a .vimrc (exact copy) under the ~/ (directory). No success.
Made a new file called "test" and tried turning it on while active as well:
vim test
"then within vim"
:syntax on
I am really confused as to why this partially works.
Any help is much appreciated.
Cheers!
p.s. I have followed these instructions as well from: http://geekology.co.za/article/2009/03/how-to-enable-syntax-highlighting-and-other-options-in-vim
*I am aware of macvim, but would like a solution for the native vim in terminal. Thanks.
NEVER do anything in $VIM as it will work only by luck, cause unexpected behaviors and likely be overwritten next time Vim is updated.
What you have put in /usr/share/vim/vimrc should be in ~/.vimrc.
filetype on and syntax on are the bare minimum you need in your ~/.vimrc for syntax highlighting to work.
$ vim ~/.vimrc gives you syntax highlighting because the file is recognized by Vim as a vim file. Filetype detection is mostly dependent on file extensions so you can't expect any syntax highlighting in a file called test.
$ vim test.py, on the other hand, should give you syntax highlighting.
If the filetype is not detected, you can force it with :set filetype=python.
You most probably want to enable indentation along with syntax highlighting, so add these to lines to ~/.vimrc
filetype plugin indent on
syntax on
Steps with screenshots can be found here
http://osxandiosdaily.com/how-to-enable-vim-syntax-highlighting-on-mac-osx/
Inside of your file, enter command mode and enter the command
:syntax on
I have installed cvim and NodeTree plugins and generated an exuberant ctags file for my build tree.
This is what my ~/.vim/.vimrc file looks like:
:noremap :TlistToggle
:let Tlist_Show_One_File = 1
:let Tlist_Exit_OnlyWindow = 1
:let Tlist_Use_Right_Window = 1
set tags=./tags;/
set number
set tabstop=4
set incsearch
When I start editing a file, I notice that Ctrl ] does not work and I have to resort to typing ta: funcname - which gets tiring after a while. Interestingly enough, Ctrl T pops me off the tag stack as expected - I don't understand whats going on - how do I fix this?
Incidentally, vim (appears to) completely ignores the contents of my .vimrc file and I always have to type the same commands in the editor, so as to get the settings I want - very annoying.
Last but not the least, I used to be able to type :make in the editor window, drop to the console and then have the build results displayed in a little window which I can then go to and select a line (with an error or warning say), and then have the editor automagically take me to the offending line - unfortunately, I don't remember the plugin (or commands) I used to allow me to build from within vim.
So, how do I:
Fix my vim setup so that I can move to definitions/declarations using Ctrl-]
Fix my .vimrc file so that contents are actually applied to my vim session.
Find the appropriate plugin to install to allow builds (using make) from within vim
You're asking about a weird mix of problems.
Fix my vim setup so that I can move to definitions/declarations using Ctrl-]
The tags functionality is working; I suspect that you have a mapping blocking Ctrl-]. Try
:verbose nmap <C-]>
and
:nunmap <C-]>
Fix my .vimrc file so that contents are actually applied to my vim session.
:echo $MYVIMRC
will tell you the location of the .vimrc that Vim uses. Also, check the output of :scriptnames which scripts get loaded, and read :help vimrc to understand the logic Vim applies.
Find the appropriate plugin to install to allow builds (using make) from within vim
That's built into Vim. With the appropriate 'makeprg' set (it defaults to make), you can run :make. Vim parses the output (through the 'errorformat' option), and you can open the quickfix list via :copen.
Your vimrc is:
~/.vim/.vimrc
If you run Vim 7.4, it should be:
~/.vim/vimrc
or
~/.vimrc
If you run Vim 7.3 or older, it should be:
~/.vimrc
And... what Ingo said.
I tried to install Conque-Shell via Vundle, and when I input :ConqueTerm bash in vim, it showed 'ConqueTerm: Not an edit command'. I thought there was something wrong with my path. But I did write set rtp+=~/.vim/bundle/vundle in my .gvimrc. And the configure of Vundle is at the beginning of the .gvimrc.
I copied the .vim/bundle/Conque-Shell/plugin/conque_term.vim to .vim/plugin/conque_term.vim and then it worked.
So, is there anything wrong with my .gvimrc?? Thanks!
My .gvimrc: https://gist.github.com/guori12321/5506991
If you observe the output of :scriptnames (the list of scripts sourced during startup), you'll note that .gvimrc comes last, after .vimrc and the plugins. Therefore, any changes to the 'runtimepath' there are too late; plugins (like ConqueTerm) have already been loaded. You can read more about the startup process at :help initialization.
Even if you only use the GUI GVIM, put the common settings into ~/.vimrc; the ~/.gvimrc file is for GUI-only stuff that doesn't apply to the terminal Vim, e.g. setting 'guifont' and similar options.
The latest upgrade of Ubuntu made my vim colorscheme unusable. I know how to set it manually (:colo evening, for example), but I want to set the default for all vim sessions. I see reference in other places to .vimrc, but the right location and syntax have eluded me thus far.
Put a colorscheme directive in your .vimrc file, for example:
colorscheme morning
See here: http://vim.wikia.com/wiki/Change_the_color_scheme
Your .vimrc file goes in your $HOME directory. In *nix, cd ~; vim .vimrc. The commands in the .vimrc are the same as you type in ex-mode in vim, only without the leading colon, so colo evening would suffice. Comments in the .vimrc are indicated with a leading double-quote.
To see an example vimrc, open $VIMRUNTIME/vimrc_example.vim from within vim
:e $VIMRUNTIME/vimrc_example.vim
It's as simple as adding a line to your ~/.vimrc:
colorscheme color_scheme_name
You can try too to put this into your ~/.vimrc file:
colorscheme Solarized
What was asked for was to set:
the 'default', not some other color profile, and
'for all vim sessions', not simply for the current user.
The default colorscheme, "for all vim sessions", is not set simply by adding a line to your ~/.vimrc, as all of the other answers here say, nor is the default set without the word 'default' being there.
So all of the other answers here, so far, get both of these wrong. (lol, how did that happen?)
The correct answer is:
Add a line to your system vim setup file in /etc/vim/ that says
colorscheme default
or using the abbreviation
colo default
but not capitalized as
colo Default
(I suggest using the full, un-abbreviated term 'colorscheme', so that when you look at this years later you'll be able to more easily figure out what that darn thing does. I would also put a comment above it like "Use default colors for vim".)
To append that correctly, first look at your /etc/vim/vimrc file.
At the bottom of mine, I see these lines which include /etc/vim/vimrc.local:
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
So you can append this line to either of these two files.
I think the best solution is to append your line to /etc/vim/vimrc.local like this:
colorscheme default
You can easily do that in bash with this line:
$ echo -e "\"Use default colors for vim:\ncolorscheme default" \
| sudo tee -a /etc/vim/vimrc.local
#
# NOTE: This doesn't work:
#
# $ sudo echo 'colorscheme default' >> /etc/vim/vimrc.local
#
# It's the same general idea, and simpler, but because sudo doesn't
# know how to handle pipes, it fails with a `Permission denied` error.
Also check that you have permission to globally read this file:
sudo chmod 644 /etc/vim/vimrc.local
With $ tail /etc/vim/vimrc.local you should now see these lines:
"Use default colors for vim:
colorscheme default
You can just use the one-liner
echo colorscheme koehler >> ~/.vimrc
and replace koehler with any other available colorscheme. Imho, all of them are better than default.
Once you’ve decided to change vim color scheme that you like, you’ll need to configure vim configuration file ~/.vimrc.
For e.g. to use the elflord color scheme just add these lines to your ~/.vimrc file:
colo elflord
For other names of color schemes you can look in /usr/share/vim/vimNN/colors
where NN - version of VIM.
Ubuntu 17.10 default doesn't have the ~/.vimrc file, we need create it and put the setting colorscheme color_scheme_name in it.
By the way, colorscheme desert is good scheme to choose.
Copy downloaded color schemes to ~/.vim/colors/Your_Color_Scheme.
Then write
colo Your_Color_Scheme
or
colorscheme Your_Color_Scheme
into your ~/.vimrc.
See this link for holokai
OS: Redhat enterprise edition
colo schema_name works fine if you are facing problems with colorscheme.
I have multiple plugins in Vim and some of them modify the default behavior of Vim. For example I use Vimacs plugin, which makes Vim behave like emacs in the insert mode alone. Sometime I want to turn off the Vimacs plugin without moving the vimacs.vim out of the plugins directory. Is there a way to do it?
You can do this if you use a plugin manager like Vundle or Pathogen, which will keep the plugin in its own directory underneath the ~/.vim/bundle/ directory.
In that case, just find out the runtimepath of the vimacs plugin with the following command:
set runtimepath?
Let's say it's ~/.vim/bundle/vimacs.
Then, put this command in your .vimrc:
set runtimepath-=~/.vim/bundle/vimacs
To load vimacs, just comment that line out and relaunch Vim (or source your .vimrc).
See which variable vimacs check on start. On the begin of the script file find something Like if exists('g:vimacs_is_loaded").... Then set this variable in your .vimrc or while start vim with vim --cmd "let g:vimacs_is_loaded = 1".
In case you are using pathogen, this post gives a better answer, in my opinion. Since I have frequent need to disable snippets when using latex, also added this in my ~/.config/ranger/rc.conf:
map bs shell vim --cmd "let g:pathogen_blacklist = [ 'ultisnips', 'vim-snipmate' ]" %f
This way, whenever I want to open a file with snippets disabled, it is easy.