目次
$ sudo pip install percol
$ apt install percol
brew install cmigemo
curl -O http://www.atzm.org/etc/files/pymigemo/pymigemo-0.4.tar.gz sudo pip install pymigemo-0.4.tar.gz
mkdir ~/.percol.d vim ~/.percol.d/rc.py
import sys, commands from percol.command import SelectorCommand from percol.key import SPECIAL_KEYS from percol.finder import FinderMultiQueryMigemo, FinderMultiQueryRegex ## prompt # Case Insensitive / Match Method に応じてプロンプトに表示 def dynamic_prompt(): prompt = ur"" if percol.model.finder.__class__ == FinderMultiQueryMigemo: prompt += "[Migemo]" elif percol.model.finder.__class__ == FinderMultiQueryRegex: prompt += "[Regexp]" else: prompt += "[String]" if percol.model.finder.case_insensitive: prompt += "[a]" else: prompt += "[A]" prompt += "> %q" return prompt percol.view.__class__.PROMPT = property(lambda self: dynamic_prompt()) ## migemo # Mac と Ubuntu で辞書のパスを変える if sys.platform == "darwin": FinderMultiQueryMigemo.dictionary_path = "/usr/local/Cellar/cmigemo/20110227/share/migemo/utf-8/migemo-dict" else: FinderMultiQueryMigemo.dictionary_path = "/usr/share/cmigemo/utf-8/migemo-dict" ## kill # Mac の場合は kill(yank)をクリップボードと共有する if sys.platform == "darwin": def copy_end_of_line_as_kill(self): commands.getoutput("echo " + self.model.query[self.model.caret:] + " | pbcopy") self.model.query = self.model.query[:self.model.caret] def paste_as_yank(self): self.model.insert_string(commands.getoutput("pbpaste")) SelectorCommand.kill_end_of_line = copy_end_of_line_as_kill SelectorCommand.yank = paste_as_yank ## keymap # Mac で delete(backspace)が効くようにする SPECIAL_KEYS.update({ 127: '<backspace>' })
一般向けサイト
ITエンジニア向けサイト
英語サイト
Portfolio
Copyright (c) 2024 インフラエンジニアのPC環境 All Rights Reserved.