LoginSignup
4
1

More than 5 years have passed since last update.

補完候補の既入力部分の文字列をハイライト

Posted at

途中まで名前が同じで長い名前のファイルを扱う機会があり、
「どこまで入力してて、次は何の文字を入力すればファイル名全部補完してくれるんだ~」
「どこまで入力したかハイライトできない?」
と思って調べたら
nyagos.completion_hookshownlistってのが追加されていたので使ってみました。

.nyagos
------------------------------------------------
-- 補完:入力部分のハイライト
nyagos.completion_hook = function(c)
    for index, item in ipairs(c.list) do
        c.shownlist[index] = '\027[31;;1m' .. c.word .. '\027[;;0m' .. item:sub(string.len(c.word) + 1)
    end
    return c.list, c.shownlist
end

before

before.png

after

after.png

これで良い!

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1