Skip to content

Commit

Permalink
Update VIMRC
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnulliu committed Jun 30, 2024
1 parent c45581f commit 2f33fee
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
73 changes: 73 additions & 0 deletions content/blog/Reset-Windows-And-Install-Ubuntu-Alongside/vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
" $VIMRUNTIME refers to the versioned system directory where Vim stores its
" system runtime files -- /usr/share/vim/vim<version>.
"
" 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

0 comments on commit 2f33fee

Please sign in to comment.