Is there any Vim plug-in that can show the file hierarchy? - vim

For folks who have used the Espresso editor, I'll love the right bar for showing the file hierarchy based on the tag nesting and open close. Is it possible in Vim?
I thought taglist was promising, but it's just too smart, it collects and categorize the class and method, but for me who want to know the file hierarchy to know the file structure need the basic feature like Espresso has.
Can taglist be used for this purpose?

Try this: Tagbar
Anyway "Groups tags according to the scope and display them" is in the Taglist plugin's todo :D.
This might be something off topic but I prefer Outline Unite plugin for this kind of functionality because it's integrated with Unite, so you can jump to the function you want by typing their name, and you don't have to keep the outline windows open all the time.

Try NERDTree. I don't know if you can integrate it with taglist, but it'll let you browse the file hierarchy. You can get it at vim.org or on github. Then you can open it with :NERDTree. An even better way to open it is to create a mapping like this
map <leader>t :NERDTreeToggle
Which, for me, toggles it with ,t, so you can keep it out of the way when you don't need it.

Related

Vim popup menu, like the omni autocomplete popup

I'm making a Vim Script. I want to make a popup that offers alternatives. It should work the same as the Omni-popup, but not replace the string or go through the omni functions. Like this:
I've haxxed in the functionality I need by using the completefunc and the auto command event CompleteDone, just to get the popup. But it's really ugly and messy, since I'm not using it for auto completion.
Is there a way to use this popup but with full control, not going through the omni-complete functionality? Like populating it with values and receive the value selected?
I know you can just place the alternatives in an other buffer and just grab the input from there. But it disturbs the work flow, I want a popup.
The insert mode popup menu is only meant for completions, as you've correctly found out. There is not other precedence for popup menus as a general selector in Vim, so such functionality is not there and is difficult to emulate. (In GVIM, one can populate a right mouse button popup menu, but this would need to be triggered by a mouse key press.)
The "Vim way" would be to :echo the list of menu items and query (via getchar() or input()), or just use confirm() or inputlist(). Examples built into Vim are the query in :tselect.
Plugins often use a split scratch buffer to build a more elaborate menu; this can even be combined with 'completefunc', as any text entry into the scratch buffer is discarded, anyway.
The FuzzyFinder - buffer/file/command/tag/etc explorer plugin uses this, and even provides an API for custom uses, cp. :help fuf-callbackitem-mode. That's certainly worth a look, though the menu would still be located at the top, not inside the current buffer.
Do either of these do what you want?
:help inputdialog()
:help inputlist()

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.

Change buffers in FakeVim

Does anyone know some shortcuts for FakeVim to change between files?
Is it possible to use buffers in Fake Vim? I accidentally found out that Ctrl+w,w gets you the next window. Does anyone know other? For example getting to the left, right, top, bottom windows?(vim's Ctrl+w,l and others)? Is there any documentation on FakeVim? Is it possible to configure FakeVim's vimrc file to create shortcuts for changing between buffers and the Projects view?
Thanks!
Recently I've been doing most of the changes on FakeVim plugin.
You can find list of Vim commands supported by FakeVim at https://github.com/hluk/FakeVim (recent version from Git master branch).
I'm still not sure how to document the features in Qt Creator. I'll probably implement something like :help <command> in near future.
The FakeVim documentation is severely lacking. This paragraph, for example, is so fuzzy it's borderline irresponsible:
In the FakeVim mode, most keystrokes in the main editor will be intercepted and interpreted in a way that resembles Vim. Documentation for Vim is not included in Qt Creator. For more information on using Vim, see Documentation on the Vim web site.
Basically, without a proper documentation or a look at the editor's source code it's impossible to know what should work, what shouldn't and in which way the behavior of what works deviates from Vim's behavior. And that's what passes for a modern IDE, these days.
Whatever…
I think that your best bet is simply trial and error: since you appear to know how to use Vim you'll have a lot of commands and shortcuts to try.

VIM VTreeExplorer plugin (IDE style browsing for VIM)

I've looked at a number of the IDE style file explorer / management plugins for VIM. The most popular one seems to be Project, but I've never got on well with it. Specifically, having to always create a .project file for the files you want to browse, and that changes to that file hierarchy outside of VIM are not picked up.
I stumbled across the VTreeExplorer plugin and I really like the way it works. I'm trying to work out how I can make it work in a more IDE style way, for instance, to always open vertically down the full length of my window, and once I've opened a file from it, it automatically hides the VTreeExplorer buffer again? Also, ideally it wouldn't show up when I use :bn or a buffer explorer to tab through each file buffer.
Any recommendations would be appreciated. Thanks!
What about NERDTree? It is really good, one of the best file tree plugin for vim available.

treelike structure plugin for vim

Does anyone know of some plugin for vim which would enable treelike note keeping organization like in many today's notekeeping applications. For example, something alike which would according to the tree on the left create another file in a directory structure to enable keeping several files together, under one tree, but still have them all at view.
Have a look at VimOutliner.
Quote from the website:
What is VimOutliner?
Vim Outliner is a vim plugin that
turns the powerful vim editor into a
powerful outliner of the likes of
GrandView, More and MaxThink. It is
keyboarder friendly and very fast. If
you can touchtype, you can outline as
fast as you think.
You can take a look at "DotOutlineTree : Helps you edit structured text".
http://www.vim.org/scripts/script.php?script_id=1225
"Viki/Deplate : A personal wiki for Vim"
http://www.vim.org/scripts/script.php?script_id=861
Here's a somewhat laborious way of taking notes in a treelike fashion all within vim:
http://www.youtube.com/watch?v=XPC3YQCID8k
You could just use NerdTree, http://www.vim.org/scripts/script.php?script_id=1658 - the "tree explorer plugin", which alone is useful anyway and work with files from then. Creating directories is as easy as :!mkdir directory.
The vimwiki plug-in has some nifty features for (nested) lists and checklists. And, of course, many more wiki-related features.
You should try voom plugin http://www.vim.org/scripts/script.php?script_id=2657
It is best.

Resources