Last active
October 31, 2022 12:17
-
-
Save grammy-jiang/ae2218062be5f493e24492ad6b62b3a2 to your computer and use it in GitHub Desktop.
/etc/vim/vimrc.local
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ============================================================================= | |
" Github URL | |
" https://gist.githubusercontent.com/grammy-jiang/ae2218062be5f493e24492ad6b62b3a2/raw | |
" Shorten URL | |
" https://git.io/JvpS2 | |
" ============================================================================= | |
set nocompatible | |
" Vim5 and later versions support syntax highlighting. Uncommenting the next | |
" line enables syntax highlighting by default. | |
if has("syntax") | |
syntax on | |
endif | |
" Uncomment the following to have Vim jump to the last position when | |
" reopening a file | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | |
endif | |
" Uncomment the following to have Vim load indentation rules and plugins | |
" according to the detected filetype. | |
if has("autocmd") | |
filetype plugin indent on | |
endif | |
" 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 relativenumber | |
augroup numbertoggle | |
autocmd! | |
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber | |
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber | |
augroup END | |
set scrolloff=5 " 5 lines above/below cursor when scrolling | |
set nowrap | |
" set tab as 4 space | |
set tabstop=4 | |
set shiftwidth=4 | |
set softtabstop=4 | |
set expandtab | |
set hlsearch " search | |
set colorcolumn=80 | |
augroup CursorLine | |
au! | |
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline | |
au WinLeave * setlocal nocursorline | |
augroup END | |
highlight CursorLine term=bold cterm=bold ctermbg=234 | |
highlight CursorLineNR term=bold cterm=bold ctermbg=234 | |
" ============================================================================= | |
" netrw | |
" http://vimdoc.sourceforge.net/htmldoc/pi_netrw.html | |
" ============================================================================= | |
" Set the default listing style: | |
" 0: thin listing (one file per line) | |
" 1: long listing (one file per line with time stamp information and file size) | |
" 2: wide listing (multiple files in columns) | |
" 3: tree style listing | |
let g:netrw_liststyle=3 | |
" when browsing, <cr> will open the file by: | |
" 0: re-using the same window | |
" 1: horizontally splitting the window first | |
" 2: vertically splitting the window first | |
" 3: open file in new tab | |
" 4: act like "P" (ie. open previous window) Note that |g:netrw_preview| may be used to get vertical splitting instead of horizontal splitting. | |
let g:netrw_browse_split=4 | |
" specify initial size of new windows made with "o" (see |netrw-o|), "v" (see |netrw-v|), |:Hexplore| or |:Vexplore|. | |
" default: "" | |
let g:netrw_winsize=25 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
Ubuntu:
sudo -- sh -c "wget --output-document=/etc/vim/vimrc.local https://git.io/JvpS2"
Fedora:
sudo -- sh -c "wget --output-document=/etc/vimrc.local https://git.io/JvpS2"
Related
Reference