LoginSignup
1
0

More than 1 year has passed since last update.

ddu-source-emoji

Posted at

概要

ddu-source-emojiの使い方

dduというのはshogoさん作のunite後継なんだが、どうもドキュメントが少ないのと設定が多すぎてよくわからん。
今回、ddu-source-emojiも追加した設定を公開します。

設定

 neovimをwindowsで使っています。dein.vimを止めて、vim-plugにしました。vim-plugの部分の設定をmyplug.vimとしてinit.vimから読み込むようにしています。
neovim,vim-plugについては、何処かを参考にお願いします。
 

init.vim
set mouse=a "マウスを有効
(中略)
source C:/Users/[username]/AppData/Local/nvim/myplug.vim
myplug.vim
call plug#begin()
    Plug 'junegunn/vim-plug'
    Plug 'itchyny/lightline.vim'
    Plug 'vim-denops/denops.vim'
    Plug 'Shougo/unite.vim'
    Plug 'ujihisa/unite-colorscheme'

    Plug 'Shougo/ddu.vim'
    Plug 'Shougo/ddu-ui-ff' 
    Plug 'Shougo/ddu-source-file_rec'
    Plug 'Shougo/ddu-source-file'
    Plug 'Shougo/ddu-filter-matcher_substring'
    Plug 'Shougo/ddu-kind-file'
    Plug 'Shougo/ddu-kind-word'
    Plug 'Shougo/ddu-commands.vim'
    Plug '4513ECHO/ddu-source-colorscheme'
    Plug 'shun/ddu-source-buffer'
    Plug '4513ECHO/ddu-source-emoji'
call plug#end()

"for lightline
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'separator': { 'left': "▶", 'right': "\u2b82" },
\ 'subseparator': { 'left': "> ", 'right': "< " },
\ }

"for unite-colorsceme
nnoremap <silent> xuc :<C-u>Unite colorscheme -auto-preview<CR>
let g:unite_enable_split_vertically = 1 "縦分割で開く
let g:unite_winwidth = 40 "横幅40で開く

"for ddu
call ddu#custom#patch_global({
    \   'ui': 'ff',
    \   'sources': [{'name': 'file_rec', 'params': {}},
    \      {'name': 'file'},
    \      {'name': 'colorscheme'},
    \      {'name': 'buffer'},
    \      {'name': 'emoji'}],
    \   'sourceOptions': {
    \     '_': {
    \       'matchers': ['matcher_substring'],
    \     },
    \   },
    \   'kindOptions': {
    \     'file': {
    \       'defaultAction': 'open',
    \     },
    \     'colorscheme': {
    \       'defaultAction': 'set',
    \     },
    \     'word': {
    \       'defaultAction': 'append',
    \     },
    \   },
    \   'uiParams': {
    \      'ff': {
    \         'startFilter': v:false,
    \         'split': 'floating',
    \         'winHeight': 30,
    \         'winRow': 8,
    \      },
    \   },
    \   'filterParams': {
    \      'matcher_substring': {
    \          'highlightMatched': 'Search',
    \      },
    \   },
    \ })

autocmd FileType ddu-ff call s:ddu_my_settings()
function! s:ddu_my_settings() abort
  nnoremap <buffer><silent> <CR>
        \ <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  nnoremap <buffer><silent> <Space>
        \ <Cmd>call ddu#ui#ff#do_action('toggleSelectItem')<CR>
  nnoremap <buffer><silent> i
        \ <Cmd>call ddu#ui#ff#do_action('openFilterWindow')<CR>
  nnoremap <buffer><silent> q
        \ <Cmd>call ddu#ui#ff#do_action('quit')<CR>
endfunction

autocmd FileType ddu-ff-filter call s:ddu_filter_my_settings()
function! s:ddu_filter_my_settings() abort
  inoremap <buffer><silent> <CR>
  \ <Esc><Cmd>close<CR>
  nnoremap <buffer><silent> <CR>
  \ <Cmd>close<CR>
  nnoremap <buffer><silent> q
  \ <Cmd>close<CR>
endfunction

nnoremap <silent> xdf :Ddu file<cr>
nnoremap <silent> xdb :Ddu buffer<cr>
nnoremap <silent> xdr :Ddu file_rec<cr>
nnoremap <silent> xdc :Ddu colorscheme<cr>

inoremap <C-x><C-e> <Cmd>call ddu#start({'sources': [{'name': 'emoji'}]})<CR>

説明

昔のuniteやlitelineまでインストールしていますので、これを削除するのは問題ないと思います。
emojiの挙動は最後のinoremapで挿入モードで、cntl+x,cntl+eを操作すると、emojiの一覧がでてきます。

操作説明

 っで、表示だけでは選択ができないのですが、ここでiを入力すると、filterしてくれますので。例えば:smileとかを入力すると無事所望の絵文字が選択できます。
 まあ、分かっている人は当たり前なんでしょうけど、まだまだdduは新米なんで、とりあえず、upしました。
あっと、絵文字が欠けているようですが、フォントを12ぐらいにすれば大丈夫だと思います。
image.png

1
0
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
1
0