About: Testing Vim variables from the shell   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

More generally, the question can be stated as, "Is such-and-such-plugin already loaded for this user?" In Bash, I was able to come up with the following command to check for the existence of the g:loaded_pathogen variable. Unfortunately, the command did not seem to work in C Shell, so I had to wrap it in a small script. #!/bin/bash vim -c ':exec ":silent !echo ".exists("g:loaded_pathogen") | exec ":q!"' The script sends either 0 or 1 (plus mystery terminal control sequences) to stdout. I suspect there is a cleaner way to do this but, for now, this is all I've got:

AttributesValues
rdfs:label
  • Testing Vim variables from the shell
rdfs:comment
  • More generally, the question can be stated as, "Is such-and-such-plugin already loaded for this user?" In Bash, I was able to come up with the following command to check for the existence of the g:loaded_pathogen variable. Unfortunately, the command did not seem to work in C Shell, so I had to wrap it in a small script. #!/bin/bash vim -c ':exec ":silent !echo ".exists("g:loaded_pathogen") | exec ":q!"' The script sends either 0 or 1 (plus mystery terminal control sequences) to stdout. I suspect there is a cleaner way to do this but, for now, this is all I've got:
Version
  • 7(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 0(xsd:integer)
Category
  • Plugin
Text
  • pathogen.vim
Author
  • Moorecm
Subpage
  • /201203
Complexity
  • basic
Created
  • 2012-03-05(xsd:date)
ID
  • 0(xsd:integer)
  • 2332(xsd:integer)
NEXT
  • 0(xsd:integer)
abstract
  • More generally, the question can be stated as, "Is such-and-such-plugin already loaded for this user?" In Bash, I was able to come up with the following command to check for the existence of the g:loaded_pathogen variable. Unfortunately, the command did not seem to work in C Shell, so I had to wrap it in a small script. #!/bin/bash vim -c ':exec ":silent !echo ".exists("g:loaded_pathogen") | exec ":q!"' The script sends either 0 or 1 (plus mystery terminal control sequences) to stdout. Checking the value inside a script is a bit more difficult due to those pesky control sequences. Vim even detects that it is about to hose you and emits, a "Vim: Warning: Output is not to a terminal" message. Another problem that I have encountered occurs when the user's configuration loads plugins that contain errors. When this happens, it causes the "Press ENTER or type command to continue" prompt but it is no longer echoing to the terminal, so we can't see it. Piping in a few newline characters allows the process to continue rather than hanging. I suspect there is a cleaner way to do this but, for now, this is all I've got: #!/bin/bash # ...snip... PATHOGEN=`echo " " | vim -c ':exec ":silent !echo ".exists("g:loaded_pathogen") | exec ":q!"' 2>/dev/null` PATHOGEN=`echo $PATHOGEN | perl -pe 's/\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)//g' | col -b` if [[ $PATHOGEN == "1" ]] ; then # found it fi
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software