From 2f33fee8703c2ccee2cd00b3846802f4bc9df320 Mon Sep 17 00:00:00 2001 From: jamesnulliu Date: Sun, 30 Jun 2024 19:00:29 +0800 Subject: [PATCH] Update VIMRC --- .../index.zh-cn.md | 6 +- .../vimrc | 73 +++++++++++++++++++ 2 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 content/blog/Reset-Windows-And-Install-Ubuntu-Alongside/vimrc diff --git a/content/blog/Reset-Windows-And-Install-Ubuntu-Alongside/index.zh-cn.md b/content/blog/Reset-Windows-And-Install-Ubuntu-Alongside/index.zh-cn.md index 637a43c..edd8437 100644 --- a/content/blog/Reset-Windows-And-Install-Ubuntu-Alongside/index.zh-cn.md +++ b/content/blog/Reset-Windows-And-Install-Ubuntu-Alongside/index.zh-cn.md @@ -134,16 +134,14 @@ sudo apt install -y boot-repair && boot-repair ### 6.1. 安装 VIM -先下载本文同级目录下的 [vimrc]() 文件至 "~". +下载 `vim-gtk3`, 将原始配置文件重命名为 `vimrc.bak`, 然后新建 `vimrc` 文件并写入我们提供的 [vimrc](./vimrc) 内容 (按 `i` 进入 INSERT 模式, 按 `Ctrl-Shift-v` 粘贴, 按 `ESC` 进入 NORMAL 模式, 按 `:` 进入 COMMAND 模式, 输入 `wq` 后按 `ENTER` 保存退出) ```bash sudo apt-get install vim-gtk3 sudo mv /etc/vim/vimrc /etc/vim/vimrc.bak -sudo mv ~/vimrc /etc/vim +sudo vim /etc/vim/vimrc # 写入我们提供的 vimrc 内容 ``` -这个文件是 vim 的配置文件, 开启了一些额外功能. - 如果你不会使用 vim, 安装完后, 请运行下面的指令开始 30 分钟的 vim 速成: ```bash diff --git a/content/blog/Reset-Windows-And-Install-Ubuntu-Alongside/vimrc b/content/blog/Reset-Windows-And-Install-Ubuntu-Alongside/vimrc new file mode 100644 index 0000000..fd58a3c --- /dev/null +++ b/content/blog/Reset-Windows-And-Install-Ubuntu-Alongside/vimrc @@ -0,0 +1,73 @@ +" $VIMRUNTIME refers to the versioned system directory where Vim stores its +" system runtime files -- /usr/share/vim/vim. +" +" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc. +" This happens after /etc/vim/vimrc(.local) are loaded, so it will override +" any settings in these files. +" +" If you don't want that to happen, uncomment the below line to prevent +" defaults.vim from being loaded. +" let g:skip_defaults_vim = 1 +" +" If you would rather _use_ default.vim's settings, but have the system or +" user vimrc override its settings, then uncomment the line below. +" source $VIMRUNTIME/defaults.vim + +" All Debian-specific settings are defined in $VIMRUNTIME/debian.vim and +" sourced by the call to :runtime you can find below. If you wish to change +" any of those settings, you should do it in this file or +" /etc/vim/vimrc.local, since debian.vim will be overwritten everytime an +" upgrade of the vim packages is performed. It is recommended to make changes +" after sourcing debian.vim so your settings take precedence. + +runtime! debian.vim + +" Uncomment the next line to make Vim more Vi-compatible +" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes +" numerous options, so any other options should be set AFTER changing +" 'compatible'. +"set compatible + +" Vim5 and later versions support syntax highlighting. Uncommenting the next +" line enables syntax highlighting by default. +if has("syntax") + syntax on +endif + +" If using a dark background within the editing area and syntax highlighting +" turn on this option as well +"set background=dark + +" Uncomment the following to have Vim jump to the last position when +" reopening a file +au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + +" Uncomment the following to have Vim load indentation rules and plugins +" according to the detected filetype. +"filetype plugin indent on + +" The following are commented out as they cause vim to behave a lot +" differently from regular Vi. They are highly recommended though. +set showcmd " Show (partial) command in status line. +set showmatch " Show matching brackets. +set ignorecase " Do case insensitive matching +set smartcase " Do smart case matching +set incsearch " Incremental search +set autowrite " Automatically save before commands like :next and :make +set hidden " Hide buffers when they are abandoned +set mouse=a " Enable mouse usage (all modes) + +set number +set cursorline +" set cursorcolumn +set shiftwidth=4 +set tabstop=4 +set expandtab +set scrolloff=10 +set showmode +set hlsearch + +" Source a global configuration file if available +if filereadable("/etc/vim/vimrc.local") + source /etc/vim/vimrc.local +endif \ No newline at end of file