diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 5df0352..05c6988 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -114,7 +114,6 @@ function sidebarBlog() { { text: "自动登陆", link: "/blog/linux-auto-login" }, { text: "挂载小技巧", link: "/blog/linux-mount" }, { text: "网络管理", link: "/blog/linux-networkmanager" }, - { text: "分区 & 格式化", link: "/blog/linux-partition-format" }, { text: "zram & swap", link: "/blog/linux-zram" }, ], }, @@ -141,7 +140,6 @@ function sidebarBlog() { text: "IDE", collapsed: false, items: [ - { text: "Vim 配置", link: "/blog/vim" }, { text: "VsCode 配置", link: "/blog/vscode" }, { text: "Windows Neovim 配置", link: "/blog/windows-neovim-c" }, ], diff --git a/docs/blog/archlinux-config.md b/docs/blog/archlinux-config.md index 0f56cd0..9d7b84a 100644 --- a/docs/blog/archlinux-config.md +++ b/docs/blog/archlinux-config.md @@ -1,14 +1,4 @@ ---- -title: ArchLinux 安装后配置 -date: 2022-08-03 14:46:23 -tags: - - Linux -categories: - - ArchLinux -cover: https://pic.3gbizhi.com/2020/0827/20200827012846681.jpg -feature: false ---- -# {{ $frontmatter.title }} +# ArchLinux 安装后配置 ArchLinux 安装后并不是完事大吉了,还需要好好配置才能愉快的进行使用。 @@ -43,7 +33,7 @@ ArchLinux 安装后并不是完事大吉了,还需要好好配置才能愉快 若安装失败,可以参考[GnuPG-2.1 与 pacman 密钥环](https://www.archlinuxcn.org/gnupg-2-1-and-the-pacman-keyring/)重新生成密钥环。 -### 配置[aur](https://wiki.archlinux.org/title/Arch_User_Repository_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)) +### 配置[aur]() ```shell sudo pacman -S yay @@ -63,7 +53,7 @@ yay -S mkinitcpio-firmware ### 配置X11环境 -1. 安装[xorg](https://wiki.archlinux.org/title/Xorg_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)): +1. 安装[xorg](): ```shell yay -S xorg-server xorg-xinit @@ -107,6 +97,7 @@ wayland本身只是个协议,并不提供图形环境,因此需要安装混 ``` 其他桌面环境自行搜索:[wayland](https://wiki.archlinux.org/title/Wayland) + > 某些应用程序是支持wayland协议,但是默认却走的xwayland,导致显示效果很不理想,可以设置环境变量或配置文件使其走wayland协议 3. Firefox: @@ -201,7 +192,7 @@ wayland本身只是个协议,并不提供图形环境,因此需要安装混 ## 安装输入法 -1. 安装[fcitx5](https://wiki.archlinux.org/title/Fcitx5_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)): +1. 安装[fcitx5](): ```shell yay -S fcitx5 fcitx5-chinese-addons fcitx5-gtk fcitx5-configtool @@ -236,7 +227,7 @@ wayland本身只是个协议,并不提供图形环境,因此需要安装混 ### golang -1. 安装[go](https://wiki.archlinux.org/title/Go_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)): +1. 安装[go](): ```shell yay -S go @@ -286,6 +277,7 @@ wayland本身只是个协议,并不提供图形环境,因此需要安装混 `powerdevil`:电源管理模块,系统设置中的电源管理 `kwalletmanager`:KDE 钱包管理,一般用来禁用电子钱包 `konsole`:KDE 的仿真终端 + 2. 基本安装: 基本安装并不代表最小化安装,基本安装会附带很多程序,如桌面小工具、discover等 diff --git a/docs/blog/archlinux-install-nvidia.md b/docs/blog/archlinux-install-nvidia.md index 809ba47..ce3cedb 100644 --- a/docs/blog/archlinux-install-nvidia.md +++ b/docs/blog/archlinux-install-nvidia.md @@ -1,15 +1,4 @@ ---- -title: ArchLinux 安装 Nvidia 驱动 -date: 2022-08-05 14:46:32 -tags: - - Linux -categories: - - ArchLinux -cover: https://pic.3gbizhi.com/2020/1011/20201011011357445.jpg -feature: false ---- - -# {{ $frontmatter.title }} +# ArchLinux 安装 Nvidia 驱动 Nvidia 的开源驱动(nouveau)是作为逆向工程开发的,性能毕竟比不上闭源驱动,本篇教程将教大家在 ArchLinux 上安装闭源驱动。 diff --git a/docs/blog/cmake-advanced.md b/docs/blog/cmake-advanced.md index 40b19ea..9a4db02 100644 --- a/docs/blog/cmake-advanced.md +++ b/docs/blog/cmake-advanced.md @@ -1,16 +1,4 @@ ---- -title: CMake 进阶用法 -date: 2022-09-08 19:46:21 -tags: - - CMake - - Qt -categories: - - Development -cover: https://pic.3gbizhi.com/2020/0816/20200816070447569.jpg -feature: true ---- - -# {{ $frontmatter.title }} +# CMake 进阶用法 使用 CMake 创建一个简单的基于 Qt 的开发库,并且逐步添加单元测试和文档示例(doxygen)。 diff --git a/docs/blog/cmake-basic.md b/docs/blog/cmake-basic.md index 1d070e3..bd13193 100644 --- a/docs/blog/cmake-basic.md +++ b/docs/blog/cmake-basic.md @@ -1,16 +1,4 @@ ---- -title: CMake 基础用法 -date: 2022-09-07 19:36:43 -tags: - - CMake - - Qt -categories: - - Development -cover: https://pic.3gbizhi.com/2019/0923/20190923050727803.jpg -feature: false ---- - -# {{ $frontmatter.title }} +# CMake 基础用法 创建 CMake 项目大概需要以下几步: diff --git a/docs/blog/deepin-repair-system.md b/docs/blog/deepin-repair-system.md index 4f45450..82be017 100644 --- a/docs/blog/deepin-repair-system.md +++ b/docs/blog/deepin-repair-system.md @@ -1,14 +1,4 @@ ---- -title: Deepin 系统修复 -date: 2022-07-12 15:36:36 -tags: - - Linux -categories: - - Deepin -cover: https://pic.3gbizhi.com/2019/0912/20190912025700341.jpg -feature: false ---- -# {{ $frontmatter.title }} +# Deepin 系统修复 Deepin 系统是一个基于 debian 的操作系统(UOS 为其专业版),最近发现很多小伙伴在升级时可能导致系统崩溃,无法进入的情况,这里提供一个通用的修复方法。一般升级出现的问题都是系统核心模块没有正常升级导致(通常是 systemd);这里的修复方法是通过 live 系统对 Deepin 本身的文件系统进行挂载,然后 chroot 进去进行再次更新来进行修复。 @@ -60,4 +50,5 @@ chroot:这是一个命令,目的是切换根目录,将某个目录当作 ``` 当执行`apt update`可能会出现无法获取仓库源的情况,这是由于 live 系统未激活导致,但是一般会出现`dpkg --configure -a`的提示,此时使用该命令再次更新即可。 + 9. 至此,Deepin 系统已经成功进行再次更新,然后按`ctrl+d`退出 chroot 环境,最后使用`sudo reboot`重启系统进行 Deepin 就可以查看是否正常了 diff --git a/docs/blog/git.md b/docs/blog/git.md index 8c1e90a..53360fa 100644 --- a/docs/blog/git.md +++ b/docs/blog/git.md @@ -1,15 +1,4 @@ ---- -title: git 命令使用方法 -date: 2022-08-13 19:46:11 -tags: - - Tool - - Windows -categories: - - Tool -cover: https://pic.3gbizhi.com/2020/1104/20201104025420867.jpg -feature: false ---- -# {{ $frontmatter.title }} +# git 命令使用方法 本文章只提供一些不常见的用法,对于 git 基本用法,网上教程很多,这里不再赘述。 diff --git a/docs/blog/latex.md b/docs/blog/latex.md index 8a7254a..838327e 100644 --- a/docs/blog/latex.md +++ b/docs/blog/latex.md @@ -1,15 +1,4 @@ ---- -title: Latex 环境配置 -date: 2023-01-17 18:52:54 -tags: - - Tool -categories: - - Tool -cover: https://pic.3gbizhi.com/2020/0915/20200915093843136.jpg -feature: false ---- - -# {{ $frontmatter.title }} +# Latex 环境配置 ## 安装基础软件 diff --git a/docs/blog/linux-auto-login.md b/docs/blog/linux-auto-login.md index 70d71fe..515f620 100644 --- a/docs/blog/linux-auto-login.md +++ b/docs/blog/linux-auto-login.md @@ -1,14 +1,4 @@ ---- -title: 使用 systemd 实现自动登陆 -date: 2022-09-16 15:59:35 -tags: - - Linux -categories: - - Linux -cover: https://pic.3gbizhi.com/2019/0909/20190909043921431.jpg -feature: false ---- -# {{ $frontmatter.title }} +# 使用 systemd 实现自动登陆 systemd 是一个 Linux 系统基础组件的集合,提供了一个系统和服务管理器,运行为 PID 1 并负责启动其它程序。使用 systemd 实现自动登录,其实就是开机自启 getty 服务,但默认的服务需要进行修改才能实现该功能。 diff --git a/docs/blog/linux-mount.md b/docs/blog/linux-mount.md index bf81834..f764299 100644 --- a/docs/blog/linux-mount.md +++ b/docs/blog/linux-mount.md @@ -1,14 +1,4 @@ ---- -title: Linux 磁盘挂载 -date: 2022-09-10 16:06:43 -tags: - - Linux -categories: - - Linux -cover: https://pic.3gbizhi.com/2014/0504/20140504053231302.jpg -feature: false ---- -# {{ $frontmatter.title }} +# Linux 磁盘挂载 这里提供一些在 Linux 环境下磁盘挂载小技巧。 diff --git a/docs/blog/linux-networkmanager.md b/docs/blog/linux-networkmanager.md index 9ae7d4a..27f5d86 100644 --- a/docs/blog/linux-networkmanager.md +++ b/docs/blog/linux-networkmanager.md @@ -1,15 +1,4 @@ ---- -title: NetworkManager 一些技巧 -date: 2023-01-09 11:48:39 -tags: - - Linux - - NetworkManager -categories: - - Linux -cover: https://pic.3gbizhi.com/2020/1214/20201214113105310.jpg -feature: false ---- -# {{ $frontmatter.title }} +# NetworkManager 一些技巧 NetworkManager 是一个为系统提供检测和配置功能以便自动连接到网络的程序。NetworkManager 的功能对无线和有线网络都很有用。 diff --git a/docs/blog/linux-partition-format.md b/docs/blog/linux-partition-format.md deleted file mode 100644 index 49b14b6..0000000 --- a/docs/blog/linux-partition-format.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: Linux 环境下分区和格式化 -date: 2023-02-18 20:26:23 -tags: - - Linux - - Partition -categories: - - Linux -cover: https://pic.3gbizhi.com/2020/0828/20200828064600253.jpg -feature: false ---- -# {{ $frontmatter.title }} - -很多小伙伴对 Linux 环境下分区和格式化不是很熟悉,本篇文章将教大家如何在 Linux 环境下进行分区和格式化。 - -在 Linux 环境下,一切皆文件,包括磁盘设备,也会被映射为设备文件,所以若想正常使用一块磁盘,需要先找到磁盘设备文件,然后对其进行分区和格式化,最后才能进行存储和使用。 - -### 分区 - -在 Linux 环境下进行分区,本人喜欢使用 gnu 工具集里面的 fdisk,如果喜欢使用其他工具,可自行查看文档。 - -1. 首先查找当前的设备: - - ```shell - lsblk -f - ``` - -### 格式化 diff --git a/docs/blog/linux-zram.md b/docs/blog/linux-zram.md index 597812e..c7824d8 100644 --- a/docs/blog/linux-zram.md +++ b/docs/blog/linux-zram.md @@ -1,15 +1,4 @@ ---- -title: 使用zram创建swap分区 -date: 2022-08-23 18:33:27 -tags: - - Linux -categories: - - Linux -cover: https://pic.3gbizhi.com/2020/1020/20201020112257666.jpg -feature: false ---- - -# {{ $frontmatter.title }} +# 使用zram创建swap分区 使用 zram 作为交换空间,与常规的基于分区或基于文件的交换空间做的事情相同。当内存压力过大时,一些最近使用最少的数据会被移到交换空间。平均来说,它会被压缩到其原始大小的 50% 左右,并被放置在内存的 zram 空间中。这比将这些内存页存储在硬盘上要快得多,并可以释放出它所使用的内存用于其他用途。 diff --git a/docs/blog/qemu.md b/docs/blog/qemu.md index 951f478..5a061b5 100644 --- a/docs/blog/qemu.md +++ b/docs/blog/qemu.md @@ -1,16 +1,4 @@ ---- -title: 如何优雅的使用 qemu-kvm -date: 2022-06-08 19:16:16 -tags: - - Linux - - Tool -categories: - - Linux -cover: https://pic.3gbizhi.com/2020/1010/20201010015227581.jpg -feature: false ---- - -# {{ $frontmatter.title }} +# 如何优雅的使用 qemu-kvm 作为开发人员,往往需要在各种环境中进行调试,由于硬件资源的限制,调试环境的配置,往往需要花费大量的时间,本篇文章旨在使用 qemu-kvm 来配置各种调试环境,并且合理使用快照功能来实现各个环境的切换。 diff --git a/docs/blog/qt-tips.md b/docs/blog/qt-tips.md index 8e59b18..f191861 100644 --- a/docs/blog/qt-tips.md +++ b/docs/blog/qt-tips.md @@ -1,15 +1,4 @@ ---- -title: Qt 提升代码质量的方法 -date: 2022-08-25 19:34:32 -tags: - - Qt - - C++ -categories: - - Development -cover: https://pic.3gbizhi.com/2020/0827/20200827012845413.jpg -feature: false ---- -# {{ $frontmatter.title }} +# Qt 提升代码质量的方法 1. 不需要的头文件不要包含 2. 尽量使用前置声明,而非一味的包头文件 diff --git a/docs/blog/toc.md b/docs/blog/toc.md index d7e25ea..512f9fc 100644 --- a/docs/blog/toc.md +++ b/docs/blog/toc.md @@ -1,8 +1,4 @@ ---- -title: 目录 ---- - -# {{ $frontmatter.title }} +# 目录 1. Linux 1. ArchLinux @@ -16,8 +12,7 @@ title: 目录 3. [自动登陆](linux-auto-login) 4. [挂载小技巧](linux-mount) 5. [网络管理](linux-networkmanager) - 6. [分区 & 格式化](linux-partition-format) - 7. [zram & swap](linux-zram) + 6. [zram & swap](linux-zram) 2. Develop 1. [CMake 基础用法](cmake-basic) 2. [CMake 进阶用法](cmake-advanced) @@ -28,6 +23,5 @@ title: 目录 3. [Qemu 工具](qemu) 4. [clash 配置](clash) 4. IDE - 1. [Vim 配置](vim) - 2. [VsCode 配置](vscode) - 3. [Windows Neovim 配置](windows-neovim-c) + 1. [VsCode 配置](vscode) + 2. [Windows Neovim 配置](windows-neovim-c) diff --git a/docs/blog/vim.md b/docs/blog/vim.md deleted file mode 100644 index 6c01f7c..0000000 --- a/docs/blog/vim.md +++ /dev/null @@ -1,492 +0,0 @@ ---- -title: vim 配置 -date: 2022-08-17 19:20:26 -tags: - - Tool -categories: - - Tool -cover: https://pic.3gbizhi.com/2020/0824/20200824113617612.jpg -feature: false ---- -# {{ $frontmatter.title }} - -## 保存时获得sudo权限 - -```shell -:w !sudo tee % -``` - -1. 命令:`w !{cmd}`,让 `vim` 执行一个外部命令{cmd},然后把当前缓冲区的内容从 stdin 传入。 -2. `tee` 是一个把 `stdin` 保存到文件的小工具。 -3. 而 `%`,是`vim`当中一个只读寄存器的名字,总保存着当前编辑文件的文件路径。 - -## 简单高效的vim配置 - -创建`~/.vimrc`文件并输入: - -```vim -set nocompatible " 关闭兼容模式 -syntax enable " 语法高亮 -" 开启文件类型侦测 -filetype on -" 根据侦测到的不同类型加载对应的插件 -filetype plugin on " 文件类型插件 -filetype indent on -set autoindent -autocmd BufEnter * :syntax sync fromstart -" 设置背景透明 -hi Normal ctermfg=252 ctermbg=none - -set nu " 显示行号 -set showcmd " 显示命令 -set lz " 当运行宏时,在命令执行完成之前,不重绘屏幕 -set hid " 可以在没有保存的情况下切换buffer -set backspace=eol,start,indent -set whichwrap+=<,>,h,l " 退格键和方向键可以换行 -set incsearch " 增量式搜索 -set hlsearch " 搜索时,高亮显示匹配结果。 -" set ignorecase " 搜索时忽略大小写 -set magic " 额,自己:h magic吧,一行很难解释 -set showmatch " 光标遇到圆括号、方括号、大括号时,自动高亮对应的另一个圆括号、方括号和大括号。 -set nowb -set nobackup -set noswapfile " 不使用swp文件,注意,错误退出后无法恢复 -set lbr " 在breakat字符处而不是最后一个字符处断行 -set ai " 自动缩进 -set si " 智能缩进 -set cindent " C/C++风格缩进 - -"命令模式下,底部操作指令按下 Tab 键自动补全。第一次按下 Tab,会显示所有匹配的操作指令的清单;第二次按下 Tab,会依次选择各个指令。 -set wildmenu -set wildmode=longest:list,full - -set nofen -set fdl=10 -" tab转化为4个字符 -set expandtab -set smarttab -set shiftwidth=4 -set tabstop=4 -" 不使用beep或flash -set vb t_vb= -"colorscheme elflord -" 启用256色 -set t_Co=256 -set t_ut=n - -set history=50 " vim记住的历史操作的数量,默认的是20 -set autoread " 当文件在外部被修改时,自动重新读取 -set mouse=a " 在所有模式下都允许使用鼠标,还可以是n,v,i,c等 - -" 光标所在的当前行高亮 -set cursorline -" highlight CursorLine cterm=NONE ctermbg=gray ctermfg=black guibg=NONE guifg=NONE -" highlight CocHighlightText cterm=NONE ctermbg=yellow ctermfg=black guibg=NONE guifg=NONE - - -" 插件窗口的宽度,如TagList,NERD_tree等,自己设置 -let s:PlugWinSize = 28 - -" 自动完成括号和引号 -inoremap 1 ():let leavechar=")"i -inoremap 2 []:let leavechar="]"i -inoremap 3 {}:let leavechar="}"i -inoremap 4 {o}:let leavechar="}"O -inoremap q '':let leavechar="'"i -inoremap w "":let leavechar='"'i - -" 用 */# 向 前/后 搜索光标下的单词 -vnoremap * :call VisualSearch('f') -vnoremap # :call VisualSearch('b') - -" 用c-j,k在buffer之间切换 -nn :bn -nn :bp -nn :b1 - -" ================================================== -" 快捷键运行脚本 -" ================================================== -" 运行python3脚本 -map :call RunPython() -func! RunPython() - exec "W" - if &filetype == 'python' - exec "!time python3 %" - endif -endfunc -``` - -## 配置C/C++开发环境 - -1. 安装基础包 - - ```shell - yay -S nodejs npm vim - ``` - -2. 如果使用makefile而不是cmake,还需要安装 - - ```shell - yay -S bear - ``` - - 每次使用`bear make`生成配置文件 - -3. 安装插件管理,强烈推荐`vim-plug` - - ```shell - yay -S vim-plug - ``` - - 或 - - ```shell - curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - ``` - -4. 编写`.vimrc` - -```vim -" 以下每个插件,都可使用https://github.com/***查看其官方介绍 -call plug#begin('~/.vim/plugged') -Plug 'Yggdroot/indentLine' "显示对齐线 -Plug 'scrooloose/nerdtree' "显示文件目录 -Plug 'scrooloose/nerdcommenter' "用于快速高效注释代码 -Plug 'neoclide/coc.nvim', {'branch': 'release'} "基于nodejs的智能补全插件,非常强大 -Plug 'vim-airline/vim-airline' "友好的显示状态栏 -Plug 'peterhoeg/vim-qml' "qml高亮 -Plug 'octol/vim-cpp-enhanced-highlight' "cpp高亮 -Plug 'ryanoasis/vim-devicons' "显示文件类型图标,系统需安装图标字体:yay -S nerd-fonts-complete -Plug 'junegunn/fzf.vim' "文件搜索工具,yay -S fzf the_silver_searcher -call plug#end() - -set nocompatible " 关闭兼容模式 -syntax on " 语法高亮 -" 开启文件类型侦测 -filetype on -" 根据侦测到的不同类型加载对应的插件 -filetype plugin on " 文件类型插件 -filetype indent on -set autoindent -autocmd BufEnter * :syntax sync fromstart -" 设置背景透明 -hi Normal ctermfg=252 ctermbg=none - -set nu " 显示行号 -set showcmd " 显示命令 -set lz " 当运行宏时,在命令执行完成之前,不重绘屏幕 -set hid " 可以在没有保存的情况下切换buffer -set backspace=eol,start,indent -set whichwrap+=<,>,h,l " 退格键和方向键可以换行 -set incsearch " 增量式搜索 -set hlsearch " 搜索时,高亮显示匹配结果。 -" set ignorecase " 搜索时忽略大小写 -set magic " 额,自己:h magic吧,一行很难解释 -set showmatch " 光标遇到圆括号、方括号、大括号时,自动高亮对应的另一个圆括号、方括号和大括号。 -set nowb -set noswapfile " 不使用swp文件,注意,错误退出后无法恢复 -set lbr " 在breakat字符处而不是最后一个字符处断行 -set ai " 自动缩进 -set si " 智能缩进 -set cindent " C/C++风格缩进 - -"命令模式下,底部操作指令按下 Tab 键自动补全。第一次按下 Tab,会显示所有匹配的操作指令的清单;第二次按下 Tab,会依次选择各个指令。 -set wildmenu -set wildmode=longest:list,full - -set nofen -set fdl=10 -" tab转化为4个字符 -set expandtab -set smarttab -set shiftwidth=4 -set tabstop=4 -" 不使用beep或flash -set vb t_vb= -"set background=dark -"colorscheme elflord -" 启用256色 -set t_Co=256 -set t_ut=n - -set history=50 " vim记住的历史操作的数量,默认的是20 -set autoread " 当文件在外部被修改时,自动重新读取 -set mouse=a " 在所有模式下都允许使用鼠标,还可以是n,v,i,c等 - -" 光标所在的当前行高亮 -set cursorline -" highlight CursorLine cterm=NONE ctermbg=gray ctermfg=black guibg=NONE guifg=NONE -" highlight CocHighlightText cterm=NONE ctermbg=yellow ctermfg=black guibg=NONE guifg=NONE - -" 高亮多余的空白字符及Tab -highlight RedundantSpaces ctermbg=red guibg=red -match RedundantSpaces /\s\+$\| \+\ze\t\|\t/ - -" 插件窗口的宽度,如TagList,NERD_tree等,自己设置 -let s:PlugWinSize = 28 - -" 自动完成括号和引号 -inoremap 1 ():let leavechar=")"i -inoremap 2 []:let leavechar="]"i -inoremap 3 {}:let leavechar="}"i -inoremap 4 {o}:let leavechar="}"O -inoremap q '':let leavechar="'"i -inoremap w "":let leavechar='"'i - -" 用 */# 向 前/后 搜索光标下的单词 -vnoremap * :call VisualSearch('f') -vnoremap # :call VisualSearch('b') - -" 用c-j,k在buffer之间切换 -nn :bn -nn :bp -nn :b1 - -let mapleader=',' - -"---------------------------------------------------- -" indentLine -"---------------------------------------------------- -let g:indentLine_enabled = 1 -let g:indent_guides_guide_size = 1 " 指定对齐线的尺寸 -let g:indent_guides_start_level = 2 " 从第二层开始可视化显示缩进 - -"---------------------------------------------------- -" nerdtree -"---------------------------------------------------- -" 进入 vim 时自动开启 NERDTree -autocmd VimEnter * NERDTree | wincmd p -" 若关闭某个 buff 后 NERDTree 是仅剩的最后一个 buff,则自动关闭 NERDTree -autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif -" 使用PlugWinSize -let NERDTreeWinSize = s:PlugWinSize -" 使用 Ctrl+n 快捷键打开或关闭 NERDTree -nnoremap :NERDTreeToggle - - -"---------------------------------------------------- -" fzf -"---------------------------------------------------- -"fzf快捷键 ctrl+p -nnoremap :Files -nnoremap :Buffers -nnoremap :Ag -" 若需要设置过滤路径: -" yay -S fd -" vim ~/.zshrc -" export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' -" vim ~/.config/fd/ignore -" 输入要过滤的文件或文件夹,如: -" build -" build-Release - -"---------------------------------------------------- -" coc.nvim -"---------------------------------------------------- -" Set internal encoding of vim, not needed on neovim, since coc.nvim using some -" unicode characters in the file autoload/float.vim -set encoding=utf-8 - -" TextEdit might fail if hidden is not set. -set hidden - -" Some servers have issues with backup files, see #649. -set nobackup -set nowritebackup - -" Give more space for displaying messages. -set cmdheight=2 - -" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable -" delays and poor user experience. -set updatetime=300 - -" Don't pass messages to |ins-completion-menu|. -set shortmess+=c - -" Always show the signcolumn, otherwise it would shift the text each time -" diagnostics appear/become resolved. -if has("nvim-0.5.0") || has("patch-8.1.1564") - " Recently vim can merge signcolumn and number column into one - set signcolumn=number -else - set signcolumn=yes -endif - -" Use tab for trigger completion with characters ahead and navigate. -" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by -" other plugin before putting this into your config. -inoremap - \ pumvisible() ? "\" : - \ CheckBackspace() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! CheckBackspace() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use to trigger completion. -if has('nvim') - inoremap coc#refresh() -else - inoremap coc#refresh() -endif - -" Make auto-select the first completion item and notify coc.nvim to -" format on enter, could be remapped by other vim plugin -inoremap pumvisible() ? coc#_select_confirm() - \: "\u\\=coc#on_enter()\" - -" Use `[g` and `]g` to navigate diagnostics -" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation. -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Use K to show documentation in preview window. -nnoremap K :call ShowDocumentation() - -function! ShowDocumentation() - if CocAction('hasProvider', 'hover') - call CocActionAsync('doHover') - else - call feedkeys('K', 'in') - endif -endfunction - -" Highlight the symbol and its references when holding the cursor. -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Symbol renaming. -nmap rn (coc-rename) - -" Formatting selected code. -xmap f (coc-format-selected) -nmap f (coc-format-selected) - -augroup mygroup - autocmd! - " Setup formatexpr specified filetype(s). - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder. - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -" Applying codeAction to the selected region. -" Example: `aap` for current paragraph -xmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" Remap keys for applying codeAction to the current buffer. -nmap ac (coc-codeaction) -" Apply AutoFix to problem on the current line. -nmap qf (coc-fix-current) - -" Run the Code Lens action on the current line. -nmap cl (coc-codelens-action) - -" Map function and class text objects -" NOTE: Requires 'textDocument.documentSymbol' support from the language server. -xmap if (coc-funcobj-i) -omap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) - -" Remap and for scroll float windows/popups. -if has('nvim-0.4.0') || has('patch-8.2.0750') - nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" -endif - -" Use CTRL-S for selections ranges. -" Requires 'textDocument/selectionRange' support of language server. -nmap (coc-range-select) -xmap (coc-range-select) - -" Add `:Format` command to format current buffer. -command! -nargs=0 Format :call CocActionAsync('format') - -" Add `:Fold` command to fold current buffer. -command! -nargs=? Fold :call CocAction('fold', ) - -" Add `:OR` command for organize imports of the current buffer. -command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') - -" Add (Neo)Vim's native statusline support. -" NOTE: Please see `:h coc-status` for integrations with external plugins that -" provide custom statusline: lightline.vim, vim-airline. -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} - -" Mappings for CoCList -" Show all diagnostics. -nnoremap a :CocList diagnostics -" Manage extensions. -nnoremap e :CocList extensions -" Show commands. -nnoremap c :CocList commands -" Find symbol of current document. -nnoremap o :CocList outline -" Search workspace symbols. -nnoremap s :CocList -I symbols -" Do default action for next item. -nnoremap j :CocNext -" Do default action for previous item. -nnoremap k :CocPrev -" Resume latest coc list. -nnoremap p :CocListResume - -"---------------------------------------------------- -" vim-cpp-enhanced-highlight -"---------------------------------------------------- -" 默认情况下禁用类范围的突出显示。 启用设置 -let g:cpp_class_scope_highlight = 1 -" 默认情况下禁用成员变量的突出显示。 启用设置 -let g:cpp_member_variable_highlight = 1 -" 默认情况下,声明中类名的突出显示是禁用的。 启用设置 -let g:cpp_class_decl_highlight = 1 -" 默认情况下禁用 POSIX 函数的突出显示。 启用设置 -let g:cpp_posix_standard = 1 -" 可以突出显示模板功能 -let g:cpp_experimental_template_highlight = 1 -" 启用库概念的突出显示 -let g:cpp_concepts_highlight = 1 -``` - -编写完成后保存,然后执行: - -```vim -:PlugInstall -``` - -等待插件安装完成,安装coc插件: - -```vim -:CocInstall coc-json coc-clangd -``` - -装完之后使用方式,首先cd到项目目录: - -```shell -mkdir build -cd build -cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -``` - -然后使用vim打开项目文件即可正常编辑,可以愉快的享受智能提示及语法高亮了! diff --git a/docs/blog/vscode.md b/docs/blog/vscode.md index 1085ac3..9723ba1 100644 --- a/docs/blog/vscode.md +++ b/docs/blog/vscode.md @@ -1,14 +1,4 @@ ---- -title: VSCode 使用小技巧 -date: 2022-07-15 19:25:56 -tags: - - Tool -categories: - - Tool -cover: https://pic.3gbizhi.com/2020/0822/20200822084929279.jpg -feature: false ---- -# {{ $frontmatter.title }} +# VSCode 使用小技巧 ## vscode中go开发环境配置 diff --git a/docs/blog/windows-neovim-c.md b/docs/blog/windows-neovim-c.md index abb8f24..3a033bf 100644 --- a/docs/blog/windows-neovim-c.md +++ b/docs/blog/windows-neovim-c.md @@ -1,17 +1,4 @@ ---- -title: Neovim + CMake + MSBuild 配置 Windows 开发环境 -date: 2023-01-21 10:16:49 -tags: - - Windows - - Neovim - - C/C++ -categories: - - Windows -cover: https://pic.3gbizhi.com/2020/0817/20200817121447528.png -feature: true ---- - -# {{ $frontmatter.title }} +# Neovim + CMake + MSBuild 配置 Windows 开发环境 为了与 Linux 拥有一致的开发体验,特在此记录:在 Windows 上使用 Neovim + CMake + MSBuild 搭建 C/C++ 环境。