mirror of
https://github.com/mattn/vim-lsp-settings.git
synced 2025-12-12 20:35:54 +01:00
Add LspSettingsGlobalEdit
This commit is contained in:
@@ -17,6 +17,10 @@ call remove(s:settings, '$schema')
|
||||
|
||||
let s:ftmap = {}
|
||||
|
||||
function! lsp_settings#data_dir() abort
|
||||
return s:data_dir
|
||||
endfunction
|
||||
|
||||
function! lsp_settings#installer_dir() abort
|
||||
return s:installer_dir
|
||||
endfunction
|
||||
|
||||
@@ -19,6 +19,19 @@ function! lsp_settings#profile#load_local() abort
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! lsp_settings#profile#edit_global() abort
|
||||
let l:root = lsp_settings#data_dir()
|
||||
if !isdirectory(l:root)
|
||||
call mkdir(l:root)
|
||||
endif
|
||||
exe 'new' l:root . '/settings.json'
|
||||
if !filereadable(l:root . '/settings.json')
|
||||
call setline(1, ['{', "\t", '}'])
|
||||
call cursor([2, 2])
|
||||
setlocal nomodified
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! lsp_settings#profile#edit_local() abort
|
||||
let l:root = lsp_settings#root_path(['.vim-lsp-settings'])
|
||||
if !isdirectory(l:root)
|
||||
|
||||
@@ -13,5 +13,6 @@ let g:lsp_settings_root_markers = get(g:, 'lsp_settings_root_markers', [
|
||||
|
||||
command! -nargs=0 LspSettingsStatus call lsp_settings#profile#status()
|
||||
command! -nargs=0 LspSettingsLocalEdit call lsp_settings#profile#edit_local()
|
||||
command! -nargs=0 LspSettingsGlobalEdit call lsp_settings#profile#edit_global()
|
||||
|
||||
call lsp_settings#init()
|
||||
|
||||
Reference in New Issue
Block a user