Autojump: ๊ฐ€์žฅ ์ž์ฃผ ๋ฐฉ๋ฌธํ•œ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ํ‘œ์‹œํ•˜์ง€๋งŒ `cd`๋Š” ์‹คํ–‰ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2013๋…„ 06์›” 10์ผ  ยท  3์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: wting/autojump

์ผ๋ฐ˜์ ์œผ๋กœ j something ๋Š” ์ž‘์—… ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ „ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๊ทธ๋Ÿด ํ•„์š”๋Š” ์—†์Šต๋‹ˆ๋‹ค. ์–ด๋–ค ๊ฒฝ์šฐ์—๋Š” ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ stdout์— ์ธ์‡„ํ•˜๊ธฐ๋งŒ ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์˜ˆ

open `j --no-cd something`

์ด๊ฒƒ์€ ๋Œ€์ƒ ๋””๋ ‰ํ† ๋ฆฌ์— ๋Œ€ํ•ด OS X์—์„œ Finder๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด ๊ธฐ๋Šฅ์„ ํ•ดํ‚นํ•˜๋Š” ๊ฒƒ์ด ์–ด๋ ค์šด์ง€ ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ ํ›Œ๋ฅญํ•œ ๋„๊ตฌ๋ฅผ ์ œ๊ณตํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

๋‚˜๋Š” fasd๋ฅผ ์„ ํ˜ธํ•˜๊ณ  ๋‚˜์—๊ฒŒ :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 ๋Œ“๊ธ€

jo <dir> ๋Š” OS๋ณ„ ํŒŒ์ผ ๋ธŒ๋ผ์šฐ์ €๋ฅผ ์—ฝ๋‹ˆ๋‹ค.

autojump <dir> ๋Š” ์ฒซ ๋ฒˆ์งธ ์ผ์น˜ ํ•ญ๋ชฉ์„ ์ธ์‡„ํ•ฉ๋‹ˆ๋‹ค. ์ธ์ˆ˜๋ฅผ ์ „๋‹ฌํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ autojump๋Š” ๊ฐ€์žฅ ์ž์ฃผ ์‚ฌ์šฉ๋˜๋Š” ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ธ์‡„ํ•ฉ๋‹ˆ๋‹ค.

์ถ”๊ฐ€ ์ •๋ณด๊ฐ€ ํ•„์š”ํ•˜๋ฉด autojump --stats ๋ฐ awk / sed / tr / ๋“ฑ์˜ ์กฐํ•ฉ์„ ์‚ฌ์šฉํ•˜์‹ญ์‹œ์˜ค.

๋‚˜๋Š” fasd๋ฅผ ์„ ํ˜ธํ•˜๊ณ  ๋‚˜์—๊ฒŒ :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 ๋“ฑ๊ธ‰