Skip to content

Instantly share code, notes, and snippets.

@der3k
Created February 6, 2018 14:01
Show Gist options
  • Save der3k/758bed7fe5002ded7b34b1eda9ab9a23 to your computer and use it in GitHub Desktop.
Save der3k/758bed7fe5002ded7b34b1eda9ab9a23 to your computer and use it in GitHub Desktop.
vimfiles
set nocompatible
syntax on
set number
filetype on
filetype plugin on
filetype indent on
set path+=**
set autoread
set encoding=utf-8
set fileencoding=utf-8
runtime macros/matchit.vim
set backspace=indent,eol,start
set hidden
set fileformat=unix
set fileformats=unix,dos
set viminfo='100,f1
set lazyredraw
" ---------------------- CUSTOMIZATION ----------------------
let mapleader = ","
" map <leader>q and <leader>w to buffer prev/next buffer
noremap <leader>q :bp<CR>
noremap <leader>w :bn<CR>
" windows like clipboard
let &clipboard = has('unnamedplus') ? 'unnamedplus' : 'unnamed'
" map c-x and c-v to work as they do in windows, only in insert mode
vm <c-x> "+x
vm <c-c> "+y
cno <c-v> <c-r>+
exe 'ino <script> <C-V>' paste#paste_cmd['i']
" save with ctrl+s
nmap <c-s> :w<CR>
imap <c-s> <Esc>:w<CR>
" hide unnecessary gui in gVim
if has("gui_running")
set guioptions-=m " remove menu bar
set guioptions-=T " remove toolbar
set guioptions-=r " remove right-hand scroll bar
set guioptions-=L " remove left-hand scroll bar
end
set guifont=Fira_Code:h11:cANSI
" tab selection in visual mode
" vmap <Tab> >gv
" vmap <S-Tab> <gv
" remove the .ext~ files, but not the swapfiles
set nobackup
set writebackup
set noswapfile
" search settings
set incsearch " find the next match as we type the search
set hlsearch " hilight searches by default
" use ESC to remove search higlight
nnoremap <esc> :noh<return><esc>
" suggestion for normal mode commands
set wildmode=list:longest
" keep the cursor visible within 3 lines when scrolling
set scrolloff=3
" indentation
set expandtab " use spaces instead of tabs
set autoindent " autoindent based on line above, works most of the time
set smartindent " smarter indent for C-like languages
set shiftwidth=2 " when reading, tabs are 4 spaces
set softtabstop=2 " in insert mode, tabs are 4 spaces
" no lines longer than 80 cols
set textwidth=80
" use <C-Space> for Vim's keyword autocomplete
" ...in the terminal
inoremap <Nul> <C-n>
" ...and in gui mode
inoremap <C-Space> <C-n>
inoremap <C-l> <ESC>
let g:easyescape_chars = { "j": 1, "k": 1 }
" let g:easyescape_timeout = 100
cnoremap jk <ESC>
" cnoremap kj <ESC>
" :nmap ; :
nmap ; :Buffers<CR>
nmap <Leader>t :GFiles<CR>
set relativenumber
" when pasting over SSH it's a pain to type :set paste and :set nopaste
" just map it to <f9>
" set pastetoggle=<f9>
" if windows...
if has('win32')
" start maximized
" autocmd GUIEnter * simalt ~x
" also use .vim instead of vimfiles, make sure to run the following command
" once this was copied to /Users/<user>/.vim
" mklink %homepath%/.vimrc %homepath%/.vim/.vimrc
let &runtimepath.=',$HOME/.vim'
endif
" select all mapping
" noremap <leader> "<Space>"
" ---------------------- PLUGIN CONFIGURATION ----------------------
" initiate Vundle
let &runtimepath.=',$HOME/.vim/bundle/Vundle.vim'
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" start plugin defintion
" Plugin 'scrooloose/nerdtree'
Plugin 'vim-scripts/L9'
" Plugin 'vim-scripts/FuzzyFinder'
Plugin 'itchyny/lightline.vim'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'terryma/vim-smooth-scroll'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-sensible'
Plugin 'w0rp/ale'
Plugin 'pangloss/vim-javascript'
Plugin 'zhou13/vim-easyescape'
Plugin 'junegunn/fzf', { 'do': './install -bin' }
Plugin 'junegunn/fzf.vim'
Plugin 'jremmen/vim-ripgrep'
" Plugin 'terryma/vim-multiple-cursors'
" -- Web Development
" Plugin 'Shutnik/jshint2.vim'
" Plugin 'mattn/emmet-vim'
" Plugin 'kchmck/vim-coffee-script'
" Plugin 'groenewege/vim-less'
" Plugin 'skammer/vim-css-color'
" Plugin 'hail2u/vim-css3-syntax'
" Plugin 'digitaltoad/vim-jade'
" Bundle 'yalesov/vim-emblem'
" end plugin definition
call vundle#end() " required for vundle
" needed for lightline plugin to work well
set laststatus=2
set noshowmode
" smooth scroll mappings
noremap <silent> <c-u> :call smooth_scroll#up(&scroll, 0, 2)<CR>
noremap <silent> <c-d> :call smooth_scroll#down(&scroll, 0, 2)<CR>
noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2, 0, 4)<CR>
noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2, 0, 4)<CR>
" start NERDTree on start-up and focus active window
" autocmd VimEnter * NERDTree
" autocmd VimEnter * wincmd p
" map FuzzyFinder
noremap <leader>b :FufBuffer<cr>
noremap <leader>f :FufFile<cr>
" use zencoding with <C-E>
" let g:user_emmet_leader_key = '<c-e>'
" run JSHint when a file with .js extension is saved
" this requires the jsHint2 plugin
" autocmd BufWritePost *.js silent :JSHint
" set the color theme to atom-dark
colorscheme atom-dark
" make a mark for column 80
" set colorcolumn=80
" and set the mark color to DarkSlateGray
" highlight ColorColumn ctermbg=lightgray guibg=lightgray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment