Skip to content

バッファごとに句読点のスタイルを変更するには? #249

Description

@wakita

質問になってすみません。

文書の種類に応じて異なる句読点のスタイルを用いる必要があって、どうしたものかと思っています。

  • 論文のときは
  • ふつうの文章では

を使いわけます。
で、eskk#register_mode_table を使って mode table を変更する方法を知ったため、以下のように SkkTechnicalSkkCasual というコマンドを用意して、eskk が動く出す前であれば、それ以後、利用する mode table を変更できるようにしています。

let s:eskk_mode_tables = [                                                 
      \ eskk#table#new('rom_to_hira'.'*', 'rom_to_hira'),
      \ eskk#table#new('rom_to_kata'.'*', 'rom_to_kata')]                  

function! s:eskk_register_mode_table()
  call eskk#register_mode_table('hira', b:eskk_mode_tables[0])
  call eskk#register_mode_table('kata', b:eskk_mode_tables[1])
endfunction

autocmd User eskk-initialize-pre call s:eskk_register_mode_table()

function! s:eskk_punctuation(punctuation_mapping)
  for table in s:eskk_mode_tables
    for [from, to] in a:punctuation_mapping
      call table.add_map(from, to)
    endfor
  endfor
endfunction

command SkkTechnical call s:eskk_punctuation([[',', ','], ['.', '.']])
command SkkCasual    call s:eskk_punctuation([[',', '、'], ['.', '。']])

でも、実際にはいろいろな種類の文書をひとつの vim で編集したいので、できればバッファごとに設定できると嬉しいです。

よい方法があったらご教示いただけませんでしょうか。
(本当は編集中に mode table を交換できればさらに嬉しいですが…)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions