3

For example, if I execute the following command from the terminal:

vim -c PluginList

this command opens vim and lists my currently installed plugins. How do I execute the above command but redirect the output to my terminal?

muru
  • 24,838
  • 8
  • 82
  • 143

2 Answers2

5

Since you appear to be using Vundle, you could simply grep your vimrc:

$ grep -c Plugin ~/.vimrc
romainl
  • 40,486
  • 5
  • 85
  • 117
0

EDIT: modified original answer to keep only the finished script version.

For future reference to people browsing this question, here's a solution to the original question that will work even if Vundle is not being used with vim (longer than @romainl's answer that does require Vundle, which seems to be fine for the OP).

The following script assumes a standard unix-like environment with access to common utilities such as sed, sort and mktemp. Just paste into somefile in your $path, then chmod +x somefile and execute somefile on the command line.

#!/bin/bash
tmp=$(mktemp)
vim +"help local-additions" +"sav! $tmp" +"qall"
sed '1,/LOCAL ADDITIONS/d' $tmp | sed '/^$/,$d' | sortj
rm $tmp

Here's an example of output when invoking this script from the command-line:

|bufkill.txt|  Manage buffer display upon removal of current buffer   
|fugitive.txt|  A Git wrapper so awesome, it should be illegal 
|matchit.txt|   Extended "%" matching
|now.txt|           A pure vim minimalistic personal wiki 
|recover.vim|   Show differences for recovered files
|sneak.txt|  motion improved - Version 1.7.2
|snipMate.txt|  Plugin for using TextMate-style snippets in Vim.
|startify.txt|  The fancy start screen.
|surround.txt|  Plugin for deleting, changing, and adding "surroundings"
|undotree.txt|  Display your undo history in a graph
|vimux.txt|   easily interact with tmux

Note that it will miss any plugins that don't have a proper vim help file (in the .doc/ subdirectory of the plugin).

Dalker
  • 455
  • 2
  • 10