Skip to content

Commit

Permalink
fix: update .tmux.conf, nvim_cmp.lua, vimrc
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangyinzuo committed Jun 24, 2024
1 parent 3565bf3 commit be8a403
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 43 deletions.
21 changes: 10 additions & 11 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ if has('autocmd') " vim-tiny does not have autocmd
set cmdheight=2 " cmd行高2, 减少hit-enter
set wildmenu " command自动补全时显示菜单
if v:version >= 900 || has('nvim')
if has('patch-9.1.463') || has('nvim')
set completeopt+=fuzzy
" TODO: wait for https://github.com/neovim/neovim/pull/29429
if has('patch-9.1.503') " || has('nvim-0.11.0')
set completeopt+=fuzzy,fuzzycollect
endif
set wildoptions=pum " 显示popup window
else
Expand Down Expand Up @@ -155,20 +156,18 @@ if has('autocmd') " vim-tiny does not have autocmd
if has("patch-8.1.0360")
set diffopt=vertical,filler,context:3,indent-heuristic,algorithm:patience,internal
endif
command -nargs=0 DiffthisPlain :diffthis | setf text
command -nargs=0 DiffthisSetfiletypeText :diffthis | setf text
command -nargs=0 DiffoffRestoreFiletype :diffoff | edit
""""""""""""""""""""" termdebug
set t_Co=256
set t_ut=
if has('nvim') || v:version >= 801
autocmd Filetype c,cpp,rust,cuda ++once packadd termdebug
if v:version >= 801
autocmd Filetype c,cpp,rust,cuda ++once if !exists(':Termdebug') | packadd termdebug | endif
if exists('&termwinsize')
autocmd Filetype termdebug setlocal termwinsize=0*10000
endif
let g:termdebug_config = {}
let g:termdebug_config['command'] = "gdb"
" 设置一个较大的宽度,防止termdebug gdb窗口折行
let g:termdebug_config['wide'] = 1
" wide: 设置一个较大的宽度,防止termdebug gdb窗口折行
let g:termdebug_config = {'command': 'gdb', 'wide': 1}
endif
""""""""""""""""""""""""""""""""""""""""""""""""""" Netrw Plugin
" http://vimcasts.org/blog/2013/01/oil-and-vinegar-split-windows-and-project-drawer/
Expand All @@ -195,10 +194,10 @@ if has('autocmd') " vim-tiny does not have autocmd
" #gpt4-answer
" jump to the previous function
" 向后(b表示backward)搜索一个匹配特定模式的地方,这个模式是一个函数的开始位置。
autocmd FileType c,cpp nnoremap <silent> [f :call search('\(\(if\\|for\\|while\\|switch\\|catch\)\_s*\)\@64<!(\_[^)]*)\_[^;{}()]*\zs{', "bw")<CR>
autocmd FileType c,cpp nnoremap <silent> <buffer> [f :call search('\(\(if\\|for\\|while\\|switch\\|catch\)\_s*\)\@64<!(\_[^)]*)\_[^;{}()]*\zs{', "bw")<CR>
" jump to the next function
" 向前(w表示forward)搜索一个匹配特定模式的地方,这个模式是一个函数的开始位置。
autocmd FileType c,cpp nnoremap <silent> ]f :call search('\(\(if\\|for\\|while\\|switch\\|catch\)\_s*\)\@64<!(\_[^)]*)\_[^;{}()]*\zs{', "w")<CR>
autocmd FileType c,cpp nnoremap <silent> <buffer> ]f :call search('\(\(if\\|for\\|while\\|switch\\|catch\)\_s*\)\@64<!(\_[^)]*)\_[^;{}()]*\zs{', "w")<CR>
" 搜索的模式是一个正则表达式,用来匹配不是在if, for, while, switch, 和catch后面的左花括号{,因为在C++中函数的定义是以左花括号开始的。
" 需要注意的是,这个搜索模式可能并不完全精确,因为函数的定义还可能包含许多其他的复杂性,比如模板函数,函数指针,宏定义等等。对于一些简单的代码文件,这个方法通常可以工作得很好。
" 这些配置会更好地在代码中快速导航,但如果你需要更精确地识别函数,你可能需要考虑使用一些更高级的插件,比如ctags,cscope等等。
Expand Down
6 changes: 4 additions & 2 deletions root/.config/nvim/lua/nvim_cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,16 @@ function M.nvim_cmp()
elseif has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
fallback() -- The fallback function sends a already mapped key.
end
end, { "i", "s" }),
["<C-k>"] = cmp.mapping(function()
["<C-k>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_prev_item()
if vim.snippet.active({ direction = -1 }) then
feedkey("<cmd>lua vim.snippet.jump(-1)<CR>", "")
else
fallback() -- The fallback function sends a already mapped key.
end
end, { "i", "s" }),
}),
Expand Down
7 changes: 5 additions & 2 deletions root/.tmux.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Ubuntu18.04默认安装tmux2.6
# tmux2.6中,使用fzf的CTRL-R快捷键会卡死,请手动运行 cd ~/vimrc && ./install/build_tmux_from_source.sh安装
# tmux2.6中,使用fzf的CTRL-R快捷键会卡死,请手动运行 cd ~/vimrc && ./install/build_tmux.sh安装
#
# 在bash中使用 tmux source-file ~/.tmux.conf 重新加载配置
# 或者在tmux中使用 <C-b>:source-file ~/.tmux.conf 重新加载配置

set-window-option -g mode-keys vi # tmux2.1+
setw -g mode-keys vi # tmux1.8
set-option -g history-limit 20000
set -g history-limit 40000

bind-key C-e run-shell "~/vimrc/root/scripts/vim-edit-tmux-output"

Expand Down
28 changes: 15 additions & 13 deletions root/.vim/doc/docker.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
vim:ft=help
*docker* |nvidia-docker|
*docker*

-------------------------------------------------------------------------------
*nvidia-docker*

nvidia-docker 被achieved了,使用 *nvidia-container-toolkit*
- https://github.com/NVIDIA/nvidia-docker
- https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
- https://www.howtogeek.com/devops/how-to-use-an-nvidia-gpu-with-docker-containers/


https://hub.docker.com/r/nvidia/cuda

nvidia-docker使用nvidia-smi,需要容器能访问GPU
>
docker run --gpus all -it nvidia/cuda:11.0-base nvidia-smi
<

-------------------------------------------------------------------------------

Ubuntu 18.04安装 docker
https://roychou121.github.io/2020/07/13/ubuntu-install-docker/
Expand Down Expand Up @@ -119,18 +133,6 @@ Docker build 过程中 apt-get update ~
--build-arg "HTTPS_PROXY=http://proxy.example.com:8080/" \
--network host # 可能需要
<
-------------------------------------------------------------------------------

*nvidia-docker*

https://hub.docker.com/r/nvidia/cuda

nvidia-docker使用nvidia-smi,需要容器能访问GPU
>
docker run --gpus all -it nvidia/cuda:11.0-base nvidia-smi
<


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

Expand Down
23 changes: 11 additions & 12 deletions root/.vim/vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ if has('autocmd') " vim-tiny does not have autocmd
set cmdheight=2 " cmd行高2, 减少hit-enter
set wildmenu " command自动补全时显示菜单
if v:version >= 900 || has('nvim')
if has('patch-9.1.463') || has('nvim')
set completeopt+=fuzzy
" TODO: wait for https://github.com/neovim/neovim/pull/29429
if has('patch-9.1.503') " TODO: remove comment || has('nvim-0.11.0')
set completeopt+=fuzzy,fuzzycollect
endif
set wildoptions=pum " 显示popup window
else
Expand Down Expand Up @@ -236,23 +237,21 @@ if has('autocmd') " vim-tiny does not have autocmd
set undofile
endif
"""""""""""""""""""""""""""""""
if has("patch-8.1.0360")
if has("patch-8.1.0360") " nvim also has this patch
set diffopt=vertical,filler,context:3,indent-heuristic,algorithm:patience,internal
endif
command -nargs=0 DiffthisPlain :diffthis | setf text
command -nargs=0 DiffthisSetfiletypeText :diffthis | setf text
command -nargs=0 DiffoffRestoreFiletype :diffoff | edit
""""""""""""""""""""" termdebug
set t_Co=256
set t_ut=
if has('nvim') || v:version >= 801
autocmd Filetype c,cpp,rust,cuda ++once packadd termdebug
if v:version >= 801
autocmd Filetype c,cpp,rust,cuda ++once if !exists(':Termdebug') | packadd termdebug | endif
if exists('&termwinsize')
autocmd Filetype termdebug setlocal termwinsize=0*10000
endif
let g:termdebug_config = {}
let g:termdebug_config['command'] = "gdb"
" 设置一个较大的宽度,防止termdebug gdb窗口折行
let g:termdebug_config['wide'] = 1
" wide: 设置一个较大的宽度,防止termdebug gdb窗口折行
let g:termdebug_config = {'command': 'gdb', 'wide': 1}
endif
""""""""""""""""""""""""""""""""""""""""""""""""""" Netrw Plugin
" http://vimcasts.org/blog/2013/01/oil-and-vinegar-split-windows-and-project-drawer/
Expand All @@ -279,10 +278,10 @@ if has('autocmd') " vim-tiny does not have autocmd
" #gpt4-answer
" jump to the previous function
" 向后(b表示backward)搜索一个匹配特定模式的地方,这个模式是一个函数的开始位置。
autocmd FileType c,cpp nnoremap <silent> [f :call search('\(\(if\\|for\\|while\\|switch\\|catch\)\_s*\)\@64<!(\_[^)]*)\_[^;{}()]*\zs{', "bw")<CR>
autocmd FileType c,cpp nnoremap <silent> <buffer> [f :call search('\(\(if\\|for\\|while\\|switch\\|catch\)\_s*\)\@64<!(\_[^)]*)\_[^;{}()]*\zs{', "bw")<CR>
" jump to the next function
" 向前(w表示forward)搜索一个匹配特定模式的地方,这个模式是一个函数的开始位置。
autocmd FileType c,cpp nnoremap <silent> ]f :call search('\(\(if\\|for\\|while\\|switch\\|catch\)\_s*\)\@64<!(\_[^)]*)\_[^;{}()]*\zs{', "w")<CR>
autocmd FileType c,cpp nnoremap <silent> <buffer> ]f :call search('\(\(if\\|for\\|while\\|switch\\|catch\)\_s*\)\@64<!(\_[^)]*)\_[^;{}()]*\zs{', "w")<CR>
" 搜索的模式是一个正则表达式,用来匹配不是在if, for, while, switch, 和catch后面的左花括号{,因为在C++中函数的定义是以左花括号开始的。
" 需要注意的是,这个搜索模式可能并不完全精确,因为函数的定义还可能包含许多其他的复杂性,比如模板函数,函数指针,宏定义等等。对于一些简单的代码文件,这个方法通常可以工作得很好。
" 这些配置会更好地在代码中快速导航,但如果你需要更精确地识别函数,你可能需要考虑使用一些更高级的插件,比如ctags,cscope等等。
Expand Down
7 changes: 4 additions & 3 deletions root/.vim/vimrc.d/plugin_setup.vim
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ if has('nvim') || v:version >= 800
let g:rainbow_comment_prefix = '#'
" 不显示行列位置,防止覆盖search mode下的shortmess提示信息
let g:disable_rainbow_hover = 1
" 禁用rainbow_csv的高亮
" let g:rcsv_colorlinks = ['NONE', 'NONE']

if has('patch-9.1.497') || has('nvim')
" 禁用rainbow_csv的高亮
let g:rcsv_colorlinks = ['NONE', 'NONE']
endif
let g:open_gitdiff_exclude_patterns = ['\.pdf$', '\.jpg$', '\.png$', '\.eps$']
let g:open_gitdiff_qf_nmaps = {'open': '<leader>df', 'next': '<leader>dn', 'prev': '<leader>dp'}
let command_def = 'command -nargs=* '
Expand Down

0 comments on commit be8a403

Please sign in to comment.