Skip to content

Instantly share code, notes, and snippets.

@yongbin
Last active January 6, 2021 07:27
Show Gist options
  • Save yongbin/71ed64dfe100c38e7c58f98c60d38c6e to your computer and use it in GitHub Desktop.
Save yongbin/71ed64dfe100c38e7c58f98c60d38c6e to your computer and use it in GitHub Desktop.
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-repeat'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'preservim/nerdtree'
Plug 'adelarsq/vim-matchit'
Plug 'jlanzarotta/bufexplorer'
Plug 'junegunn/vim-peekaboo'
Plug 'junegunn/seoul256.vim'
Plug 'vim-airline/vim-airline'
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
call plug#end()
autocmd! bufwritepost $MYVIMRC source $MYVIMRC
syntax enable
set hidden
set number
set visualbell
set errorbells
set background=dark
set backspace=indent,eol,start
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch " set show matching parenthesis
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
" default tab
set shiftwidth=4
set tabstop=8
set softtabstop=4
set expandtab
let g:indent_guides_start_level=2
let g:indent_guides_guide_size=1
set title
set nobackup
set noswapfile
set hlsearch
set fileencodings=utf-8-bom,utf-8,cp949
set cursorline
set statusline=%F%m%r%h%w\ [FF=%{&ff}]\ [FT=%Y]\ [ENC=%{&enc}/%{&fenc}]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
set laststatus=2
set list
set listchars=tab:»·,trail:·
augroup PerlSettings
autocmd!
autocmd FileType perl setlocal complete-=i
augroup END
" key bindings
let mapleader=","
nnoremap ; :
nnoremap <Leader>q :q<CR>
nnoremap <Leader>v :tabnew ~/.vimrc<CR>
" vimcasts.org #26 Bubbling text
" http://vimcasts.org/episodes/bubbling-text/
nmap <C-K> [e
vmap <C-K> [egv
nmap <C-J> ]e
vmap <C-J> ]egv
nmap gV `[v`]
inoremap <C-K> <UP>
inoremap <C-J> <DOWN>
inoremap <C-H> <LEFT>
inoremap <C-L> <RIGHT>
inoremap <C-A> <HOME>
inoremap <C-E> <END>
" Indent Guides
nmap <Leader>ig :IndentGuidesToggle<CR>
" NERDTree
nnoremap <Leader>n :NERDTreeToggle<CR>
nnoremap <Leader>c :NERDTreeFind<CR>
" perltidy
nnoremap <Leader>pt :%!perltidy -q<CR>
vnoremap <Leader>pt :!perltidy -q<CR>
nnoremap <Leader>dd :bwipeout
" Transform visual section from
" value='1' / value='1' / value='1'
" to
" value='1' / value='2' / value='3'
vnoremap <Leader><C-A> :!perl -nle "\$i++; s{'([^']*)1'}{'\$1\$i'}g ; print"<CR>
" bugzilla
nnoremap <Leader>bz :%s;^;> ;g<CR>:noh<CR>
vnoremap <Leader>bz : s;^;> ;g<CR>:noh<CR>
"FZF
nnoremap <Leader>f :Files<CR>
nnoremap <Leader>r :Rg<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment