From 993dbd7fa1094ab6637a42aa8f10747c50f9d5bf Mon Sep 17 00:00:00 2001 From: Dmitry Chumak Date: Thu, 27 Feb 2025 19:26:30 +0300 Subject: [PATCH 1/2] updates from ya macbook --- shell/zsh/zshrc | 7 +++++++ vim/coc.vim | 5 +++++ vim/ftplugin/go.vim | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/shell/zsh/zshrc b/shell/zsh/zshrc index db2d811..f38706b 100644 --- a/shell/zsh/zshrc +++ b/shell/zsh/zshrc @@ -19,3 +19,10 @@ if [ -f ~/.zshrc_local ] then source ~/.zshrc_local fi + +# The next line updates PATH for CLI. +if [ -f '/Users/dmchumak/yandex-cloud/path.bash.inc' ]; then source '/Users/dmchumak/yandex-cloud/path.bash.inc'; fi + +# The next line enables shell command completion for yc. +if [ -f '/Users/dmchumak/yandex-cloud/completion.zsh.inc' ]; then source '/Users/dmchumak/yandex-cloud/completion.zsh.inc'; fi + diff --git a/vim/coc.vim b/vim/coc.vim index abfa0d4..6417400 100644 --- a/vim/coc.vim +++ b/vim/coc.vim @@ -43,6 +43,11 @@ nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) +" Remap keys for applying refactor code actions +nmap re (coc-codeaction-refactor) +xmap r (coc-codeaction-refactor-selected) +nmap r (coc-codeaction-refactor-selected) + "set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} " Applying codeAction to the selected region. diff --git a/vim/ftplugin/go.vim b/vim/ftplugin/go.vim index c6de6df..91f004a 100644 --- a/vim/ftplugin/go.vim +++ b/vim/ftplugin/go.vim @@ -1,2 +1,2 @@ -let g:go_imports_autosave = 0 +let g:go_imports_autosave = 1 From d8a74ec47248c67aac82fa0f59f62f551bbc13e0 Mon Sep 17 00:00:00 2001 From: Dmitry Chumak Date: Thu, 27 Feb 2025 20:32:38 +0300 Subject: [PATCH 2/2] system-dependant coc-settings --- vim/coc-lsp/coc-settings-cloudia.json | 14 ++++++++++++++ vim/coc-lsp/coc-settings.json | 5 +++++ vim/{ => coc-lsp}/coc.vim | 0 vim/coc-settings.json | 5 ----- vim/vimrc | 9 ++++++++- 5 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 vim/coc-lsp/coc-settings-cloudia.json create mode 100644 vim/coc-lsp/coc-settings.json rename vim/{ => coc-lsp}/coc.vim (100%) delete mode 100644 vim/coc-settings.json diff --git a/vim/coc-lsp/coc-settings-cloudia.json b/vim/coc-lsp/coc-settings-cloudia.json new file mode 100644 index 0000000..c9a6f8c --- /dev/null +++ b/vim/coc-lsp/coc-settings-cloudia.json @@ -0,0 +1,14 @@ +{ + "inlayHints.enable": false, + "pyright.inlayHints.functionReturnTypes": false, + "pyright.inlayHints.variableTypes": false, + "go.goplsOptions": { + "standaloneTags": ["ignore"], + "arcadiaIndexDirs": [ + "cli/", + "api/", + "gateway/" + ] + }, + "go.goplsPath": "/Users/dmchumak/.ya/tools/v4/gopls-darwin-arm64/gopls" +} diff --git a/vim/coc-lsp/coc-settings.json b/vim/coc-lsp/coc-settings.json new file mode 100644 index 0000000..e480d60 --- /dev/null +++ b/vim/coc-lsp/coc-settings.json @@ -0,0 +1,5 @@ +{ + "inlayHints.enable": false, + "pyright.inlayHints.functionReturnTypes": false, + "pyright.inlayHints.variableTypes": false +} diff --git a/vim/coc.vim b/vim/coc-lsp/coc.vim similarity index 100% rename from vim/coc.vim rename to vim/coc-lsp/coc.vim diff --git a/vim/coc-settings.json b/vim/coc-settings.json deleted file mode 100644 index 6824e94..0000000 --- a/vim/coc-settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "inlayHints.enable": false, - "pyright.inlayHints.functionReturnTypes": false, - "pyright.inlayHints.variableTypes": false -} diff --git a/vim/vimrc b/vim/vimrc index 90b0af5..a17b615 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -39,6 +39,8 @@ noremap :resize -3 set backspace=indent,eol,start filetype plugin indent on +let hostname = substitute(system('hostname'), '\n', '', '') + if empty(glob('~/.vim/autoload/plug.vim')) "Если vim-plug не стоит silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim @@ -178,6 +180,11 @@ let g:ansible_yamlKeyName = 'yamlKey' " " CoC plugin settings " +if hostname == "i113855042" + let g:coc_user_config = '~/.vim/coc-lsp/coc-settings-cloudia.json' +else + let g:coc_user_config = '~/.vim/coc-lsp/coc-settings.json' +endif let g:coc_global_extensions = ['coc-pyright', 'coc-sh', 'coc-go'] function! s:enable_coc_for_type() let l:filesuffix_whitelist = ['py', 'sh', 'go'] @@ -186,7 +193,7 @@ function! s:enable_coc_for_type() endif endfunction autocmd BufRead,BufNewFile * call s:enable_coc_for_type() -source ~/.vim/coc.vim +source ~/.vim/coc-lsp/coc.vim " " vim-sneak plugin settings