I want to break down my vimrc in diffrent components. I manage my vim Plugins with Vundle and I want to have one file per plugin that tells vundle to manage it and to set configuration like this:
vundle.vim:
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"Plugin in here:
Plugin 'gmarik/Vundle.vim'
call vundle#end()
filetype plugin indent on
"Plugin Options:
and
syntastic.vim:
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"Plugin in here:
Plugin 'scrooloose/syntastic'
call vundle#end()
filetype plugin indent on
"Plugin Options:
" - Python:
let g:syntastic_python_checkers = ['pylint', 'flake8']
let g:syntastic_aggregate_errors = 1
and so on.
If I now call this vimrc:
source vundle.vim
source syntastic.vim
only the last Plugin shows up in vundles Plugin list, other configurations are read though.
I guess, vundle calls the 'vundle#begin()'/'vundle#end()' part only upon call (:PluginXXX) and therefore only returns the content of the file last sourced.
How can I solve this problem?
Can I use something like
PLUGINS = "Plugin gmarik/vundle"
PLUGINS = $PLUGINS + "Plugin scrooloose/syntastic"
...
and call
vundle#begin()
$PLUGINS
vundle#end()
in my vimrc?
If so, what is the syntax for vim variables?
~/.vimrc:
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
runtime! config/*.vim
call vundle#end()
filetype plugin indent on
...
~/.vim/config/syntastic.vim
Plugin 'scrooloose/syntastic'
let g:syntastic_python_checkers = ['pylint', 'flake8']
let g:syntastic_aggregate_errors = 1
...
And so on. But that's IMO a lot of work for zero benefit.
I ended up with this:
set nocompatible
filetype off
set rtp+=~/.nvim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'rking/ag.vim'
...
call vundle#end()
filetype plugin indent on
runtime! vundle/*.vim
Which means I get the performance of vundle#begin() and vundle#end() combined with the modularity of having settings for each plugin in their own file. This setup gave the unexpected advantage of having less plugin files to manage, i.e., the Plugin one-liners. Now the only plugin, .vim, files I have are the ones with additional configuration.
The disadvantage of this setup is I have to remove the plugin from two places.
The advantages are: increased performance; you still have fairly modular plugin settings, making them easier to add and remove.
Related
I have this in my config file:
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'helino/vim-nasm'
Plugin 'elixir-lang/vim-elixir'
Plugin 'powerline/powerline'
call vundle#end()
And then I did this:
:source %
:PluginInstall
But the plugin powerline is still not installed, it's not visible.
https://github.com/powerline/powerline
Powerline only display when plugin like NERDtree is active. If you want to display it every time add this line to your .vimrc file.
set laststatus=2
I was trying to install vim plugins but it always doesn't work. Here is my .vimrc:
set nocompatible
filetype off
" set up Vundle
" let Vundle manage Vundle
" required!
set rtp+=~/.vim/bundle/Vundle.vim
"plugins list
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'klen/python-mode'
Plugin 'scrooloose/nerdtree'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
Plugin 'jalvesaq/R-Vim-runtime'
call vundle#end()
filetype plugin indent on
syntax enable
syntax on
And when I ran :PluginInstall, only VundleVim/Vundle.vim was installed (see below). I have tried many ways that I can find online but still can't fix it. Any suggestions?
I had the same issue, vim into ~/.vimrc and run :source % and then :PluginInstall worked for me.
I'm on mac os Big Sur, vundle will only instal itself if I type :PluginInstall after edit and saved .vimrc.
:source % or :so % worked for me!
I am using Vim with cscope, ctags and TagList.
When I open a file with just using vim. I am able to use TagList but when I open a file using cscope, there comes error as:
Error detected while processing /gauravg/.vimrc:
line 9:
E492: Not an editor command: Bundle 'VundleVim/Vundle.vim'
line 13:
E492: Not an editor command: Plugin 'plugin/taglist.vim'
Press ENTER or type command to continue
Below is my .vimrc file:
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
" required!
Bundle 'VundleVim/Vundle.vim'
call vundle#end()
"Plugin 'tpope/vim-fugitive'
"Plugin 'steffanc/cscopemaps.vim'
Plugin 'plugin/taglist.vim'
Please help me to resolve this issue.
You should use Plugin instead of Bundle for:
Bundle 'VundleVim/Vundle.vim'
Also, all of your plugins must be added before:
call vundle#end()
See the Quick Start of Vundle for more information.
This .vimrc should work:
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'VundleVim/Vundle.vim'
"Plugin 'tpope/vim-fugitive'
"Plugin 'steffanc/cscopemaps.vim'
Plugin 'plugin/taglist.vim'
" All of your Plugins must be added before the following line
call vundle#end()
filetype plugin indent on
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 installed Vundle to my /Users/name directory (ie /Users/name/.vim/bundle/Vundle.vim) a while ago, and set up a .vimrc file in my root directory which has the following:
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Bundle 'daylerees/colour-schemes', { "rtp": "vim/" }
colorscheme frontier
call vundle#end()
filetype plugin indent on
I ran :PluginInstall as suggested and it says everything has been installed, but I get a "color scheme frontier not found" error everytime I open vim.
This is as far as I've done, am I missing any steps?
Add the following line after the filetype line:
syntax on
And move your colorscheme frontier line anywhere after the call vundle#end() line.
I think you might be mixing the old and new Vundle syntaxes. Instead of
Bundle 'daylerees/colour-schemes', { "rtp": "vim/" }
try
Plugin 'daylerees/colour-schemes', { 'rtp': 'vim/' }
Note the use of single quotes instead of double quotes.