Last active
October 4, 2024 04:45
-
-
Save yamamo2shun1/5831f1a244fd092c058ee945d52a0088 to your computer and use it in GitHub Desktop.
My vim setting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin('~/.vim/plugged') | |
Plug 'prabirshrestha/asyncomplete.vim' | |
Plug 'prabirshrestha/asyncomplete-lsp.vim' | |
Plug 'prabirshrestha/vim-lsp' | |
Plug 'mattn/vim-lsp-settings' | |
Plug 'mattn/vim-lsp-icons' | |
Plug 'mattn/vim-goimports' | |
Plug 'hrsh7th/vim-vsnip' | |
Plug 'hrsh7th/vim-vsnip-integ' | |
Plug 'rhysd/vim-clang-format' | |
Plug 'kana/vim-operator-user' | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'flazz/vim-colorschemes' | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
Plug 'lambdalisue/fern.vim' | |
Plug 'lambdalisue/fern-git-status.vim' | |
Plug 'lambdalisue/fern-hijack.vim' | |
Plug 'lambdalisue/nerdfont.vim' | |
Plug 'lambdalisue/fern-renderer-nerdfont.vim' | |
Plug 'lambdalisue/glyph-palette.vim' | |
Plug 'yuki-yano/fern-preview.vim' | |
Plug 'dense-analysis/ale' | |
Plug 'tokorom/vim-swift-format' | |
Plug 'tidalcycles/vim-tidal' | |
Plug 'leafOfTree/vim-svelte-plugin' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'rust-lang/rust.vim' | |
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries:' } | |
Plug 'vim-jp/vimdoc-ja' | |
call plug#end() | |
" gVimのウィンドウサイズ | |
"set columns=100 | |
"set lines=30 | |
" フォント設定 | |
" for Windows gVim | |
set guifont=Cica:h14:cSHIFTJIS:qDRAFT | |
set guifontwide=Cica:h14:cSHIFTJIS:qDRAFT | |
set renderoptions=type:directx,renmode:5 | |
set ambiwidth=double | |
" for WSL, Linux or macOS | |
"set guifont=Cica\ 16 | |
"set guifontwide=Cica\ 16 | |
set encoding=utf-8 | |
set fileencodings=utf-8,iso-2022-jp,euc-jp,sjis | |
set backspace=indent,eol,start | |
set number | |
set ignorecase | |
set smartcase | |
set wrapscan | |
set incsearch | |
set whichwrap=b,s,h,l,<,>,[,] | |
set hlsearch | |
set tabstop=4 | |
set shiftwidth=4 | |
"set wildmenu | |
set wildignorecase | |
set wildmode=longest,list | |
set showmatch | |
"set clipboard^=unnamedplus | |
set clipboard+=unnamed | |
set wildcharm=<Tab> | |
set mouse=a | |
set termguicolors | |
set helplang=ja | |
set noswapfile | |
set nobackup | |
set noundofile | |
syntax enable | |
set background=dark | |
colorscheme hybrid | |
filetype plugin indent on | |
let g:rustfmt_autosave = 1 | |
let &t_8f="\<Esc>[38;2;%lu;%lu;%lum" | |
let &t_8b="\<Esc>[48;2;%lu;%lu;%lum" | |
let g:termdebugger="gdb-multiarch" | |
let g:termdebug_wide=160 | |
"let g:lsp_diagnostics_enabled = 1 | |
let g:lsp_diagnostics_echo_cursor = 1 | |
"let g:asyncomplete_auto_popup = 1 | |
"let g:asyncomplete_auto_completeopt = 0 | |
let g:asyncomplete_popup_delay = 100 | |
let g:lsp_text_edit_enabled = 0 | |
let g:lsp_settings = { | |
\ 'clangd': {'cmd': ['"C:\Program Files\LLVM\bin\clangd.exe"']}, | |
\ 'clang-format': {'cmd': ['"C:\Program Files\LLVM\bin\clang-format.exe"']}, | |
\ 'efm-langserver': {'disabled': v:false}, | |
\} | |
let g:clang_format#command="clang-format.exe" | |
let g:clang_format#detect_style_file=1 | |
let g:clang_format#auto_format=1 | |
let g:clang_format#auto_format_insert_leave=1 | |
autocmd BufWritePre *.ts,*.mts call execute('LspDocumentFormatSync --server=efm-langserver') | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline_powerline_fonts = 1 | |
let g:fern#default_hidden = 1 | |
let g:fern#disable_default_mappings = 1 | |
let g:fern#renderer = 'nerdfont' | |
function! s:init_fern() abort | |
nmap <buffer><expr> | |
\ <Plug>(fern-my-expand-or-collapse) | |
\ fern#smart#leaf( | |
\ "\<Plug>(fern-action-collapse)", | |
\ "\<Plug>(fern-action-expand)", | |
\ "\<Plug>(fern-action-collapse)", | |
\ ) | |
nmap <silent> <buffer> <Space> <Plug>(fern-my-expand-or-collapse) | |
nmap <silent> <buffer> <C-m> <Plug>(fern-action-enter) | |
nmap <silent> <buffer> <BS> <Plug>(fern-action-leave) | |
nmap <silent> <buffer> r <Plug>(fern-action-reload) | |
nmap <silent> <buffer> o <Plug>(fern-action-open:edit) | |
nmap <silent> <buffer> i <Plug>(fern-action-hidden-toggle) | |
endfunction | |
augroup my-glyph-palette | |
autocmd! * | |
autocmd FileType fern call glyph_palette#apply() | |
autocmd FileType nerdtree,startify call glyph_palette#apply() | |
autocmd FileType fern call s:init_fern() | |
augroup END | |
"if executable('sourcekit-lsp') | |
" au User lsp_setup call lsp#register_server({ | |
" \ 'name': 'sourcekit-lsp', | |
" \ 'cmd': {server_info->['sourcekit-lsp']}, | |
" \ 'whitelist': ['swift'], | |
" \ }) | |
"endif | |
let g:ale_linters = { | |
\ 'swift': ['swift-format'], | |
\} | |
let g:vim_swift_format_use_ale = 1 | |
let g:tidal_ghci = "tidal.bat" | |
"let g:tidal_boot = | |
let g:vim_svelte_plugin_load_full_syntax = 1 | |
set termwinkey=<C-x> | |
let mapleader = "\<SPACE>" | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gy <Plug>(coc-type-definition) | |
nmap <silent> gi <Plug>(coc-implementation) | |
nmap <silent> gr <Plug>(coc-references) | |
" Fernをドロワーとして開く | |
nnoremap <leader>f <cmd>Fern . -reveal=% -drawer<cr> | |
" Fernドロワーとファイルを行ったり来たり | |
nnoremap <leader>w <C-w>w | |
nnoremap d h | |
nnoremap s j | |
nnoremap t k | |
nnoremap h l | |
nnoremap f 0 | |
nnoremap l $ | |
nnoremap b x | |
nnoremap g y | |
nnoremap r p | |
nnoremap R P | |
nnoremap <C-t> gt | |
nnoremap <C-c> D | |
nnoremap m o | |
nnoremap <C-m> i<Return><Esc> | |
nnoremap <C-a> <C-w> | |
noremap <C-w> <Tab> | |
noremap! <C-w> <Tab> | |
noremap <C-n> <C-[> | |
noremap! <C-n> <C-[> | |
inoremap <C-w> <Tab> | |
inoremap <C-d> <Left> | |
inoremap <C-s> <Down> | |
inoremap <C-t> <Up> | |
inoremap <C-h> <Right> | |
inoremap <C-f> <Home> | |
inoremap <C-l> <End> | |
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | |
inoremap <expr> <C-w> pumvisible() ? "\<C-n>" : "\<Tab>" | |
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>" | |
vnoremap <C-d> <Left> | |
vnoremap <C-s> <Down> | |
vnoremap <C-t> <Up> | |
vnoremap <C-h> <Right> | |
vnoremap <C-f> <Home> | |
vnoremap <C-l> <End> | |
cnoremap <C-w> <C-i> | |
cnoremap <C-d> <Left> | |
cnoremap <C-s> <Down> | |
cnoremap <C-t> <Up> | |
cnoremap <C-h> <Right> | |
cnoremap <C-f> <Home> | |
cnoremap <C-l> <End> |
fern.vimとrust.vimを導入。
<leader>
をSPACEキーに割り当てる<leader>f
でFernをドロワー表示する- Fernでファイルを
o
で開いたときにFernドロワーを表示したままにする
分割ウィンドウを移動するキーバインドを設定
asyncomplete.vimでTabとControl-wで補完候補を選択できるようにし、改行の入力で補完候補のポップアップを閉じられるようにする。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
macOSでクリップボードを使う場合の設定を追記(Linuxと違ったため)。