[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ranger-users] Ranger as an IDE filemanager
From: |
Roger Pate |
Subject: |
Re: [Ranger-users] Ranger as an IDE filemanager |
Date: |
Tue, 25 Jul 2017 16:25:10 -0400 |
Run this script instead of vim. You could also name it "vim", put it
earlier in $PATH, and adjust "exec vim" to an absolute path.
#!/bin/sh -ue
project=
# find project name from $1's path, or keep it empty
# TODO: what if multiple paths are specified, possibly corresponding
to different projects?
if [ -n "$project" ]; then
set -- --servername "$project" --remote "$@"
fi
exec vim "$@"
On Tue, Jul 25, 2017 at 10:27 AM, John Z. <address@hidden> wrote:
> Hi all,
> some time ago I posted (in a wrong thread, by accident) about how
> I'd like each instance of ranger to open files in different instance
> of Vim (using --remote flag), and pondered if making a custom edit
> command would be the right way.
>
> I've since managed to solve the problem much more elegantly using
> rifle, so I figured I'd share the tip for every developer out there
> who likes to compose their own IDE.
>
> 1. run Vim with different server names ('vim --servername
> 'VIM-PROJECTX')
> 2. in ~/.config/ranger/rifle.conf, find a catch-all line:
>
> # Define the "editor" for text files as first action
> mime ^text, label editor = $EDITOR -- "$@"
>
> and add your projects workspaces using 'path' condition, eg.:
>
> path Q/workspace/lookalikes, mime ^text, label editor = vim
> --servername 'VIM-AO' --remote "$@"
>
>
> I'm sure this can be improved to avoid modifying rifle.conf for every
> project - for example, keeping an empty file in the folder and then
> assembling vim servername using that file's name.
>
> For an extra touch, switch Ranger to MC mode (Shift+~).
>
> Cheers!
>