You are not logged in.

#1 2019-09-16 18:42:41

8luesman
Member
From: Kathmandu, Nepal
Registered: 2019-09-10
Posts: 4

(SOLVED) Help regarding FZF-Bash configuration via .bashrc.

Hello folks,

I am a new user to this system as whole. Installed the system and up and running in no time with the excellent wiki and past Q&As.
With that out of the way, I am learning around my way into Bash scripting slowly. I installed this tool 'fzf' with pacman.

What I have done (& things I am aware of) -

1. Basically installed with Pacman.
2. I know the wiki wants me to source the files from /usr/share/fzf/.
3.  I see two files 'completion.bash' & 'keybindings.bash' there.
4. Checked out the Wiki and Bash docs to do it and scrounging in the internet for the answers - to no avail.
    - Putting this line in .bashrc
        - "source /usr/share/fzf/completion.bash & . /usr/share/fzf/key-bindings.bash"   

Any guidance will be highly appreciated.


Solution - I kept 'fi' as 'alias'. Changing that from 'fi' solve it.

Last edited by 8luesman (2019-09-16 20:35:47)

Offline

#2 2019-09-16 18:50:25

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 28,042
Website

Re: (SOLVED) Help regarding FZF-Bash configuration via .bashrc.

What, exactly, is your question?

The wiki entry is pretty unambiguous: source those two files from your .bashrc, eg.:

source /usr/share/fzf/key-bindings.bash

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2019-09-16 18:57:11

Swiggles
Member
Registered: 2014-08-02
Posts: 259

Re: (SOLVED) Help regarding FZF-Bash configuration via .bashrc.

As I understand the syntax isn't clear for the OP yet. The wiki expects you to add this to your bashrc:

~/.bashrc

#!/bin/bash
# ...
source /usr/share/fzf/key-bindings.bash
source /usr/share/fzf/completion.bash

There is a link to what source means on that page. Hope this helps you along.

Offline

#4 2019-09-16 18:57:34

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,144
Website

Re: (SOLVED) Help regarding FZF-Bash configuration via .bashrc.

8luesman wrote:

1. Basically installed with Pacman.

Basically?

8bluesman wrote:

2. I know the wiki wants me to source the files from /usr/share/fzf/.
3.  I see two files 'completion.bash' & 'keybindings.bash' there.
4. Checked out the Wiki and Bash docs to do it and scrounging in the internet for the answers - to no avail.

wiki wrote:

bash
Source the desired files from your .bashrc:

/usr/share/fzf/key-bindings.bash
/usr/share/fzf/completion.bash

Note the word "source" there is a link which provides further guidance on how to source files.

8luesman wrote:

    - Putting this line in .bashrc
        - "source /usr/share/fzf/completion.bash & . /usr/share/fzf/key-bindings.bash"

That should work, but it's rather odd.  It will background the sourcing of the first one, and for some reason you use 'source' for one and '.' for another.  Just source each of them individually.

8luesman wrote:

Any guidance will be highly appreciated.

Guidance on what?  Are you having a problem?  You haven't described or demonstrated any problem.  If you are not sure about what you have in your bashrc, post it's content.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#5 2019-09-16 19:09:57

8luesman
Member
From: Kathmandu, Nepal
Registered: 2019-09-10
Posts: 4

Re: (SOLVED) Help regarding FZF-Bash configuration via .bashrc.

Swiggles wrote:

As I understand the syntax isn't clear for the OP yet. The wiki expects you to add this to your bashrc:

~/.bashrc

#!/bin/bash
# ...
source /usr/share/fzf/key-bindings.bash
source /usr/share/fzf/completion.bash

There is a link to what source means on that page. Hope this helps you along.


I have done exactly this. And the response on restarting the st terminal is as given below -

bash: /usr/share/fzf/key-bindings.bash: line 35: syntax error near unexpected token `}'
bash: /usr/share/fzf/key-bindings.bash: line 35: `}'
bash: /usr/share/fzf/completion.bash: line 114: syntax error near unexpected token `}'
bash: /usr/share/fzf/completion.bash: line 114: `}'
bluesman ~ :( $ scrot -s

If I were doing correctly, I would have definite results of doing  "cd ** <tab>", isn't that right?

Offline

#6 2019-09-16 19:18:06

Swiggles
Member
Registered: 2014-08-02
Posts: 259

Re: (SOLVED) Help regarding FZF-Bash configuration via .bashrc.

Please show your .bashrc. This sounds like a dangling bracket somewhere.

Offline

#7 2019-09-16 19:22:41

8luesman
Member
From: Kathmandu, Nepal
Registered: 2019-09-10
Posts: 4

Re: (SOLVED) Help regarding FZF-Bash configuration via .bashrc.

Swiggles wrote:

Please show your .bashrc. This sounds like a dangling bracket somewhere.

# ~/.bashrc
#fortune -a | fmt -80 -s | $(shuf -n 1 -e cowsay cowthink) -$(shuf -n 1 -e b d g p>

#system maintenance

alias ls="ls --color=auto"
alias dir="dir --color=auto"
alias grep="grep --color=auto"
alias dmesg='dmesg --color'
alias p="sudo pacman --color=auto"
alias pi="ping www.archlinux.org"
alias fi="fuseiso"
alias fm="fusermount"
alias t="transmission-remote"


#Sourcing fzf files
source /usr/share/fzf/key-bindings.bash
source /usr/share/fzf/completion.bash


Thank you for your support.

Last edited by 8luesman (2019-09-16 19:23:08)

Offline

#8 2019-09-16 19:37:30

Swiggles
Member
Registered: 2014-08-02
Posts: 259

Re: (SOLVED) Help regarding FZF-Bash configuration via .bashrc.

The first line must be the shebang. Add it at the very top of the file as shown in my post before.

Offline

#9 2019-09-16 19:46:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,144
Website

Re: (SOLVED) Help regarding FZF-Bash configuration via .bashrc.

Shebangs are not necessary for rc files.  Clearly the file is being parsed.

The error is indicating a problem in the fzf-provided files.  I looked at them, but it looks a bit crazy to me.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#10 2019-09-16 19:56:04

Swiggles
Member
Registered: 2014-08-02
Posts: 259

Re: (SOLVED) Help regarding FZF-Bash configuration via .bashrc.

You are absolutely correct @Trilby. My bad!

Now I see the problem. Do not alias "fi" !

Offline

#11 2019-09-16 20:00:41

8luesman
Member
From: Kathmandu, Nepal
Registered: 2019-09-10
Posts: 4

Re: (SOLVED) Help regarding FZF-Bash configuration via .bashrc.

Swiggles wrote:

You are absolutely correct @Trilby. My bad!

Now I see the problem. Do not alias "fi" !


Thanks Swiggles. That's it.

Regards,
8luesman

Offline

Board footer

Powered by FluxBB