Skip to content

Commit

Permalink
✨feat: lspの設定を移動
Browse files Browse the repository at this point in the history
  • Loading branch information
utubo committed Oct 30, 2024
1 parent d71a373 commit fb6ee31
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 80 deletions.
37 changes: 2 additions & 35 deletions .vim/autoload/vimrc/lazyload.vim
Original file line number Diff line number Diff line change
Expand Up @@ -90,41 +90,6 @@ nn <buffer> <CR> <ScriptCmd>execute 'bo vsplit' [expand('%'), getline('.')->matc
nn <Space>gh <Cmd>tabe gh://utubo/repos<CR>
nn <F2> <Cmd>MRUToggle<CR>
g:MRU_Exclude_Files = has('win32') ? $'{$TEMP}\\.*' : '^/tmp/.*\|^/var/tmp/.*'
vimrc#lexima#LazyLoad()
var lk = {
diagSignErrorText: '🐞',
diagSignHintText: '💡',
diagSignInfoText: '💠',
diagSignWarningText: '🐝',
showDiagWithVirtualText: true,
diagVirtualTextAlign: 'after',
}
const ll = has('win32') ? '.cmd' : ''
var lm = [{
name: 'typescriptlang',
filetype: ['javascript', 'typescript'],
path: $'typescript-language-server{ll}',
args: ['--stdio'],
}, {
name: 'vimlang',
filetype: ['vim'],
path: $'vim-language-server{ll}',
args: ['--stdio'],
}, {
name: 'htmllang',
filetype: ['html'],
path: $'html-languageserver{ll}',
args: ['--stdio'],
}, {
name: 'jsonlang',
filetype: ['json'],
path: $'vscode-json-languageserver{ll}',
args: ['--stdio'],
}]
g:LspOptionsSet(lk)
g:LspAddServer(lm)
nn [l <Cmd>LspDiagPrev<CR>
nn ]l <Cmd>LspDiagNext<CR>
nn <Leader>a <Cmd>PortalAim<CR>
nn <Leader>b <Cmd>PortalAim blue<CR>
nn <Leader>o <Cmd>PortalAim orange<CR>
Expand All @@ -148,6 +113,8 @@ Each nnoremap,tnoremap <silent> <C-w><C-s> <Plug>(shrink-height)<C-w>w
Each nnoremap,tnoremap <silent> <C-w><C-h> <Plug>(shrink-width)<C-w>w
no <Space>s <Plug>(jumpcursor-jump)
vimrc#hlpairs#LazyLoad()
vimrc#lexima#LazyLoad()
vimrc#lsp#LazyLoad()
Each nmap,xmap S <ScriptCmd>vimrc#sandwich#LazyLoad('S')<CR>
nm <C-p> <ScriptCmd>vimrc#ctrlp#LazyLoad()<CR><C-p>
nm s <ScriptCmd>vimrc#easymotion#LazyLoad()<CR>s
Expand Down
42 changes: 42 additions & 0 deletions .vim/autoload/vimrc/lsp.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
vim9script
if exists('g:vimrc_lsp_lazyloaded')
finish
endif
g:vimrc_lsp_lazyloaded = 1
packadd lsp
var k = {
diagSignErrorText: '🐞',
diagSignHintText: '💡',
diagSignInfoText: '💠',
diagSignWarningText: '🐝',
showDiagWithVirtualText: true,
diagVirtualTextAlign: 'after',
}
const m = has('win32') ? '.cmd' : ''
var n = [{
name: 'typescriptlang',
filetype: ['javascript', 'typescript'],
path: $'typescript-language-server{m}',
args: ['--stdio'],
}, {
name: 'vimlang',
filetype: ['vim'],
path: $'vim-language-server{m}',
args: ['--stdio'],
}, {
name: 'htmllang',
filetype: ['html'],
path: $'html-languageserver{m}',
args: ['--stdio'],
}, {
name: 'jsonlang',
filetype: ['json'],
path: $'vscode-json-languageserver{m}',
args: ['--stdio'],
}]
g:LspOptionsSet(k)
g:LspAddServer(n)
nn [l <Cmd>LspDiagPrev<CR>
nn ]l <Cmd>LspDiagNext<CR>
export def LazyLoad()
enddef
2 changes: 1 addition & 1 deletion .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ au vimrc VimEnter * ++nested {
if empty(bufname())
const k = get(v:oldfiles, 0, '')->expand()
if k->filereadable()
packadd lsp
packadd vim-gitgutter
packadd vim-log-highlighting
packadd vim-polyglot
vimrc#lsp#LazyLoad()
exe 'edit' k
endif
endif
Expand Down
48 changes: 5 additions & 43 deletions src/.vim/autoload/vimrc/lazyload.src.vim
Original file line number Diff line number Diff line change
Expand Up @@ -139,49 +139,6 @@ g:MRU_Exclude_Files = has('win32') ? $'{$TEMP}\\.*' : '^/tmp/.*\|^/var/tmp/.*'
# MRUに関してのその他の設定は.vim/after/ftplugin/mru.src.vimで指定している
#}}}

# lexima {{{
# 最初のInsertEnterが動かないなぁ
# au vimrc InsertEnterPre,CmdEnterPre ++once vimrc#lexima#LazyLoad()
vimrc#lexima#LazyLoad()
# }}}

# LSP {{{
var lspOptions = {
diagSignErrorText: '🐞',
diagSignHintText: '💡',
diagSignInfoText: '💠',
diagSignWarningText: '🐝',
showDiagWithVirtualText: true,
diagVirtualTextAlign: 'after',
}
const commandExt = has('win32') ? '.cmd' : ''
var lspServers = [{
name: 'typescriptlang',
filetype: ['javascript', 'typescript'],
path: $'typescript-language-server{commandExt}',
args: ['--stdio'],
}, {
name: 'vimlang',
filetype: ['vim'],
path: $'vim-language-server{commandExt}',
args: ['--stdio'],
}, {
name: 'htmllang',
filetype: ['html'],
path: $'html-languageserver{commandExt}',
args: ['--stdio'],
}, {
name: 'jsonlang',
filetype: ['json'],
path: $'vscode-json-languageserver{commandExt}',
args: ['--stdio'],
}]
g:LspOptionsSet(lspOptions)
g:LspAddServer(lspServers)
nnoremap [l <Cmd>LspDiagPrev<CR>
nnoremap ]l <Cmd>LspDiagNext<CR>
#}}}

# Portal {{{
nnoremap <Leader>a <Cmd>PortalAim<CR>
nnoremap <Leader>b <Cmd>PortalAim blue<CR>
Expand Down Expand Up @@ -219,6 +176,11 @@ noremap <Space>s <Plug>(jumpcursor-jump)
vimrc#hlpairs#LazyLoad()
# }}}

# 設定が膨らんできたので別ファイルで定義 {{{
vimrc#lexima#LazyLoad()
vimrc#lsp#LazyLoad()
# }}}

# 遅延読み込みもの {{{
Each nmap,xmap S <ScriptCmd>vimrc#sandwich#LazyLoad('S')<CR>
nmap <C-p> <ScriptCmd>vimrc#ctrlp#LazyLoad()<CR><C-p>
Expand Down
47 changes: 47 additions & 0 deletions src/.vim/autoload/vimrc/lsp.src.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
vim9script

if exists('g:vimrc_lsp_lazyloaded')
finish
endif
g:vimrc_lsp_lazyloaded = 1

packadd lsp

var lspOptions = {
diagSignErrorText: '🐞',
diagSignHintText: '💡',
diagSignInfoText: '💠',
diagSignWarningText: '🐝',
showDiagWithVirtualText: true,
diagVirtualTextAlign: 'after',
}
const commandExt = has('win32') ? '.cmd' : ''
var lspServers = [{
name: 'typescriptlang',
filetype: ['javascript', 'typescript'],
path: $'typescript-language-server{commandExt}',
args: ['--stdio'],
}, {
name: 'vimlang',
filetype: ['vim'],
path: $'vim-language-server{commandExt}',
args: ['--stdio'],
}, {
name: 'htmllang',
filetype: ['html'],
path: $'html-languageserver{commandExt}',
args: ['--stdio'],
}, {
name: 'jsonlang',
filetype: ['json'],
path: $'vscode-json-languageserver{commandExt}',
args: ['--stdio'],
}]
g:LspOptionsSet(lspOptions)
g:LspAddServer(lspServers)
nnoremap [l <Cmd>LspDiagPrev<CR>
nnoremap ]l <Cmd>LspDiagNext<CR>
export def LazyLoad()
# nop
enddef
2 changes: 1 addition & 1 deletion src/.vimrc.src.vim
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ au vimrc VimEnter * ++nested {
const lastfile = get(v:oldfiles, 0, '')->expand()
if lastfile->filereadable()
# 読み込み重いけどこのタイミングでpackaddするしかない…
packadd lsp
packadd vim-gitgutter
packadd vim-log-highlighting
packadd vim-polyglot
vimrc#lsp#LazyLoad()
execute 'edit' lastfile
endif
endif
Expand Down

0 comments on commit fb6ee31

Please sign in to comment.