I've installed Syntastic with Pathogen, and tried just about all I can think of to get Syntastic to recognize my pylint checker.
Pylint checker is installed here
/home/myself/.local/bin/pylint
I echoed my path and
/home/myself/.local/bin
is indeed in the $PATH variable.
My .vimrc looks like this
set tabstop=4
execute pathogen#infect()
syntax on
filetype plugin indent on
let g:syntastic_mode_map = { 'mode': 'passive',
\ 'active_filetypes': ['python'],
\ 'passive_filetypes': ['perl'] }
let g:syntastic_python_checkers = ['pylint', 'python']
and yet when I run the command
SyntasticInfo
inside vim, I still see
Syntastic: passive mode enabled
Syntastic version: 3.4.0-79
Info for filetype:
Available checker(s):
Currently enabled checker(s):
Spent a good while searching google for this, does anyone have a clue as to what I have forgotten?
EDIT/ANSWER:
In case anyone else needs help with something like this, doing
:setfiletype python
appeared to get things right.
Had similar issues with the filetype plugins, weirdly but this helped:
filetype off " <<< this line
filetype plugin indent on
syntax on
Related
Every time I write a new python source code *.py, the following error message comes up:
Error detected while processing BufRead Auto commands for"*.py":
E518:Unknow option:set
E28:No such highlight group name: BadWhitespace
How can I fix it?
Before I typed this question , I modified my _vimrc file according to this post, but the error message remains. Even worse another error message occurs as well:
The ycmd server SHUT DOWN(restart with':YcmRestartSever').YCM core library not detected;you need to compile YCM before using it. Follow the instructions in the documentation.
I am a new Gvim user and I use gVim 8.0 in Windows 10. I set up my python development environment by searching the Internet and I installed the YouCompleteMe plugin via Vundle but It is too difficult for me to compile YCM myself now.
for error like
Error detected while processing BufRead Auto commands for"*.py":
E518:Unknow option:set
E28:No such highlight group name: BadWhitespace
add | to end of set xxx
au BufNewFile,BufRead *.js,*.html,*.css,*.vue
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
set
"Flagging Unnecessary Whitespace
highlight BadWhitespace ctermbg=red guibg=darkred
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
YCM depends on ycmd to do actual work. ycmd is a compiled service running in the background so you have to compile it to make it work.
The basic installation procedure consists of opening a shell / command line for your OS, cd-ing to YouCompleteMe's vim plugin directory and running ./install.py there to compile it. If you need it for languages other than Python, run ./install.py --help and look up any additional flags you need to add to turn on support for the languages you want to use.
The above assumes you have read YCM's installation guide and have installed the required dependencies. There are two guides relevant to your case and they are rather detailed and clearly written:
Windows installation guide (provided on a best-case basis)
Full installation guide (to resolve any problems if the former doesn't work)
I'm using gvim and following the windows setup steps of vundle:
https://github.com/gmarik/Vundle.vim/wiki/Vundle-for-Windows
After the steps, I found the nerdtree plugin is successfully installed, I can find it under ~/vimfiles/bundle.
And I customize the _vimrc file like below:
set rtp+=~/vimfiles/bundle/Vundle.vim/
let path='~/vimfiles/bundle'
call vundle#begin(path)
Plugin 'scrooloose/nerdtree'
So I restarted gvim, and type :NERDTree, the editor is raising the error:E492 Not and editor command: NERDTree
What I'm doing wrong here?
You need to have a call vundle#end() after all your plugin declarations for vundle to actually modify your runtime path.
I was trying to add the functionality that a plugin in vim statically analyses my current go (golang) file and catches errors.
What I tried was doing the instructions in the readme.txt file in $GOROOT/misc/vim. There it had the following suggestion:
Vim compiler plugin
-------------------
To install the compiler plugin:
1. Same as 1 above.
2. Copy or link compiler/go.vim to the compiler directory underneath your vim
runtime directory (normally $HOME/.vim/compiler).
3. Activate the compiler plugin with ":compiler go". To always enable the
compiler plugin in Go source files add an autocommand to your .vimrc file
(normally $HOME/.vimrc):
autocmd FileType go compiler go
Godoc plugin
------------
I did all they said but:
autocmd FileType go compiler go
doesn't do anything when I save my file. What is it supposed to do? I clearly have errors in my code:
package main
import "fmt"
//This is my first go program!
//cool hu? Hope I can render this.
func main(){
jhjkahsdjkh //<-----------------ERROR HERE
fmt.Print("Hello World\n")
}
I don't know what to expect cuz I don't know what autocmd FileType go compiler go is supposed to do.
This is how my vim file looks like:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
Plugin 'user/L9', {'name': 'newL9'}
Plugin 'commentary.vim'
"Plugin 'fatih/vim-go'
"Plugin 'Syntastic'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
""""------------------------------------
syntax on
" filetype plugin on
" filetype indent on
autocmd FileType go compiler go
" autocmd FileType go autocmd BufWritePre <buffer> Fmt
I also tried this by installing 'fatih/vim-go' plugin and doing the command :GoBuild. That kind of worked, but instead of pointing me to my errors in the current file in went to other files in other packages to that are in development and obviously have errors, but I don't want to see those, I only want to see the errors in my current file. Is there a plugin that does this? Is there a way for my vim to do this on save or something?
autocmd FileType go compiler go
only tells Vim what compiler and settings to use when doing :make. You can read about :compiler in :help :compiler and the linked :help write-compiler-plugin.
If you want Vim to show errors in your code, you need to issue the :make command.
Note that the Syntastic plugin, that's commented in your ~/.vimrc, comes with Go support and does its magic on write.
It looks like you are installing quite a lot of go-related plugins and, possibly, making your life more complicated than it should.
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
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.