[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ranger-users] Customized 'edit' command
From: |
Wojciech Siewierski |
Subject: |
Re: [Ranger-users] Customized 'edit' command |
Date: |
Sun, 16 Jul 2017 11:42:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 04.07.2017 21:04, John Z. wrote:
> Hi everyone again!
>
> New question: is it possible to somehow have <enter> key call
> customized 'edit' command when executed on text files, and have this
> map set up either during runtime, or (ideally!) via run argument?
>
> What I have is Vim instance running as a server and a ranger instance open
> selected files in that instance of Vim. It works with my current hack, a
> change
> to my local rifle.conf:86 to this:
>
> mime ^text, label editor = $EDITOR --remote-silent "$@"
>
> This, plus tiling window manager, plus Midnight Commander look results in
> pretty nifty shell-driven IDE! Issue is, now *all* requests for edit
> (including bulk_rename) are sent to this instance of Vim. I'd like to be able
> to define, per ranger instance, to which Vim server will I send the file, or
> shall file be edited in-place.
>
> If possible, I'd like not to have to set up this per file type,
> since sometimes different projects will share a file type, but I want
> different ranger instances to open them in different vim instances.
>
> Other things I tried
> - 'map enter', but it maps how enter behaves when I hit the
> directory as well.
> - 'alias edit my_edit', but I didn't manage to do it successfully
>
>
> Sorry if my description wasn't clear enough, please ask if something
> is confusing and I'll try to clarify it.
>
> Thanks in advance!
I think Rifle is the right way to do it.
I think your best bet is to use an additional script as your editor, a
script that will make a decision to which Vim to pass each file. If you
want each Ranger instance to have its own Vim, using the Ranger PID
(process ID) might be a good identifier for these Vim servers. It should
be pretty easy to expose it for example as an environmental variable
which you would read in your script.
Cheers
--
vifon
signature.asc
Description: OpenPGP digital signature