Skip to content

Instantly share code, notes, and snippets.

@prashcr
Created March 19, 2018 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prashcr/0408fb2fade930db67a4d7862a0e768a to your computer and use it in GitHub Desktop.
Save prashcr/0408fb2fade930db67a4d7862a0e768a to your computer and use it in GitHub Desktop.
call plug#begin()
Plug 'w0rp/ale'
Plug 'tpope/vim-fugitive'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'chriskempson/base16-vim'
Plug 'Valloric/YouCompleteMe', { 'do': './install.py', 'for': ['c', 'cpp'] }
Plug 'janko-m/vim-test'
Plug 'tpope/vim-dispatch'
Plug 'skywind3000/asyncrun.vim'
Plug 'tpope/vim-endwise'
Plug 'jiangmiao/auto-pairs'
call plug#end()
" Turn off vi compatibility
set nocompatible
" Syntax highlighting
syntax enable
" Use Linux clipboard
set clipboard=unnamedplus
" Enable mouse selection
set mouse=a
" Map , as leader
"let mapleader=","
" Wild menu
set wildmenu
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
" Relative line numbers
set relativenumber
" Search highlighting
set hlsearch
" incremental search (like web browsers)
set incsearch
" Ignore case when searching
set ignorecase
" Be smart about cases while searching
set smartcase
" Reset search
nnoremap <silent> \ :let @/=""<CR>
" Turn on magic for regexp
set magic
" Don't redraw while executing macros for better performance
set lazyredraw
" Hybrid line numbers
set relativenumber
set number
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set fileformats=unix,dos,mac
" Linebreak on 120 characters
set linebreak
set autoindent
set smartindent
set wrap
set backspace=indent,eol,start
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs
set smarttab
" 1 tab == 2 spaces
set shiftwidth=2
set tabstop=2
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Always show the status line
set laststatus=2
" Bare-bones statusline based on ruler
set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
set autoread
set directory=~/.vim/swapfiles//
set colorcolumn=95
colorscheme base16-tomorrow-night
nnoremap <Space> :FZF<cr>
" --column: Show column number
" --line-number: Show line number
" --no-heading: Do not show file headings in results
" --fixed-strings: Search term as a literal string
" --ignore-case: Case insensitive search
" --no-ignore: Do not respect .gitignore, etc...
" --hidden: Search hidden files and folders
" --follow: Follow symlinks
" --glob: Additional conditions for search (in this case ignore everything in the .git/ folder)
" --color: Search color options
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --follow --color "always" '.shellescape(<q-args>), 1, <bang>0)
let mapleader = ','
nmap <silent> <leader>t :TestNearest<CR>
nmap <silent> <leader>T :TestFile<CR>
nmap <silent> <leader>a :TestSuite<CR>
nmap <silent> <leader>l :TestLast<CR>
nmap <silent> <leader>g :TestVisit<CR>
let test#strategy = 'basic'
" Highlight a column in csv text.
" :Csv 1 " highlight first column
" :Csv 12 " highlight twelfth column
" :Csv 0 " switch off highlight
function! CSVH(colnr)
if a:colnr > 1
let n = a:colnr - 1
execute 'match Keyword /^\([^,]*,\)\{'.n.'}\zs[^,]*/'
execute 'normal! 0'.n.'f,'
elseif a:colnr == 1
match Keyword /^[^,]*/
normal! 0
else
match
endif
endfunction
command! -nargs=1 Csv :call CSVH(<args>)
autocmd BufWritePre * :%s/\s\+$//e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment