Created
April 23, 2021 19:46
-
-
Save tianrluo/c7b08afdbb239cbf374596314cf17a25 to your computer and use it in GitHub Desktop.
vimrc
This file contains 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
" set rtp+=$HOME/.local/config/powerline/bindings/vim | |
set nocompatible | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
" call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
" The following are examples of different formats supported. | |
" Keep Plugin commands between vundle#begin/end. | |
" plugin on GitHub repo | |
Plugin 'tpope/vim-fugitive' | |
" plugin from http://vim-scripts.org/vim/scripts.html | |
" Plugin 'L9' | |
" Git plugin not hosted on GitHub | |
" Plugin 'git://git.wincent.com/command-t.git' | |
" git repos on your local machine (i.e. when working on your own plugin) | |
" Plugin 'file:///home/gmarik/path/to/plugin' | |
" The sparkup vim script is in a subdirectory of this repo called vim. | |
" Pass the path to set the runtimepath properly. | |
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} | |
" Install L9 and avoid a Naming conflict if you've already installed a | |
" different version somewhere else. | |
" Plugin 'ascenator/L9', {'name': 'newL9'} | |
" NerdCommenter | |
" Plugin 'scrooloose/nerdcommenter' | |
" Vim-Airline | |
" Plugin 'vim-airline/vim-airline' | |
" Plugin 'vim-airline/vim-airline-themes' | |
" | |
Plugin 'nelstrom/vim-visual-star-search' | |
Plugin 'bkad/CamelCaseMotion' | |
Plugin 'jacoborus/tender.vim' | |
" Plugin 'davidhalter/jedi-vim' | |
Plugin 'JuliaEditorSupport/julia-vim' | |
" Plugin 'JuliaEditorSupport/julia-vim' | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin on " required | |
filetype indent on " required | |
" To ignore plugin indent changes, instead use: | |
"filetype plugin on | |
" | |
" Brief help | |
" :PluginList - lists configured plugins | |
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate | |
" :PluginSearch foo - searches for foo; append `!` to refresh local cache | |
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal | |
" | |
" see :h vundle for more details or wiki for FAQ | |
" Put your non-Plugin stuff after this line | |
let mapleader = "," | |
set t_Co=256 | |
" set foldmethod=syntax | |
set foldmethod=indent | |
set mouse+=a | |
if has("mouse_sgr") | |
set ttymouse=sgr | |
else | |
set ttymouse=xterm2 | |
endif | |
set mouse=a | |
set number | |
set ai " set auto-indenting on for programming | |
set showmatch " automatically show matching brackets. works like it does in bbedit. | |
set vb " turn on the "visual bell" - which is much quieter than the "audio blink" | |
set ruler " show the cursor position all the time | |
set laststatus=2 " make the last line where the status is two lines deep so you can see status always | |
set backspace=indent,eol,start " make that backspace key work the way it should | |
set nocompatible " vi compatible is LAME | |
set background=dark " Use colours that work well on a dark background (Console is usually black) | |
set showmode " show the current mode | |
set clipboard=unnamedplus " set clipboard to unnamed to access the system clipboard under windows | |
syntax on " turn syntax highlighting on by default | |
" colorscheme eva | |
" colorscheme luna-term | |
" colorscheme vorange | |
" colorscheme monokai | |
colorscheme tender | |
set expandtab | |
set shiftwidth=2 | |
set softtabstop=2 | |
set tabstop=2 | |
set linebreak | |
set cursorline | |
" hi CursorLine cterm=None ctermbg=darkblue ctermfg=white guibg=green guifg=white | |
set hlsearch | |
hi Search cterm=None ctermbg=darkred ctermfg=white guibg=darkred guifg=white | |
" highlight OverLength ctermbg=green ctermfg=white guibg=green | |
" match OverLength /\%81v.\+/ | |
set colorcolumn=81 | |
function! UseTabs() | |
set tabstop=4 " Size of a hard tabstop (ts). | |
set shiftwidth=4 " Size of an indentation (sw). | |
set noexpandtab " Always uses tabs instead of space characters (noet). | |
set autoindent " Copy indent from current line when starting a new line (ai). | |
endfunction | |
function! UseSpaces() | |
set tabstop=2 " Size of a hard tabstop (ts). | |
set shiftwidth=2 " Size of an indentation (sw). | |
set expandtab " Always uses spaces instead of tab characters (et). | |
set softtabstop=0 " Number of spaces a <Tab> counts for. When 0, featuer is off (sts). | |
set autoindent " Copy indent from current line when starting a new line. | |
set smarttab " Inserts blanks on a <Tab> key (as per sw, ts and sts). | |
endfunction | |
set wildmode=longest,list,full | |
set wildmenu | |
" navigate panes | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
inoremap <C-J> <Esc><C-W><C-J> | |
inoremap <C-K> <Esc><C-W><C-K> | |
inoremap <C-L> <Esc><C-W><C-L> | |
inoremap <C-H> <Esc><C-W><C-H> | |
" " tabs | |
" nnoremap <C-M> :tabprevious<CR> | |
" nnoremap <C-N> :tabnext<CR> | |
" nnoremap <C-T> :tabnew<CR> | |
" nnoremap <C-Delete> :tabclose<CR> | |
" buffers | |
nnoremap <C-M> :bn<CR> | |
nnoremap <C-N> :bp<CR> | |
nnoremap <C-T> :enew<CR> | |
" " julia latex to unicode | |
let g:latex_to_unicode_file_types = ".*" | |
" re source .vimrc | |
command! Rso :so $MYVIMRC | |
" Show EOL type and last modified timestamp, right after the filename | |
set statusline=%<%F%h%m%r\ [%{&ff}]\ (%{strftime(\"%H:%M\ %d/%m/%Y\",getftime(expand(\"%:p\")))})%=%l,%c%V\ %P | |
"------------------------------------------------------------------------------ | |
" Only do this part when compiled with support for autocommands. | |
if has("autocmd") | |
"Set UTF-8 as the default encoding for commit messages | |
autocmd BufReadPre COMMIT_EDITMSG,git-rebase-todo setlocal fileencodings=utf-8 | |
"Remember the positions in files with some git-specific exceptions" | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | |
\ && expand("%") !~ "COMMIT_EDITMSG" | |
\ && expand("%") !~ "ADD_EDIT.patch" | |
\ && expand("%") !~ "addp-hunk-edit.diff" | |
\ && expand("%") !~ "git-rebase-todo" | | |
\ exe "normal g`\"" | | |
\ endif | |
autocmd BufNewFile,BufRead *.patch set filetype=diff | |
autocmd BufNewFile,BufRead *.diff set filetype=diff | |
autocmd Syntax diff | |
\ highlight WhiteSpaceEOL ctermbg=red | | |
\ match WhiteSpaceEOL /\(^+.*\)\@<=\s\+$/ | |
autocmd Syntax gitcommit setlocal textwidth=74 | |
endif " has("autocmd") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment