Skip to content

Commit

Permalink
fix: remove nvim-dap-lldb, update lsp keymaps
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangyinzuo committed May 26, 2024
1 parent 703b521 commit 384d3b6
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 40 deletions.
15 changes: 15 additions & 0 deletions install/sync-llvm-vim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# LLVM Project
for vimscript in llvm.vim mir.vim tablegen.vim ; do
( wget --output-document root/.vim/ftplugin/$vimscript https://github.com/llvm/llvm-project/raw/main/llvm/utils/vim/ftplugin/$vimscript )
done
for vimscript in llvm.vim mir.vim tablegen.vim llvm-lit.vim ; do
( wget --output-document root/.vim/ftdetect/$vimscript https://github.com/llvm/llvm-project/raw/main/llvm/utils/vim/ftdetect/$vimscript )
done
for vimscript in llvm.vim machine-ir.vim mir.vim tablegen.vim ; do
( wget --output-document root/.vim/syntax/$vimscript https://github.com/llvm/llvm-project/raw/main/llvm/utils/vim/syntax/$vimscript )
done
for vimscript in llvm.vim ; do
( wget --output-document root/.vim/indent/$vimscript https://github.com/llvm/llvm-project/raw/main/llvm/utils/vim/indent/$vimscript )
done

wait
1 change: 1 addition & 0 deletions install/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function install_vim() {
function install_nvm() {
# install nodejs
# alternative: n
# Ubuntu18.04安装node20的一种方案: https://github.com/nodesource/distributions/issues/1392#issuecomment-1815887430
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
prompt=$prompt"
=== Node.js ===
Expand Down
22 changes: 12 additions & 10 deletions root/.config/nvim/lua/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,22 @@ function M.lspconfig()
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap = true, silent = true, buffer = ev.buf }
vim.keymap.set("n", "<leader>gD", vim.lsp.buf.declaration, bufopts)
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, bufopts)
vim.keymap.set("n", "<leader>K", vim.lsp.buf.hover, bufopts)
vim.keymap.set("n", "<leader>gi", vim.lsp.buf.implementation, bufopts)
vim.keymap.set("n", "grD", vim.lsp.buf.declaration, bufopts)
vim.keymap.set("n", "grd", vim.lsp.buf.definition, bufopts)
-- vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
vim.keymap.set("n", "gri", vim.lsp.buf.implementation, bufopts)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
-- vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, bufopts)
-- vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
-- vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, bufopts)
-- vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
-- vim.keymap.set("n", "<space>wl", function()
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
-- end, bufopts)
vim.keymap.set("n", "<leader>gt", vim.lsp.buf.type_definition, bufopts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, bufopts)
vim.keymap.set({ "n", "v" }, "<leader>ac", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, bufopts)
vim.keymap.set("n", "grt", vim.lsp.buf.type_definition, bufopts)
if vim.version.ge({ 0, 10, 0 }, vim.version()) then
vim.keymap.set("n", "grn", vim.lsp.buf.rename, bufopts)
vim.keymap.set({ "n", "x" }, "gra", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "grr", vim.lsp.buf.references, bufopts)
end
vim.keymap.set("n", "<leader>fmt", function()
vim.lsp.buf.format({ async = true })
end, bufopts)
Expand Down
4 changes: 0 additions & 4 deletions root/.config/nvim/lua/plugins/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ if vim.g.vim_dap == "nvim-dap" then
commented = true,
},
},
{
"julianolf/nvim-dap-lldb",
dependencies = { "mfussenegger/nvim-dap" },
},
}
else
return {}
Expand Down
5 changes: 5 additions & 0 deletions root/.vim/doc/centos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vim:ft=help
===================================================================
*yum*

yum clean all 清除所有缓存
15 changes: 14 additions & 1 deletion root/.vim/doc/docker.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vim:ft=help
*docker* |nvidia-docker|

Ubuntu 18.04安装 docker
Expand Down Expand Up @@ -42,7 +43,8 @@ https://roychou121.github.io/2020/07/13/ubuntu-install-docker/
]
}
<
阿里云也可以先docker login --username=xxx registry.cn-hangzhou.aliyuncs.com
阿里云容器镜像服务 ACR
也可以先docker login --username=xxx registry.cn-hangzhou.aliyuncs.com


重启docker
Expand Down Expand Up @@ -123,3 +125,14 @@ nvidia-docker使用nvidia-smi,需要容器能访问GPU
>
docker run --gpus all -it nvidia/cuda:11.0-base nvidia-smi
<


-------------------------------------------------------------------------------
Docker run 示例 ~

开发OpenGauss使用的创建容器命令
>
docker run -it --name jyz-openeuler --network=host --privileged -e http_proxy=http://localhost:3128 -e https_proxy=http://localhost:3128 -e LANG=$LANG -e LC_ALL=$LC_ALL -v /usr3/jiangyinzuo_data:/data openeuler/openeuler:22.03
bash
docker run -it --name jyz-centos7.6 --network=host --privileged -e http_proxy=http://localhost:3128 -e https_proxy=http://localhost:3128 -e LANG=$LANG -e LC_ALL=$LC_ALL -v /usr3/jiangyinzuo_data:/data centos:centos7.6.1810 bash
<
6 changes: 6 additions & 0 deletions root/.vim/doc/gdb-coredump.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ vim:ft=help
===============================================================================
*gdb.txt*

-------------------------------------------------------------------------------
gdb插件 ~

- https://github.com/hugsy/gef

-------------------------------------------------------------------------------
step -> step in
next -> step over
finish -> step out
Expand Down
35 changes: 18 additions & 17 deletions root/.vim/ftplugin/java.vim
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
" See: https://github.com/dansomething/coc-java-debug
if g:vimrc_lsp == 'coc.nvim'
" See: https://github.com/dansomething/coc-java-debug
function! JavaStartDebugCallback(err, port)
execute "cexpr! 'Java debug started on port: " . a:port . "'"
call vimspector#LaunchWithSettings({ "configuration": "Java Attach", "AdapterPort": a:port })
endfunction

function! JavaStartDebugCallback(err, port)
execute "cexpr! 'Java debug started on port: " . a:port . "'"
call vimspector#LaunchWithSettings({ "configuration": "Java Attach", "AdapterPort": a:port })
endfunction
function JavaRunDebugMode()
let l:class_name = expand('%:t:r')
execute 'AsyncRun -pos=tab -mode=term -name=' . l:class_name . ' -cwd=' . getcwd() . ' javac -g ' . l:class_name .'.java && java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=y ' . l:class_name
tabp
endfunction

function JavaRunDebugMode()
let l:class_name = expand('%:t:r')
execute 'AsyncRun -pos=tab -mode=term -name=' . l:class_name . ' -cwd=' . getcwd() . ' javac -g ' . l:class_name .'.java && java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=y ' . l:class_name
tabp
endfunction
function JavaStartDebug()
call CocActionAsync('runCommand', 'vscode.java.startDebugSession', function('JavaStartDebugCallback'))
endfunction

function JavaStartDebug()
call CocActionAsync('runCommand', 'vscode.java.startDebugSession', function('JavaStartDebugCallback'))
endfunction

" 调试Java单文件时,先运行JavaRunDebugMode,再运行JavaStartDebug
command -nargs=0 JavaRunDebugMode call JavaRunDebugMode()
command -nargs=0 JavaStartDebug call JavaStartDebug()
" 调试Java单文件时,先运行JavaRunDebugMode,再运行JavaStartDebug
command -nargs=0 JavaRunDebugMode call JavaRunDebugMode()
command -nargs=0 JavaStartDebug call JavaStartDebug()
endif
2 changes: 2 additions & 0 deletions root/.vim/syntax/mir.vim
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ if version >= 508 || !exists("did_c_syn_inits")
endif

HiLink mirSpecialComment SpecialComment

delcommand HiLink
endif

let b:current_syntax = "mir"
16 changes: 8 additions & 8 deletions root/.vim/vimrc.d/coc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ nmap <silent> [d <Plug>(coc-diagnostic-prev)
nmap <silent> ]d <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> <leader>gd <Plug>(coc-definition)
nmap <silent> <leader>gy <Plug>(coc-type-definition)
nmap <silent> <leader>gi <Plug>(coc-implementation)
nmap <silent> grd <Plug>(coc-definition)
nmap <silent> grt <Plug>(coc-type-definition)
nmap <silent> gri <Plug>(coc-implementation)
" See Also: :HelpRg mapping in root/.vim/vimrc.d/fzf.vim
nmap <silent> <leader>gr <Plug>(coc-references)
nmap <silent> grr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> <leader>K :call <SID>show_documentation()<CR>
" Applying code actions to the selected code block
" Example: `<leader>aap` for current paragraph
xmap <leader>ac <Plug>(coc-codeaction-selected)
xmap gra <Plug>(coc-codeaction-selected)
" Remap keys for applying code actions at the cursor position
nmap <leader>ac <Plug>(coc-codeaction-cursor)
nmap gra <Plug>(coc-codeaction-cursor)
" Remap keys for apply code actions affect whole buffer
nmap <leader>as <Plug>(coc-codeaction-source)
nmap grs <Plug>(coc-codeaction-source)
" Apply the most preferred quickfix action to fix diagnostic on the current line
nmap <leader>qf <Plug>(coc-fix-current)
Expand All @@ -70,7 +70,7 @@ nmap <silent> <leader>re <Plug>(coc-codeaction-refactor-selected)
" Run the Code Lens action on the current line
nmap <leader>cl <Plug>(coc-codelens-action)
nmap <leader>rn <Plug>(coc-rename)
nmap grn <Plug>(coc-rename)
nmap <leader>fmt <Plug>(coc-format)
xmap <leader>fmt <Plug>(coc-format-selected)
Expand Down

0 comments on commit 384d3b6

Please sign in to comment.