Skip to content

Commit

Permalink
enhance: update vim options
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangyinzuo committed Aug 28, 2024
1 parent 138902c commit de12e47
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 28 deletions.
11 changes: 4 additions & 7 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
set number "显示行号
if has('autocmd') " vim-tiny does not have autocmd
set nocp "no Vi-compatible
set relativenumber
let g:mapleader = ' '
set modeline " 开启模式行, 读取文件开头结尾类似于 /* vim:set ts=2 sw=2 noexpandtab: */ 的配置
set exrc " 读取当前文件夹的.vimrc
set showcmd " show pressed keys
if v:version >= 800
set bg=dark
else
Expand Down Expand Up @@ -152,14 +154,9 @@ if has('autocmd') " vim-tiny does not have autocmd
set list
" set nowrap " 不折行
set guifont=Monospace\ Regular\ 20
if has("nvim-0.5.0") || has("patch-8.1.1564")
set signcolumn=number " 合并git状态与行号
elseif v:version >= 801
set signcolumn=yes " 同时显示git状态和行号
endif
" vim7.3+
set conceallevel=2
set conceallevel=2 " vim7.3+
if v:version >= 801
set signcolumn=yes " 同时显示git状态和行号
" https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044
" Set to auto read when a file is changed from the outside
set autoread
Expand Down
1 change: 1 addition & 0 deletions cog.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ tag_prefix = "v"
chore = { changelog_title = "Chore", omit_from_changelog = true }
ci = { changelog_title = "CI", omit_from_changelog = true }
docs = { changelog_title = "Docs", omit_from_changelog = true }
enhance = { changelog_title = "Enhance", omit_from_changelog = true }

[changelog]
path = "CHANGELOG.md"
Expand Down
1 change: 1 addition & 0 deletions root/.config/nvim/lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ return {
{
"rmagatti/auto-session",
opts = {
silent_restore = false,
log_level = "error",
args_allow_single_directory = false, -- boolean Follow normal sesion save/load logic if launched with a single directory as the only argument
auto_session_enable_last_session = false,
Expand Down
8 changes: 5 additions & 3 deletions root/.config/nvim/lua/plugins_setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,16 @@ function M.lualine()
lualine_b = lualine_b,
lualine_c = lualine_c,
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
lualine_y = {},
-- file location
lualine_z = { "%l/%L,%v" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { filename },
lualine_x = { "location" },
-- file location
lualine_x = { "%l/%L,%v" },
lualine_y = {},
lualine_z = {},
},
Expand Down
1 change: 1 addition & 0 deletions root/.vim/after/ftplugin/tex.vim
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ setlocal tabstop=2 shiftwidth=2 softtabstop=2
if exists('$WSLENV')
" [[palette]]打开当前tex文件中PDF对应的pptx文件 :OpenPPTX
command -buffer -nargs=0 OpenPPTX call latex#OpenPPTX()
let g:PasteImageFunction = 'latex#LatexPasteImage'
endif
8 changes: 8 additions & 0 deletions root/.vim/autoload/latex.vim
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ function latex#SumatraPDFSendToVim(args)
let l:newargs = join([l:line, ' /mnt/', l:diskname, l:wslpath], '')
execute 'edit +' . l:newargs
endfunction

function latex#LatexPasteImage(relpath)
execute "normal! i\\includegraphics{" . a:relpath . "}\r\\caption{I"
let ipos = getcurpos()
execute "normal! a" . "mage}"
call setpos('.', ipos)
execute "normal! ve\<C-g>"
endfunction
6 changes: 3 additions & 3 deletions root/.vim/doc/c-cpp-cuda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ cuda 12.1

GPU监控 ~

gpustat: `pip install gpustat`
nvtop
nvitop: `pip install nvitop`
*gpustat* `pip install gpustat`
*nvtop*
*nvitop* `pip install nvitop`

【工具篇】如何优雅地监控显卡(GPU)使用情况? - 聚丙烯酰胺的文章 - 知乎 https://zhuanlan.zhihu.com/p/577533593

Expand Down
11 changes: 4 additions & 7 deletions root/.vim/vimrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
set number "显示行号
if has('autocmd') " vim-tiny does not have autocmd
set nocp "no Vi-compatible
set relativenumber
"""""""""""""""""""""" CONFIG """""""""""""""""""""""""""""""""

if filereadable(expand('~/.vim/config.vim'))
Expand All @@ -26,6 +27,7 @@ if has('autocmd') " vim-tiny does not have autocmd
" copied from ftplugin/man.vim
command -nargs=+ -complete=shellcmd Man call dist#man#GetPage(<q-mods>, <f-args>)
endif
set showcmd " show pressed keys
endif
let g:ccls_init_options = { "compilationDatabaseDirectory": "build", "index": { "threads": 0 }, "clang": { "excludeArgs": ["-frounding-math"] }}
" tmux2.2以上才支持true color
Expand Down Expand Up @@ -180,14 +182,9 @@ if has('autocmd') " vim-tiny does not have autocmd
set list
" set nowrap " 不折行
set guifont=Monospace\ Regular\ 20
if has("nvim-0.5.0") || has("patch-8.1.1564")
set signcolumn=number " 合并git状态与行号
elseif v:version >= 801
set signcolumn=yes " 同时显示git状态和行号
endif
" vim7.3+
set conceallevel=2
set conceallevel=2 " vim7.3+
if v:version >= 801
set signcolumn=yes " 同时显示git状态和行号
" https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044
" Set to auto read when a file is changed from the outside
set autoread
Expand Down
8 changes: 0 additions & 8 deletions root/.vim/vimrc.d/plugin_setup.vim
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,7 @@ let g:typst_pdf_viewer = 'SumatraPDF.exe'

let g:mdip_imgdir = '.'
let g:mdip_wsl_path = '\\\\wsl.localhost\\Ubuntu-22.04'
function! g:LatexPasteImage(relpath)
execute "normal! i\\includegraphics{" . a:relpath . "}\r\\caption{I"
let ipos = getcurpos()
execute "normal! a" . "mage}"
call setpos('.', ipos)
execute "normal! ve\<C-g>"
endfunction
" autocmd FileType markdown let g:PasteImageFunction = 'g:MarkdownPasteImage'
autocmd FileType tex let g:PasteImageFunction = 'g:LatexPasteImage'
autocmd FileType markdown,tex nmap <buffer><silent> <leader>pi :call mdip#MarkdownClipboardImage()<CR>
if has('nvim') || v:version >= 802
Expand Down

0 comments on commit de12e47

Please sign in to comment.