1

私はラテックス文書を書いていて、アクセント付きの文字を挿入したい..

アクセント付きの e を挿入したいとします。è

それを書きたい場合は、次を使用します。

\`e

しかし、崇高なオートコンプリートを使用すると、逆引用符を挿入すると取得されます

\`e`

したがって、アクセント記号付きの文字を挿入するたびに、余分なバッククォートを削除する必要があります.最初の引用符の前にバックスラッシュがある場合、引用符を閉じないようにする方法はありますか?

ありがとう

4

1 に答える 1

3

ユーザーキーバインディングに以下を追加してみてください。

{ "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'"}, "context":
    [
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
        { "key": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true },
        { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single", "match_all": true },
        { "key": "preceding_text", "operator": "regex_contains", "operand": "\\\\$", "match_all": true },
        { "key": "selector", "operator": "equal", "operand": "text.tex", "match_all": true }
    ]
}

デフォルトのキー バインディングで、自動ペアリング引用符の既存のキー バインディングを使用しました。次に、スニペットを変更して、単純に 1 文字を入力するようにしました。コマンドに変更できますが、insert実際には問題ありません。次に、最後の 2 つのエントリをコンテキストに追加しました。1 つ目は、前のテキストで をチェックします\。2 つ目は、スコープがtext.tex.latex. 2 番目のエントリは実際には必要ありませんが、存在しない場合は、ファイルだけでなく、すべてのファイルの種類に適用されtexます。

編集

二重引用符の解決策

{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\""}, "context":
    [
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
        { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true },
        { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true },
        { "key": "preceding_text", "operator": "regex_contains", "operand": "\\\\$", "match_all": true },
        { "key": "selector", "operator": "equal", "operand": "text.tex", "match_all": true }
    ]
}

繰り返しますが、二重引用符の自動ペア キー バインドから始めて (既定値から)、2 つのコンテキスト エントリを追加しました。解析に失敗したということは、不正な形式の json があったことを意味します。私が推測しなければならなかった場合、あなたは多くの/十分な\エスケープをしなければなりませんでした.

編集2

同じ手順。今回は正しい見積もりが得られたことを願っています:)

{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`"}, "context":
    [
        { "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
        { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "preceding_text", "operator": "regex_contains", "operand": "\\\\$", "match_all": true }
    ]
}
于 2013-11-03T19:51:03.080 に答える