How to manage the plugin managers in VIM? - vim

I know it may sound silly, but I am curious to find out if there is a framework already in place to help VIM users manage their plugin managers.
So, I know that there are plugins like "Vundle", "Pathogen" and "Neobundle" etc. for this purpose. I have been looking in those tools for the last couple of days. And they are great. My question is, are there any higher-level scripts designed to streamline the plugin loading process utilising any of the above mentioned plugin managers.
All the "Bundle Managers" have internal functions provided for unloading and loading plugins, manipulating RTP etc. Just wanted to check before going and starting to write my own vim script.
I am mainly interested in hearing about techniques using "Neobundle". I know that "janus" is doing exactly what I am asking for. It runs it's own functions to create plugin groups and access pathogen functions. So it is a bit like a front-end for pathogen.
A nice case would be:
Let's assume that you have installed plugins "A", "B", "C" and "D" using "Neobundle", however you would like to disable plugin "B" at start-up. But then enable it later. Everytime you will have to go into your .vimrc and comment out (or in) that line which is responsible for loading plugin "B"? or run the "Neobundle" function responsible for unloading that specific plugin?
Is there a more elegant way to do this?
Thanks.

Do you have that many badly written plugins that you need not one but two freaking levels of abstraction for "managing" them?
Anyway, I don't think there is one real "super manager" because there's no such thing as a unified plugin management API in the first place and… the lack of such an API is probably the reason why there are so many variations on the same theme.
Because Pathogen was the first in that series (there are older attempts like the built-in GLVS, yeah, no one knows about it…) and stayed alone for a while, the only thing that seems to be "standard" is the bundle directory. IMO, that would make a weak starting point.
I've seen a few Pathogen frontends attempts in the past, though, so there's a "chance" that progress is coming in this field.
microbe
pandemic
There are others, browse r/vim for an hour and you will find many…

Any modern (i.e. Vim 7.x), well-written plugin should only define its mappings and commands in the plugin script, and load its functionality on-demand via the autoload mechanism. Functionality that is specific to a particular filetype should only apply there via ftplugin scripts.
Unless you do crazy stuff like having the same mappings for two then mutually exclusive plugins, I don't see a need to dynamically enable / disable plugins. Don't make things more complex than they have to be. If you really have two disjunct editing use cases, I'd rather create two separate ~/.vimrc files and aliases to use them.

Related

How to use pathogen and Vundle at the same time with vim?

I'm a vim newbie setting up some plugins. Some recommend installation via Vundle, others via pathogen. Is it possible to use both package managers at the same time in this circumstance? If so, is it just a matter of installing both and installing the relevant plugins according to their normal instructions, and nothing will conflict? Or do I have to do something special to make this work?
TL;DR: You don't need both; Vundle includes the Pathogen functionality (and more)
The Pathogen plugin just automatically extends your 'runtimepath' (locations where Vim searches for plugins) to include all subdirectories in ~/.vim/bundle/. This is simple, but allows to separate each plugin into a dedicated tree, making updates (e.g. via Git) and removals simpler.
Other plugins have built upon that idea and extended it with automatic download, installation, and updating, usually via some Plug foo/bar commands in your ~/.vimrc. As they need the same separation as provided by Pathogen, such implementation usually is included in them. (The core is just a one-liner, not much of a deal.)
You don't actually need any package manager; I personally use 100+ plugins without one. It's a matter of how often you use new machines with Vim (the central configuration and installation capabilities certainly make bootstrapping easier), and how often you update / try out new plugins. If you just use one or two systems, and are conservative in the number and update frequency of plugins, putting everything into ~/.vim/ might also work for you. (This is just to avoid that you're intimidated by those package managers; try them out, and use one if you like it.)

Vi / Vim for project of more than a few files

I typically use an ide for large projects and vi for small single file scripts temporary files etc.
Lately I have heard of people using vi for larger projects too - actually, quite defensive and particular proud to do so.
I have tried, but i found it very cumbersome. Do any other programmers here use vi for and medium - large projects? If so, are there any tips/tricks you can offer for navigating source, looking at multiple files etc?
I have tried using tmux to see if it made things easier - but it still felt quite cumbersome
There is no magical tool that can make everything perfect. Vim is an editor, and it's pretty good at it, but it's not and will never be an IDE.
There used to be the pida project that made an IDE around vim, for better interaction when using python, but it got abandonned.
There is eclim which is a really neat tool that can use eclipse as a backend IDE accessible in a few keystrokes from within vim, while having all the power of eclipse for tagging, refactoring, debugging etc.. But you have to want running eclipse in background, which is like hiding an elephant under the carpet...
There are many little plugins you may want to use, and I'm pretty sure everyone has his favorite set of plugins, that helps navigate easily in the code and help tagging (like fugitive, nerdtree, etc..)
Finally, there is vim, a shell and that's all. Vim does a lot of things correctly, like navigating in the source, launching compilations and parsing the errors etc.. And for what vim is not good at, you can use your shell, to execute, to do git stuff, to open more vim windows to edit code..
Anyway, there's no perfect answer to your question, and I bet your question will be closed because of being "non constructive".
What do you find cumbersome? What works for you? What doesn't? What kind of feature do you need to be able to work efficiently with multiple files? How many are multiple files anyway?
Some people use Vim for working on quite large projects: the Linux kernel, Firefox, Vim itself… I guess that you need to know Vim pretty well to pull that off but it's all very doable, even without many plugins.
But I tend to think "complexity" rather than "quantity".
When I work with "complex" languages+projects (quotes because it is all very subjective) I'll use a more suited IDE with a Vim-emulation plugin: Flash Builder+Vrapper for Actionscript 3, Eclipse+Vrapper (then) Android Studio+IdeaVim (now) for Android.
When I work with "simple" (quotes, again) languages+projects I'll use Vim: that's any project involving HTML/CSS/JavaScript/PHP, from 3 to 50+ files.
File/buffer navigation
Vim is very good at opening files (which sounds funny), even without plugins. :sp **/foo<Tab>, for example, is quick and easy. :Ex foo/bar as well.
Switching buffers is also very easy, if a bit awkward at first. :bn, :bN and :b <Tab> will get you a long way.
And if you don't like those built-in methods, you can create your own cool mappings or choose from many plugins.
"Semantic" navigation
I like to think about my project in class/method names rather than in file names. With an up-to-date tags file (generated with ctags or some compatible program), :tag foo is a very efficient way to move around, <C-]> jumps to the definition of the tag under the cursor and <C-w>} opens that definition in a small preview window. That's more than enough for my needs.
I don't particularly like them but you can also use TagBar or TagList to have something that resembles the class browser of your IDE.
I'd suggest you make your needs more clear and ask more specific questions or look around on SO. The subjects above are pretty well covered.
Just a few pointers: I like NERDTree and CtrlP for easy/powerful file navigation and splits for keeping several files visable and navigatable at the same time.

Using Sublime 2 for Haskell Development?

What is the current status of Sublime 2 integration for Haskell? I see two possible packages so far. A plugin for code highlighting and a REPL plugin.
Is there an intelli-sense plugin for Haskell?
Maybe integration with Hackage as well?
Thanks.
SublimeHaskell plugin is the modern choice for Haskell development with SublimeText. It is well maintained and has plenty of useful features.
Other quite useful plugins:
Shell Turtlestein, which allows you to quickly type in shell commands under a single keystroke from inside the editor.
SublimeREPL, which allows you to run GHCi from inside the editor. Though without support for cabal repl yet.
SideBarEnhancements, which I primarily use to rename/move files without touching the mouse. With it you can hit Ctrl/Cmd + P and type "rename" or "move" to enter the dialogue.
I use Sublime exclusively at the moment and while it's not all that special out of the box, installing sublime-text-haskell as Cubic suggested makes it a little better (it will compile and highlight errors when you save a file and apparently enhances the auto-completion).
I've experimented with writing my own plugins but the reality is that a lot of really cool possibilities are made difficult to implement because the API is actually kind of restricting (there's no way to add extra information like type signatures to auto-complete options for example).
It seems that the dev(s) are working on adding some requested API features, but until then, sublime-text-haskell is probably the best Haskell plugin.

Vim Plugin: Follow Symbol under Cursor

Is there a vim plugin that allows you to place the cursor over a function and have a plugin run a script that searchs a tag or some other entity for where that function is defined. Or perhaps it provides a list of places where that function is defined? Specifically I am looking for a C/C++ based plugin.
You want ctags, which supports many, many languages beyond C. It will show you the definition of the function or variable under the cursor.
cscope integrates nicely with Vim to do exactly that and more. Where a function is defined, where it is called etc. You may also need a tags with cscope.
The vim website hosts a lot of plugins, you might really want to look there. Also, you didn't really specify what languages you wanted this to apply to, so this is a very broad question (hard to find a real answer to this).
An alternative to your question is, instead of putting the lookup capability into vim, why not put in into something else that already has it? Why not eclipse? There's an eclipse plugin called vrapper that gives vim like functionality within eclipse. You can then use eclipse to do the referencing and lookup that you want to do, because it already has this supported for many languages.
Edit: wouldn't this solve it?
I think you wanted to know what it was that you had to do to be able to solve the problem, as though you knew the feature was there but not how to use it. That link explains it. If that is the solution to your problem, please remember to vote & check XD

Janus upgrade important functionality missing after upgrade

I just upgraded to the newest Janus and there are alot of things that I miss since December 2011 :(
For example when i entered :cd it changed to :ChangeDirectory and after changing the directory the nerdtree also updated. The same thing applies for :e which changes to :Edit
This is not anymore the case with the newest Janus.
Command-T is also not anymore available anymore. What is the easiest way to add Command-T as a plugin?
Greetings from Nepal and Thank you :)
First, what happens to you is the number one reason why using Janus (and other packages for Vim) is a terrible idea.
Instead of controlling your environment your are almost totally dependent on someone else's desiderata: because Janus's author appears to have decided against some of his previous choices and upgrading Janus is an "all or none" affair you are left in the cold with a Vim you don't understand or are not accustomed to.
You don't have to trust me but I assure you that the right way to customize Vim is to start with nothing fancy, do it yourself, little by little, without copying other people's entire vimrcs and try and install the plugins you like by yourself. Because you start from nothing and know what you add you'll never be in that kind of situation.
Second, whenever you upgrade something you owe it to yourself to review the changes before actually performing the upgrade. $ rake is easy, I must admit, but if you had taken a couple of minutes to look at Janus's Github page you would have seen that Command-T is not included anymore and replaced by CtrlP.
Third, Command-T is not and has never been a part of Janus. It's a separate project run by someone else that used to be included as a Git submodule. To install it, you need to download it separately and follow the instructions. Or add it yourself as a submodule.
Four, greetings from France, lucky bastard ;).
EDIT
To answer your comments…
I went through the TM > Vim transition myself. I started by trying to turn Vim into a TM clone but the whole idea was flawed in so many ways. Many of these flaws apply to Janus as well, IMO.
You have too many custom "mac-like" mappings that seem to make your life easier because they don't require you to learn new shortcuts. That's cool until you need to use Vim on a remote server via a terminal emulator which actively blocks many Ctrl- mappings, doesn't make the difference between Ctrl+Shift and Ctrl and don't even register the Cmd key.
If your vimrc is well organised (and it is, more or less, in Janus) your <D-> custom mappings won't be activated when not in MacVim but you'll end up with two sets of custom mappings to learn and maintain! What if Janus's author decides one day that he prefers <leader>x to jump to tab x instead of the current <D-x>/<C-x>? Are you going to unlearn the previous mappings? Are you going to modify Janus's mappings.vim to get the old mappings back?
Why not learn and use Vim's native commands instead? 2gt is easy and will likely work on every Vim you'll ever come across.
You grow accustomed and dependent to too many plugins, some of them not doing much more than native commands or even overlaping each other like the current Buffergator and CtrlP.
Customizing Vim is a great way to learn how to use it. It takes time, maybe, but the win is big.
ENDEDIT

Resources