help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Current working directory echoed to the terminal


From: Chris Jones
Subject: Re: [Help-bash] Current working directory echoed to the terminal
Date: Mon, 16 Apr 2012 17:02:46 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon, Apr 16, 2012 at 08:27:36AM EDT, Greg Wooledge wrote:
> On Sun, Apr 15, 2012 at 12:37:01AM -0400, Chris Jones wrote:

> > I just want to be able to issue single shell commands from Vim as if
> > I was at the bash prompt. This means everything that's available at
> > the shell prompt, including aliases and functions. 

> Another approach would be to convert all your aliases to functions, and
> then export them through the environment.  As long as vim escapes to
> bash and not sh, your functions will be inherited.

For the record, issuing the following commands¹ prior to starting Vim
confirms that it works:

| $ func=$(grep -v '^ ' .bash_functions/functions | grep -v '^#' | grep -v '^}' 
| grep -v '^$')
| $ names=$(echo "$func" | cat -vte | cut -d '(' -f 1)
| $ for n in $names; do echo $n; declare -fx $n; sleep 1; done
| $ vim ...

Or to get a list of the functions that are active in the parent shell
session rather than read them from a file:

| $ func=$(declare -F)
| $ ... etc.

With BASH_ENV unset, I was still able to invoke my functions from the
Vim command line.

Not sure about converting aliases to functions on a permanent basis. 

But I guess I could do the conversion on the fly before I export them.

I'll look into writing a Vim script that does this at startup..

Thanks,

CJ

¹ e.g... from my bash history.

-- 
Oh My God!!! Linda is back!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]