Autojump: عرض الدليل الأكثر زيارة ولكن لا يتم تشغيل `cd`

تم إنشاؤها على ١٠ يونيو ٢٠١٣  ·  3تعليقات  ·  مصدر: wting/autojump

عادة ، يقوم j something بتبديل دليل العمل. لكن ليس من الضروري. في بعض الحالات ، نحتاج ببساطة إلى طباعة الدليل على stdout. على سبيل المثال

open `j --no-cd something`

قد يؤدي هذا إلى تشغيل Finder على OS X للدليل الوجهة.

لا أعرف ما إذا كان من الصعب اختراق هذه الميزة ، ولكن شكرًا بأي طريقة للأداة الرائعة!

التعليق الأكثر فائدة

أنا أفضل fasd ، وقد كتبت هذا لإعطائي الأمر a: j. ربما يمكنك ذلك
تكييفها للقفز التلقائي.

ضع هذا في .config / ranger / commands.py:

from ranger.api.commands import *
import subprocess

class j(Command):
    """:j

    Uses fasd to set the current directory.
    """

    def execute(self):
        directory = subprocess.check_output(["fasd", "-dl1", self.arg(1)])
        directory = directory.decode("utf-8", "ignore")
        directory = directory.rstrip('\n')
        self.fm.execute_console("cd " + directory)

ال 3 كومينتر

حسنًا ، أشعر تمامًا بما كنت أفكر فيه من أجل https://github.com/hut/ranger/issues/91.

يفتح jo <dir> متصفح ملفات خاص بنظام التشغيل.

autojump <dir> يطبع المباراة الأولى. إذا لم يتم تمرير أي وسيطات ، فإن القفزة التلقائية تطبع الدليل الأكثر استخدامًا.

إذا كنت بحاجة إلى مزيد من المعلومات ، فاستخدم autojump --stats وأي مجموعة من awk / sed / tr / إلخ.

أنا أفضل fasd ، وقد كتبت هذا لإعطائي الأمر a: j. ربما يمكنك ذلك
تكييفها للقفز التلقائي.

ضع هذا في .config / ranger / commands.py:

from ranger.api.commands import *
import subprocess

class j(Command):
    """:j

    Uses fasd to set the current directory.
    """

    def execute(self):
        directory = subprocess.check_output(["fasd", "-dl1", self.arg(1)])
        directory = directory.decode("utf-8", "ignore")
        directory = directory.rstrip('\n')
        self.fm.execute_console("cd " + directory)
هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات

القضايا ذات الصلة

nunoh picture nunoh  ·  20تعليقات

srid picture srid  ·  14تعليقات

dotimes picture dotimes  ·  4تعليقات

mbigras picture mbigras  ·  3تعليقات

shepherdwind picture shepherdwind  ·  11تعليقات