Let's say I have these variables defined in my bashrc
:
i='cgi-bin/internal';
e='cgi-bin/external';
f='cgi-bin/foo';
b='cgi-bin/bar';
ad='cgi-bin/admin';
#etc...
When I use the variable on the command line vim $i/edit_
TAB it will expand the variable and the input on the command line becomes vim /www/productX/subdomain_x/cgi-bin/internal/edit_
(respective to whatever site I'm on) and then I TABTAB to get the possible completions.
That's fine, the functionality isn't the problem. It's just that it can get annoying to see the full path every time rather than just the value of the variable.
Is there a way to not expand the bash variables on the command line without compromising functionality?
Is it the bash completion that's doing this?
The desired outcome would be $i
not expanding to it's value (visually) or $i
expanding to a relative path rather than the full path.
shell-expand-line
(Ctrl-Alt-e) orcomplete-variable
(Alt-$). Do you have Ctrl-i (or Esc-Esc) bound differently than the default? What is the result ofbind -p|grep ' complete$'
? – Cassiteritebind -p|grep ' complete$'
? If$i
contains "cgi-bin/internal/" where does "/www/productX/subdomain_x/" come from? – Cassiterite"\C-i": complete "\e\e": complete
<br> current working directory is something like "/www/productX/subdomain_x/". so if I'm going to vim a file and <TAB> to complete the file name it will expand to "vim /www/productX/subdomain_x/cgi-bin/internal/edit_filename.cgi" instead of just "vim cgi-bin/internal/edit_filename.cgi" as I might expect. – Leggettvim
completion function installed. What doescomplete -p vim
give you? – Cassiteritealias vim
show anything? What doesecho $i[tab][tab]
do? – Cassiterite$COMP_WORDBREAKS
like this:COMP_WORDBREAKS=$COMP_WORDBREAKS/
and that would prevent the variable before the slash from being expanded, but it also wouldn't use its value for the completion. I looked at usingbind
to create a keyboard macro, but if it's even possible it would be extremely complex. Sorry. – Cassiterite