Skip to content

Instantly share code, notes, and snippets.

@timvisee
Created June 28, 2019 14:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timvisee/de5c739279b9fdaf4b14634722c51176 to your computer and use it in GitHub Desktop.
Save timvisee/de5c739279b9fdaf4b14634722c51176 to your computer and use it in GitHub Desktop.
Greatly reduced vimrc base for @eloydegen
""" Configure vim-plug
set nocompatible
filetype off
" Begin vim-plug plugin loading
call plug#begin('~/.local/share/nvim/plugged')
" Jumping
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" Visual enhancers
Plug 'RRethy/vim-illuminate'
" End vim-plug plugin loading
call plug#end()
""" General
" We're using Vim, not Vi
set nocompatible
" We've a fast terminal
set ttyfast
" Use lazy redraw, do not redraw during macro execution
set lazyredraw
" We're using UTF-8 as file/script encoding
scriptencoding utf-8
set encoding=utf-8
" Detect file types and specific indents/settings
filetype on
filetype indent on
filetype plugin on
" Enable use of other .vimrc files in working directories
set exrc
" Use bash as shell (solve compatibility issues)
set shell=/bin/bash
" Set maximum map and key delays
set timeoutlen=500
set ttimeoutlen=0
""" Appearance
" Syntax highlighting
syntax enable
" Enable 256-color mode for terminals
if !has('gui_running')
set t_Co=256
endif
" Colors
if (match($TERM, "-256color") != -1) && (match($TERM, "screen-256color") == -1)
silent! set termguicolors
endif
" Relative line numbers
set relativenumber
set number
" Integrate with system clipboard (not on macOS due to problems)
if has('unix') && !has('mac')
set clipboard=unnamedplus,unnamed
endif
""" Custom keybindings
" Enable the mouse
set mouse=a
" Map space and \ as leader keys
let mapleader="\<Space>"
let maplocalleader="\\"
" Use <space><space> to toggle to the last buffer
nnoremap <leader><leader> <c-^>
" fzf/skim bindings
nnoremap <silent> <leader>o :Files<CR>
nnoremap <silent> <leader>O :Buffers<CR>
nnoremap <silent> <leader>A :Windows<CR>
nnoremap <leader>r :Rg
nnoremap <silent> <leader>; :BLines<CR>
nnoremap <silent> <leader>: :History:<CR>
nnoremap <silent> <leader>? :History<CR>
nnoremap <silent> <leader>/ :History/<CR>
nnoremap <silent> <leader>gl :Commits<CR>
nnoremap <silent> <leader>ga :BCommits<CR>
nnoremap <silent> <leader>ft :Filetypes<CR>
nnoremap <silent> <leader>h :Helptags<CR>
"nnoremap <leader>/ :Ag
"nnoremap <silent> <leader>o :BTags<CR>
"nnoremap <silent> <leader>O :Tags<CR>
" Save
inoremap <C-s> <esc>:w<cr>
nnoremap <C-s> :w<cr>
" Split navigation
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>
" Run last macro with Q
nnoremap Q @@
" Common typos
nnoremap q: :q
cnoreabbrev W w
cnoreabbrev Wq wq
cnoreabbrev WQ wq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment