Last active
August 21, 2020 14:15
-
-
Save tinyheero/0c37f0b87218a79723f1 to your computer and use it in GitHub Desktop.
My ~/.vimrc file
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
"---------- | |
" General | |
"---------- | |
set nocompatible "stops vim from behaving in a strongly vi -compatible way. Place at the start of vimrc file as it can affect lots of other options which you may want to override. | |
filetype plugin on "turns plugin on depending on filetype | |
filetype indent on "special identation for certain filetypes | |
" Set to auto read when a file is changed from the outside | |
set autoread | |
" With a map leader it's possible to do extra key combinations like <leader>w saves the current file | |
let mapleader = "," | |
let g:mapleader = "," | |
" look for all the TODO tags | |
noremap <Leader>t :noautocmd vimgrep /TODO/j **/*.Rmd **/*.R <CR>:cw<CR> | |
" Turn off ability to enter Ex mode which is not very useful to be in | |
nnoremap Q <nop> | |
" Quickly edit/reload the vimrc file | |
nmap <silent> <leader>ev :tabedit $MYVIMRC<CR> | |
nmap <silent> <leader>sv :so $MYVIMRC<CR> | |
" get rid of the funny symbols in tmuxline | |
let g:tmuxline_powerline_separators = 0 | |
" vim to ignore these files | |
set wildignore=*.swp,*.bak,*.pyc,*.class | |
set pastetoggle=<F2> | |
" Easy window navigation | |
map <C-h> <C-w>h | |
map <C-j> <C-w>j | |
map <C-k> <C-w>k | |
map <C-l> <C-w>l | |
" ensures that vim moves up/down linewise instead of by wrapped lines | |
nmap j gj | |
nmap k gk | |
" makes new files opened using the gf command (open files under cursor) to open in a new tab | |
map gf <C-w>gf | |
map cdf :cd %:p:h | |
" Lines added by the Vim-R-plugin command :RpluginConfig (2015-Jan-07 12:07): | |
" Use Ctrl+Space to do omnicompletion: | |
if has("gui_running") | |
inoremap <C-Space> <C-x><C-o> | |
else | |
inoremap <Nul> <C-x><C-o> | |
endif | |
" Force Vim to use 256 colors if running in a capable terminal emulator: | |
if &term =~ "xterm" || &term =~ "256" || $DISPLAY != "" || $HAS_256_COLORS == "yes" | |
set t_Co=256 | |
endif | |
"---------- | |
" Status Line | |
"---------- | |
set t_Co=256 | |
syntax enable | |
syntax on "this is needed to see syntax | |
" use base16-default colorscheme (https://github.com/chriskempson/base16-vim) | |
" requires base16-shell (https://github.com/chriskempson/base16-shell) | |
" requires base16-iterm2 (https://github.com/chriskempson/base16-iterm2) | |
set background=dark "makes it easier to read with black background | |
let base16colorspace=256 " Access colors present in 256 colorspace | |
colorscheme base16-default | |
set hlsearch " highlight searches | |
set incsearch " highlight as you type | |
set visualbell t_vb= " turn off error beep/flash | |
set ignorecase "ignore case while searching | |
set bs=2 "enables backspace. Seems to have been disabled in vim7.3 | |
"---------- | |
" Mappings | |
"---------- | |
"map ,# :s/^/#/<CR> | |
map ,/ :s/^/\/\//<CR> | |
map ,> :s/^/> /<CR> | |
map ," :s/^/\"/<CR> | |
map ,% :s/^/%/<CR> | |
map ,! :s/^/!/<CR> | |
map ,; :s/^/;/<CR> | |
map ,- :s/^/--/<CR> | |
map ,cd :cd .. | |
map ,te :tabedit | |
map ,r i#!/usr/bin/env Rscript<C-O>o# Description: <C-O>o# Authors: Fong Chun Chan <[email protected]> | |
map ,s i#!/usr/bin/env sh<C-O>o# Description: <C-O>o# Authors: Fong Chun Chan <[email protected]> | |
" map ,nt key for turning on NERDTree (requires the NERDTree plugin) | |
map <leader>nt :NERDTree<ENTER> | |
"---------- | |
" VIM user interface | |
"---------- | |
set ruler "Always show current position | |
set showmatch "Show matching brackets when text indicator is over them | |
set mat=2 "How many tenths of a second to blink when matching brackets - doesn't work? | |
set cmdheight=2 "Height of the command bar | |
set ls=2 " always show status line | |
set number "put numbers on side | |
" prevents NERDTree plugin from using fancy arrow graphics | |
let g:NERDTreeDirArrows=0 | |
"---------- | |
" Text, tab and indent related | |
"---------- | |
"Use spaces instead of tabs (i.e. spaces are substituted for tabs) | |
"set expandtab | |
" 1 tab == 2 spaces | |
"number of spaces to use for autoindenting" | |
set shiftwidth=2 | |
set tabstop=2 | |
set softtabstop=2 | |
" insert tabs on the start of a line according to shiftwidth, not tabstop | |
set smarttab | |
" use multiple of shiftwidth when indenting with '<' and '>' | |
set shiftround | |
set ai "Auto indent | |
set si "Smart indent | |
" turn on omni completion | |
set omnifunc=syntaxcomplete#Complete | |
" turns on nice popup menu for omni completion | |
:highlight Pmenu ctermbg=238 gui=bold | |
" let R output highlighted using current color scheme | |
let rout_follow_colorscheme = 1 | |
"---------- | |
" Sparkup | |
"---------- | |
let g:sparkupNextMapping = '<c-s>' | |
"---------- | |
" Vundle Stuff | |
"---------- | |
set nocompatible " be iMproved, required | |
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 'gmarik/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' " Git integration | |
Plugin 'Lokaltog/vim-easymotion' " Quick movements | |
Plugin 'tomtom/tcomment_vim' " extensible & universal comment | |
Plugin 'scrooloose/nerdtree' " file structure viewer | |
Plugin 'kshenoy/vim-signature' " place, toggle and display marks | |
Plugin 'bling/vim-airline' " vim status bar | |
Plugin 'kien/ctrlp.vim' " fuzzy search | |
Plugin 'tinyheero/vim-snippets' " fork of honza/vim-snippets | |
Plugin 'edkolev/tmuxline.vim' " improves the tmux status bar and integrates with the vim-airline | |
Plugin 'scrooloose/syntastic' " adds syntax checking | |
Plugin 'tpope/vim-surround' " quoting and parenthesizing made simple | |
Plugin 'tpope/vim-repeat' " enable repeating supported plugin maps with | |
Plugin 'vitalk/vim-simple-todo' | |
Plugin 'MarcWeber/vim-addon-mw-utils' " dependency of vim-snipmate | |
Plugin 'tomtom/tlib_vim' " dependency of vim-snipmate | |
Plugin 'garbas/vim-snipmate' " fork of the original SnipMate | |
Plugin 'christoomey/vim-tmux-navigator' " seamless navigation between tmux and vim panes | |
" 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/'} | |
" Avoid a name conflict with L9 | |
"Plugin 'user/L9', {'name': 'newL9'} | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin 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 | |
filetype on " required! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment