Skip to content

Instantly share code, notes, and snippets.

@h2m730131
Last active July 11, 2025 05:56
Show Gist options
  • Save h2m730131/f37f35b1656427e8e0020cdb99f9f221 to your computer and use it in GitHub Desktop.
Save h2m730131/f37f35b1656427e8e0020cdb99f9f221 to your computer and use it in GitHub Desktop.
Vim
"Vim Plugin Manager
call plug#begin()
call plug#end()
" For Windows Terminal you can use something like this:
" Note: This should be set after `set termguicolors` or `set t_Co=256`.
" if &term =~ 'xterm' || &term == 'win32'
" " Use DECSCUSR escape sequences
" let &t_SI = "\e[5 q" " blink bar
" let &t_SR = "\e[3 q" " blink underline
" let &t_EI = "\e[1 q" " blink block
" let &t_ti ..= "\e[1 q" " blink block
" let &t_te ..= "\e[0 q" " default (depends on terminal, normally blink block)
" endif
"im-select
autocmd InsertLeave * :silent ![your path]/.vscode/extensions/im-select.exe 1033
"set nocompatible
set showmode
set showcmd
"set list
set number
set relativenumber
set clipboard=unnamed
set ruler "右下角顯示「行,列 目前在文件的位置 %」的資訊
set noswapfile "不要產生 swp 檔 (backup)
set background=dark
set scrolloff=5
set shiftwidth=4 "縮排
"Tab and Space
set softtabstop=4 "輸入 tab 實際寬度為 softtabstop, 內容為 n 個 space + m 個 tab (tabstop=m)
set tabstop=4 "輸入的 tab 寬度為 4 個 space
set expandtab "輸入的 tab 都會被替換成 4 (tabstop=4) 個 space
"Word Wrap
"set wrap
set linebreak
"Search
"set smartcase
set hlsearch
set ignorecase
set incsearch
set shortmess-=S
"Split Windows
set splitbelow "新增的水平視窗會在下面
set splitright "新增的垂直視窗會在右邊
"Tab
set showtabline=2
"Sytax 語法高亮
syntax on
"colorscheme default
"Filetypes 偵測檔案類型
filetype on
filetype indent on
filetype plugin on
"Format selection
"set equalprg
"Key mapping
let mapleader=","
" git bash 的 vim:
" 系統 vimrc 設定檔: "/etc/vimrc"
" 使用者個人 vimrc 設定檔: "$HOME/.vimrc"
" 第二組個人 vimrc 檔案: "~/.vim/vimrc"
nnoremap <leader>so :source ~/.vim/vimrc<CR>
" vim:
" Unix $HOME/.vimrc or $HOME/.vim/vimrc
" MS-Windows $HOME/_vimrc, $HOME/vimfiles/vimrc or $VIM/_vimrc
" For Windows Terminal
" nnoremap <leader>so :source ~/vimfiles/vimrc<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment