📘

vimをvscodeみたいにする(メモ)

2023/02/03に公開
set number
set ignorecase
syntax on
set expandtab
set tabstop=2
set shiftwidth=2
set showmatch
set smartindent

augroup MyXML
  autocmd!
  autocmd Filetype xml inoremap <buffer> </ </<C-x><C-o>
  autocmd Filetype html inoremap <buffer> </ </<C-x><C-o>
augroup END

call plug#begin()
        Plug 'mattn/emmet-vim'
  Plug 'Shougo/ddc.vim'
  Plug 'Shougo/pum.vim'
  Plug 'vim-denops/denops.vim'
  Plug 'Shougo/ddc-around'
  Plug 'LumaKernel/ddc-file'
  Plug 'Shougo/ddc-matcher_head'
  Plug 'Shougo/ddc-sorter_rank'
  Plug 'Shougo/ddc-converter_remove_overlap'
  Plug 'shun/ddc-vim-lsp'
  Plug 'mattn/vim-lsp-settings'
  Plug 'prabirshrestha/vim-lsp'
  Plug 'preservim/nerdtree'
call plug#end()

call ddc#custom#patch_global('completionMenu', 'pum.vim')
call ddc#custom#patch_global('sources', [
      \ 'around',
      \ 'vim-lsp',
      \ 'file'
      \ ]) 
call ddc#custom#patch_global('sourceOptions', {
      \ '_': {
      \     'matchers': ['matcher_head'],
      \     'sorters': ['sorter_rank'],
      \     'converters': ['converter_remove_overlap'],
      \ },
      \ 'around': {'mark': 'Around'},
      \ 'vim-lsp': {
      \   'mark': 'LSP',
      \   'matchers': ['matcher_head'],
      \   'forceCompletionPatters': '\.|:|->|"\w+/*'
      \ },
      \ 'file': {
      \   'mark': 'file',
      \   'isVolatile': v:true,
      \   'forceCompletionPattern': '\S/\S*'
      \ }})
call ddc#enable()

inoremap <Tab> <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <S-Tab> <Cmd>call pum#map#insert_relative(-1)<CR>

if &compatible
        set nocompatible 
endif

nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
autocmd VimEnter * NERDTree
autocmd VimEnter * NERDTree | wincmd p

実行結果


いらないものがあるかもしれません。
vim-plug,denoを最初にインストールしてください.

GitHubで編集を提案

Discussion