View previous topic :: View next topic |
Author |
Message |
nelsooon n00b

Joined: 08 Aug 2004 Posts: 66
|
Posted: Mon Jul 01, 2013 2:49 pm Post subject: Bash completion for directories |
|
|
Hello all,
I am using guake terminal.
Is there a way to perform a bash completion for folders when doing a "cd [tab]".
Actually it prints all files that are present in the pointed directory.
I've already :
- put bash-completion in USE flags of /etc/make.conf
- emerged bash-completion and gentoo-bashcomp
- eselect bashcomp enable gentoo (and even all completion possibilities by doing : for i in $(ls --color=no /usr/share/bash-completion/); do ln -s /usr/share/bash-completion/$i /etc/bash_completion.d/$i; done)
- and source /etc/bash/bashrc
Thank you for your help
nelson |
|
Back to top |
|
 |
labo n00b

Joined: 29 Jul 2013 Posts: 1
|
Posted: Mon Jul 29, 2013 10:04 am Post subject: |
|
|
Have you tried the following?
Code: | eselect bashcomp enable [--global] base
source /etc/profile |
|
|
Back to top |
|
 |
pjp Administrator


Joined: 16 Apr 2002 Posts: 17128
|
Posted: Mon Jul 29, 2013 4:00 pm Post subject: |
|
|
Moved from Documentation, Tips & Tricks to Off the Wall. _________________ I can saw a woman in two, but you won't want to look in the box when I'm through.
For my next trick, I'll need a volunteer. |
|
Back to top |
|
 |
Naib Watchman


Joined: 21 May 2004 Posts: 5272 Location: Removed by Neddy
|
Posted: Mon Jul 29, 2013 4:12 pm Post subject: |
|
|
shouldn't this be other things gentoo since it is gentoo related? _________________ The best argument against democracy is a five-minute conversation with the average voter
Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king |
|
Back to top |
|
 |
Bigun Advocate


Joined: 21 Sep 2003 Posts: 2088
|
Posted: Mon Jul 29, 2013 5:04 pm Post subject: |
|
|
Naib wrote: | shouldn't this be other things gentoo since it is gentoo related? |
++
All this will add is unnecessary dick jokes. _________________ "It's ok, they might have guns but we have flowers." - Perpetual Victim |
|
Back to top |
|
 |
GabrielYYZ n00b


Joined: 03 May 2012 Posts: 24 Location: Dominican Republic
|
Posted: Tue Jul 30, 2013 12:27 am Post subject: |
|
|
Bigun wrote: | Naib wrote: | shouldn't this be other things gentoo since it is gentoo related? |
++
All this will add is unnecessary dick jokes. |
In the context of this thread, they might be inappropriate, but there is no such thing as an unnecessary dick joke.  |
|
Back to top |
|
 |
Bones McCracker Veteran


Joined: 14 Mar 2006 Posts: 1605 Location: U.S.A.
|
Posted: Tue Jul 30, 2013 1:06 am Post subject: |
|
|
There's no way that I know of, but is it really too hard to type the first letter or two of the directory name before pressing tab? I mean, just how lazy do you want to be?  _________________
patrix_neo wrote: | The human thought: I cannot win.
The ratbrain in me : I can only go forward and that's it. |
|
|
Back to top |
|
 |
pjp Administrator


Joined: 16 Apr 2002 Posts: 17128
|
Posted: Tue Jul 30, 2013 2:54 am Post subject: |
|
|
Moved from Off the Wall to Other Things Gentoo.
Didn't notice the Gentoo reference earlier. _________________ I can saw a woman in two, but you won't want to look in the box when I'm through.
For my next trick, I'll need a volunteer. |
|
Back to top |
|
 |
dmpogo Advocate

Joined: 02 Sep 2004 Posts: 2420 Location: Canada
|
Posted: Tue Jul 30, 2013 2:59 am Post subject: |
|
|
BoneKracker wrote: | There's no way that I know of, but is it really too hard to type the first letter or two of the directory name before pressing tab? I mean, just how lazy do you want to be?  |
Hm, what if you do not know it ? It would be logical to have cd <TAB> to show list of subdirectories in the current directory |
|
Back to top |
|
 |
mv Watchman


Joined: 20 Apr 2005 Posts: 5967
|
Posted: Tue Jul 30, 2013 9:14 am Post subject: |
|
|
First of all: Switch to zsh. Its completion system (once properly setup and activated) is way better than what bash ever will perform.
That being said, IIRC the bash-completion script had some support for cd, pushd etc, but I remember that I had written my own function for that since the bash-completion script did more than I wanted. (Of course, I did this before I learnt to know zsh.)
Thus, I conjecture that your problem is actually related with the recent change of the ebuild in the bash-completion package which now has to be activated differently and which was apparently not documented sufficiently: Look for other threads (or in the gentoo-user mailing list) and the bugs mentioned in the ChangeLog how to do it now. (Since I am not using bash ineractively anymore, I did not remember the details.) |
|
Back to top |
|
 |
defer- Tux's lil' helper


Joined: 11 Jun 2007 Posts: 140 Location: Finland
|
Posted: Tue Jul 30, 2013 10:42 am Post subject: |
|
|
mv wrote: | First of all: Switch to zsh. Its completion system (once properly setup and activated) is way better than what bash ever will perform. |
Is it hard to setup and get used to zsh? Is there really much difference? Does my .bashrc aliases/PS1, bash scripts and stuff like that work easily? _________________ https://github.com/defer- |
|
Back to top |
|
 |
truc Advocate


Joined: 25 Jul 2005 Posts: 3199
|
Posted: Tue Jul 30, 2013 12:58 pm Post subject: |
|
|
hehe,
<off>forget zsh, you want to use bash because it's almost as complete as zsh (oh well, almost almost...) and especially because it uses readline that you, poweruser, already know how to use extensively! </off>
To enable directory completion for cd, I have this: _________________ The End of the Internet! |
|
Back to top |
|
 |
mv Watchman


Joined: 20 Apr 2005 Posts: 5967
|
Posted: Wed Jul 31, 2013 9:01 am Post subject: OT: zsh |
|
|
defer- wrote: | Is it hard to setup and get used to zsh? Is there really much difference? |
In the default, zsh is almost as poor as bash, but setting up more features will show you more and more (useful) differences, especially for interactive usage.
For a quick start, you might want to install zshrc-mv from the mv overlay which sets up many things (I suggest to install also the other packages which the ebuild recommends). Try to see if it works by pressing
(or cd instead of ls) which acts similarly as in bash - just that the shown completions are colored according to your /etc/DIR_COLORS. You see the first magic if you press [Tab] a third time and use your cursor keys. Or if you press
If you work longer with zsh you will learn useful features like empty commands
inline aliases
(The alias LESS from zshrc-mv contains redirection from stderr and stdin), extended globbing
shortcuts for loops
Code: | for i in *; echo $i |
etc. pp.
Quote: | Does my .bashrc aliases/PS1, bash scripts and stuff like that work easily? |
zsh has a bash emulation mode so that your .bashrc aliases and functions work probably out-of-the-box if you source it in that mode (for a starters, you can try to define interactive=~/.bashrc in the beginning of /etc/zsh/zshrc). Practically the only thing which is not properly emulated is which must be written in the more compatible way
The PS1-escape sequences in zsh are much more powerful than in bash but not compatible, so the same PS1-value as in bash will probably not look like you want. (However, e.g. set_prompt from the mv overlay can produce reasonable prompts for bash and zsh and is automatically used if you use zshrc-mv.) |
|
Back to top |
|
 |
|