Syntax highlight for Sass is not working in Vim - vim

I just downloaded a Vim plugin for Sass syntax highlight.
The instructions say:
install details put it into syntax
directory and add sass filetype
au! BufRead,BufNewFile *.sass
setfiletype sass
in your filetype.vim
I already placed sass.vim in vimfiles/syntax/ (using windows).
And created a filetype.vim file with the code above (au! Buf...) in all the following directories:
vimfiles/
vimfiles/ftdetect
vimfiles/ftplugins
but no one worked (I even typed the au! Buf... code in my vimrc).
My .sass files still looking like this:
alt text http://img193.imageshack.us/img193/4791/sassi.png
any suggestions?

I don't know an easy fix, but try checking some vim settings with the following commands:
Does enabling syntax explicitly fix your problem? :syntax enable
Is filetype detection on? :filetype
Does vim recognize this as a sass file? :set filetype?
Check to make sure your script directories are in the runtime path :set runtimepath?
Does manually loading the syntax file change anything? :runtime! vimfiles/syntax/sass.vim
Also check if syntax highlighting works for other filetypes.

Related

Change Vim's Syntastic to use a certain checker based on file extension?

I have vim's syntastic installed properly along with eslint and jshint. I prefer jshint for most of my javascript programming. However, I'm starting to learn React, and would like to use eslint with syntastic (eslint has superior/proper linting for react).
Is it possible to set vim to use jshint for *.js files, and eslint for *.jsx files?
I see from :help syntastic-checkers that react gets lumped in javascript. Chaining the linters is not what I want, either.
Found it! You were very close #lcd047, but your comment lead me down the right path! To enable eslint on only *jsx files, putting the following in my .vimrc works:
au BufEnter *.jsx let b:syntastic_checkers = ['eslint']
In my case, syntastic will use jshint on javascript by default even if a checker is not set in .vimrc. Setting the above works even if g:syntastic_javascript_checkers is unset or even if it is set, in my case, to jshint.

SnipMate in Vim on Windows

What is wrong with my install of snipMate? I cannot get it to work. I even tried installing Pathogen as noted in the other answer. I am running vim7.4 on a windows XP. The _vimrc is noted below -
set nocompatible
set textwidth=80
set formatoptions=cqrol
set ts=2
set expandtab
set guifont:Courier_New:h8:cANSI
set backupdir=$temp
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
filetype plugin on
autocmd BufEnter * setlocal cursorline cursorcolumn
hi cursorcolumn ctermbg=247 guibg=grey70
hi cursorline ctermbg=247 guibg=grey70
call pathogen#infect()
The VIM install directory structure looks like below. It is after I unzipped the snipMate.zip to vim74 folder.
c:\program files\vim\vim74
after/
autoload/
colors/
compiler/
doc/
ftplugin/
indent/
keymap/
lang/
macros/
plugin/
snippets/
spell/
syntax/
tools/
tutor/
README.txt
bugreport.vim
delmenu.vim
diff.exe*
evim.vim
filetype.vim
ftoff.vim
ftplugin.vim
ftplugof.vim
gvim.exe*
gvimext.dll
gvimrc_example.vim
indent.vim
indoff.vim
install.exe*
libintl.dll
macmap.vim
makemenu.vim
menu.vim
mswin.vim
optwin.vim
rgb.txt
scripts.vim
synmenu.vim
uninstal.exe*
uninstal.txt
uninstall-gui.exe*
vim.exe*
vimrc_example.vim
vimrun.exe*
vimtutor.bat*
xxd.exe*
.swp
I'm a Unix guy and don't know much about Windows, but try the following steps:
1) Per default pathogen searches in your personal folder ($HOME\vimfiles\bundle) and not in Vim's installation directory
2) Put call pathogen#infect() at the top of your vimrc
3) Maybe try commenting out the two mswin lines, maybe they interfere somehow
4) Which snipmate did you use? There is the old, unmaintained version from msanders (I still use this one) that has no depedencies and there is a fork by garbas that actually has dependencies
Okay finally problem solved. After some reading and trial&error, I stumbled upon this question which did it. The path separator slashes in the _vimrc are "\" by default. But they need to be "/". Thank you those who helped with their answers and comments.
The working _vimrc file is shown below -
"for pathogen
runtime ../vimfiles/bundle/vim-pathogen-master/autoload/pathogen.vim
execute pathogen#infect()
execute pathogen#helptags()
"for snipmate
let g:snippets_dir="$VIMRUNTIME/../vimfiles/bundle/sv-snippets/snippets"
set nocompatible
set textwidth=80
set formatoptions=cqrol
set ts=2
set expandtab
set guifont:Courier_New:h8:cANSI
set backupdir=$temp
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
filetype plugin indent on
syntax on
autocmd BufEnter * setlocal cursorline cursorcolumn
hi cursorcolumn ctermbg=247 guibg=grey70
hi cursorline ctermbg=247 guibg=grey70
Some notes about this _vimrc -
I call pathogen#helptags() in _vimrc because I am sure I shall forget it. I do not have too many plugins so this is not a problem.
During the exercise I stumbled upon a way to locate pathogen in the bundle folder as well. Thank you Ted Reed for this. I haven't seen anybody talk about installing pathogen this way. But it's great because now the install is not corrupted even with the pathogen files.
I did not see any differences in the behavior if I comment out the mswin related statements. But I left it in there because I do not completely know what they do and I have been using it this way for a longtime now without any issues.
The directory structure I use -
c:\program files\vim\vim74 - vim install, given by $VIMRUNTIME
c:\program files\vim\vimfiles\bundle - plugins such as pathogen, snipmate
c:\program files\vim\_vimrc

Vundle: activate Jade highlighting?

Mac OSX 10.7, Vim 7.3
I have installed Vundle for Vim, and I have included these lines in my ~/.vimrc:
Bundle "gmarik/vundle"
Bundle "pangloss/vim-javascript"
Bundle "https://github.com/digitaltoad/vim-jade.git"
I then run (in Vim): :BundleInstall!, and vim gives an agreeable Done! without mentioning any errors.
Javascript files are highlighted just fine. But when I open a jade file (express/views/index.jade), I don't get any color highlighting love.
What am I missing?
For the new version of Vundle, add this to your .vimrc:
Plugin 'digitaltoad/vim-jade'
and run
:PluginInstall
that works for me.
Just use the name of the repository
Bundle 'digitaltoad/vim-jade'
Then
$vim +BundleInstall! +BundleClean +q
Reload vim. Just worked for me.

Why isn't VimClojure setting filetype to "clojure"

I have setup vundle to handle my packages in MacVim. It correctly sets the filetype for all my other files, e.g. ruby, perl, etc.
However, it is not setting the filetype when I open a .clj file. When I run :set filetype? it returns empty. So, vim isn't recognizing clojure files. I can :set filetype=clojure and immediately get code completion and syntax highlighting; so I know VimClojure is working correctly.
What's the best way to "debug" this or find out where the issue lies?
MacVim v7.3
OS X 10.6
Thanks!
UPDATE
I already have filetype plugin indent on and it's working for other packages (vim-ruby, vim-rails, etc.) that vundle is managing. Just not VimClojure.
In order to enable loading filetype plugins you might need to add this in your .vimrc:
filetype plugin on
Make sure you're initializing Vundle and your bundles before the rest of your configuration in your vimrc. So, for example, you should have:
" =======================================================================
" Vundle setup and initialization. This needs to be done before any
" configuration so all plugins are loaded.
set nocompatible " required for Vundle
filetype off " required for Vundle, enabled later.
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" Powerline
Bundle 'Lokaltog/vim-powerline'
...
...where Powerline is just an example bundle. Then have the rest of your config...
" =======================================================================
" Actual vim configuration goes here.
" =======================================================================
syntax on "lots of syntax highlighting
set nocompatible "be iMproved
colorscheme mustang
filetype plugin indent on
...
Hope that helps...
VimClojure installs a file ftdetect/clojure.vim. My suspicion is, that this is not picked up by Vim. Don't know vundle so I can't help with that. If vundle needs some initialisation in .vimrc, you should check that it happens before the filetype stuff.
I have the same problem on Ubuntu. It's caused by system-level vim settings.
You can what system-level vim settings are applied with :scriptnames. If you run redir #c | scriptnames | redir END | enew | put c inside of vim, you'll get a buffer containing all scripts sourced by vim. If you ignore all of your files (:g/\~/d), you can see all system-level scripts.
My problem was in the very first file: /usr/share/vim/vimrc
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
syntax on
endif
Because syntax on appears before pathogen (my vim plugin manager) is setup, vim never looks in the bundle/vimclojure/ftdetect directory. I think vundle will have the same problem for you. (Try copying ftdetect/clojure.vim into ~/.vim/ftdetect/clojure.vim and see if you still have the problem.)
If you're having the same problem, you have three possible solutions:
Comment out those lines and file a bug with whoever owns the offending file (Apple or MacVim). I'd guess that your files are in the MacVim bundle, since I don't remember MacVim doing system-level changes.
Add filetype off before initializing vundle (you may need syntax off too). Pathogen uses pathogen#infect() to do this, maybe vundle has something similar. (Corresponding pathogen bug and fix.) Make sure you turn them back on after! (Also, make sure your vundle setup comes before anything else in your vimrc related to filetype/plugin/syntax.)
Make symlinks from ftdetect files for all bundles into ~/.vim/ftdetect (and have doubled autocmds if the bug is ever fixed).
Make sure your file extension is .clj, not .clojure nor .cloj

Pathogen does not load plugins

Pathogen does not work for me. I am following Adam Lowe's hints posted here (and few more) without any success...
My vimrc:
filetype off
call pathogen#runtime_append_all_bundles()
filetype plugin indent on
set nocompatible
syntax on
set tabstop=2
set smarttab
set shiftwidth=2
set autoindent
set expandtab
set number
colorscheme darkblue
Contents of .vim - ls .vim/*:
.vim/autoload:
pathogen.vim
.vim/bundle:
nerdcommenter/ vim-haml/ vim-surround/
vim-endwise/ vim-rails/ vim-vividchalk/
All plugins in bundle were installed by cloning them from GitHub into bundle directory.
I have tried with pathogen 1.1 and 1.2 and even the latest from GitHub without any result. Vividchalk, Vim-rails and nerdcommenter are not working. I have very little experience with other plugs so I am not sure about them, but I suppose they are not working too.
I am using ArchLinux, vim 7.2.385-1 (not the latest because the latest requires me to install ruby1.9, but it is still 7.2). It has been installed via pacman - ArchLinux package manager. No vim plugins were installed the other way than using pathogen (I have even reinstalled vim package with cleaning /usr/share/vim).
What am I doing wrong?
EDIT:
/etc/vimrc http://hpaste.org/fastcgi/hpaste.fcgi/view?id=29685#a29685
/usr/share/vim/vimfiles/archlinux.vim http://hpaste.org/fastcgi/hpaste.fcgi/view?id=29686#a29686
This seems to be common problem caused by the "system" vimrc in some distributions setting filetype on before you set up pathogen. So turning it off and back on again forces plugins to load correctly:
call pathogen#runtime_append_all_bundles()
filetype off
syntax on
filetype plugin indent on
More info here.
I was having a similar problem. Pathogen was loading some of my plugins while not all of them.
After some fiddling and wondering I discovered (I don't know if it's mentioned in the documentation) that in each bundle/'plugin_name' folder, there should be another folder called plugin that contains the *.vim file.
Then, when vim starts will look, not in bundle, but in those folders within bundle that contain a folder called plugin... and will create other folders (in each plugin folder).
So, if the plugin is just a .vim file make a folder for it...
instead of:
~/.vim/bundle/vimexplorer/vimExplorer.vim
you need:
~/.vim/bundle/vimexplorer/plugin/vimExplorer.vim
And everything works like a charm.
I've had problems loading particular plugins: specifically, plugins with a plugin subdirectory. For example, on a fresh MacVim install, a plugin in ~/.vim/bundle/surround/plugin/surround.vim wasn't being loaded, even though ~/.vim/bundle/surround appeared in the output of :scriptnames.
The problem was that I was loading Pathogen in .gvimrc, not .vimrc. For whatever reason, stuff in .vim/bundle/*/plugin subdirectories won't load if you do that, so do it in .vimrc!
I've opened an issue on github—I don't know if it can be made to work even if it loads from .gvimrc, but there should at least be some sort of warning in the documentation for idiots like me.
If your .vim is based on a git repo and submodules, DO REMEMBER to run git submodule init and git submodule update after cloning the repo. i.e.
git submodule init
git submodule update
I had the same error and tried all of the above, but it didn't work. Until I initialized and updated the git submodules.
Hope this helps for anyone who has a similar error.
Maybe Arch's default vimrc (possibly /etc/vim/vimrc) doesn't play well with Pathogen. Try starting Vim without loading config files:
vim -u NONE
and then load your vimrc from within vim:
:so ~/.vimrc
Do the plugins work then?
Fixed by (mattn & tpope) after raising issue via github
set nocp
call pathogen#infect()
syntax on
filetype plugin indent on
call pathogen#infect()
see https://github.com/tpope/vim-pathogen/issues/50#issuecomment-3137909
My environment is Vim 7.3.35 and Ubuntu 11.04.
I spent some time trying to resolve it. I clone the project https://github.com:r00k/dotfiles and follow the instructions to install.
When started vi a got the so commented
E117: Unknown function: pathogen#runtime_append_all_bundles
and the solution:
filetype off
call pathogen#runtime_append_all_bundles()
filetype on
did not work.
I found the .vim symlink in my home directory where no properly set. The install script made a .vim DIRECTORY with a symlink vim inside of it pointing to my .dotfiles/vim. The solution was to delete the .vim directory and make a symlink .vim pointing .dotfiles/vim.
A kept the filetype off/on in my .vimrc also.
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
Try to check your runtime path using command:
:set runtimepath?
First entry should be something like ~/.vim.
My problem with not loading plugins/pathogen was that i placed my vim environment in ~/.dotfiles/vim where my vimrc and rest of the stuff (plugins etc.) lives.
After creating symlink to ~/.dotfiles/vim/vimrc in ~/.vimrc i forgot to make second symlink ~/.vim -> ~/.dotfiles/vim/ which caused vim to be confused cause he was looking for stuff in ~/.vim (default). After i made proper symlink everything poped in right place.
I hope it will help someone who forgot about second symlink like I did ;-)
Instead of call pathogen#runtime_append_all_bundles(), I used call pathogen#infect('~/.vim/bundle') and it worked for me.
I was having the same problem with Ubuntu. The log was:
linha 4: executando "/usr/share/vim/vim73/ftoff.vim"
Erro detectado ao processar /usr/share/vim/vim73/ftoff.vim:
linha 11:
E216: Grupo ou evento inexistente: filetypedetect *
fim da execução de /usr/share/vim/vim73/ftoff.vim
The solution was to add "\n"s at the end from file /usr/share/vim/vim73/ftoff.vim to execute it properly.
set nocp
call pathogen#infect()
syntax on
filetype plugin indent on
call pathogen#infect()
The above helped me fix the issue, can't leave a comment on other peoples however thank you for posting the code above.
I have it in mine as:
silent! call pathogen#runtime_append_all_bundles()
After spending waaaay too long trying to solve this problem with nerd-commenter/pathogen, I broke down and just used Debian's OS provided nerd-commenter plugin:
vim-addons install nerd-commenter
If you're on Debian and need to get back to work, try it out. You probably need "vim-addon-manager" and "vim-scripts" packages installed from apt if you don't have it already.
In my case I cloned to a folder ~/dotfiles but vun looks for a folder ~/.vim, as a result he carried no plugins or color schemes to solve the problem I did this:
ln -s ~/.dotfiles ~/.vim
I had the same problem. I tried every possible combination.
Finally I found that if I use mksession to save my Vim workspace and have it load on Vim startup, it made pathogen not load new plugins I put into the bundle folder.
After installing a new plugin I now always delete my session file and start Vim fresh and every plugin loads fine.
filetype off
set nocompatible
set laststatus=2
execute pathogen#infect()
syntax on
filetype plugin indent on
For the sake of completion I'll add my solution for this problem.
I just renamed my ~/.gvimrc file to ~/.vimrc, and all my problems were solved. I literally copied my .vim and my .gvimrc from linux and did this change and everything works as expected.
I was facing the same issue, finally after lot of google and tweaking the vimrc file, found the solution. Hope the following code snippet would resolve the issue.
set nocp
source /home/ameet/.vim/autoload/pathogen.vim "location of my pathogen.vim
call pathogen#infect()
call pathogen#helptags()
i had the same problem , solved by copying this file into ~/.vim/autoload:
https://github.com/sontek/dotfiles/blob/master/_vim/autoload/pathogen.vim

Resources