Skip to content

Instantly share code, notes, and snippets.

@indeedwatson
Created September 28, 2017 15:03
Show Gist options
  • Save indeedwatson/90cb03936ea161b3f9317d2a1199f6bb to your computer and use it in GitHub Desktop.
Save indeedwatson/90cb03936ea161b3f9317d2a1199f6bb to your computer and use it in GitHub Desktop.
set background=dark
set foldenable
set foldlevelstart=0
filetype off
" Vundle stuff ----------------------------------------------------
" 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 'VundleVim/Vundle.vim'
" Plugins ---------------------------------------------------------
" Gist for vim
Bundle 'mattn/webapi-vim'
Bundle 'mattn/gist-vim'
" automatic closing of quotes, parenthesis, brackets, etc
Plugin 'https://github.com/raimondi/delimitMate'
" lint while you type
Plugin 'w0rp/ale'
" colors from wal
" Plugin 'https://github.com/dylanaraps/wal'
" status/tabline
Plugin 'https://github.com/vim-airline/vim-airline'
" tables
Plugin 'dhruvasagar/vim-table-mode'
" wiki
" Plugin 'vimwiki/vimwiki'
" i3 syntax
Plugin 'https://github.com/PotatoesMaster/i3-vim-syntax'
" fzf
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
" Git wrapper
Plugin 'https://github.com/tpope/vim-fugitive'
" tabular
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
" folding
Plugin 'nelstrom/vim-markdown-folding'
" mappings for todo list
" Plugin 'vitalk/vim-simple-todo'
" ------------------------------------------------------------------
" 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"
" format ------------------------------------------------------------
set autoindent
set backup
set nu
set smartindent
set showmatch
set textwidth=80
set title
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" line numbers relative to current line
set relativenumber
" syntax
set t_Co=256
syntax on
filetype on
filetype indent on
filetype plugin on
set modeline
set ls=2
set autoindent
set backspace=indent,eol,start
set complete-=i
set smarttab
" conceal symbols such as *italics* and **bold**
set conceallevel=2
" Always show statusline
set laststatus=2
" powerline
let g:airline_powerline_fonts = 1
" disabled due to lack of bold/italics support
" colorscheme wal
" binds --------------------------------------------------------------
" space as leader
let mapleader = "\<Space>"
" tab for folding
nnoremap <Tab> za
vnoremap <Tab> za
" save with leader-w
nnoremap <Leader>w :w<CR>
" make gist with leader-g
nnoremap <Leader>g :Gist -a<CR>
" quit without saving with leader-q
nnoremap <Leader>q :q!<CR>
vmap <Leader>y "+y
vmap <Leader>d "+d
nmap <Leader>p "+p
nmap <Leader>P "+P
vmap <Leader>p "+p
vmap <Leader>P "+P
" move lines up and down with Ctrl + j/k in normal, insert and visual mode
nnoremap <C-j> :m .+1<CR>==
nnoremap <C-k> :m .-2<CR>==
inoremap <C-j> <Esc>:m .+1<CR>==gi
inoremap <C-k> <Esc>:m .-2<CR>==gi
vnoremap <C-j> :m '>+1<CR>gv=gv
vnoremap <C-k> :m '<-2<CR>gv=gv=
" insert current date with F5 in normal and insert mode
nnoremap <F5> "=strftime("<%a %y.%m.%d %H:%M>")<CR>P
inoremap <F5> <C-R>=strftime("<%a %y.%m.%d %H:%M>")<CR>
" Disable swap files
set noswapfile
set nobackup
set nowritebackup
if !&diff
set undodir=~/.vim/undodir
set undofile
endif
" set .md and .markdown to use markdown filetype
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
autocmd BufNewFile,BufReadPost *.markdown set filetype=mkd
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
" Markdown-compatible tables
let g:table_mode_corner='|'
" folding
let g:markdown_folding = 1
let g:markdown_fold_style = 'nested'
" fzf settings -------------------------------------------------------
" This is the default extra key bindings
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
" Default fzf layout
" - down / up / left / right
let g:fzf_layout = { 'down': '~40%' }
" In Neovim, you can set up fzf window using a Vim command
let g:fzf_layout = { 'window': 'enew' }
let g:fzf_layout = { 'window': '-tabnew' }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" Enable per-command history.
" CTRL-N and CTRL-P will be automatically bound to next-history and
" previous-history instead of down and up. If you don't like the change,
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
let g:fzf_history_dir = '~/.local/share/fzf-history'
" [Buffers] Jump to the existing window if possible
let g:fzf_buffers_jump = 1
" Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <c-x><c-l> <plug>(fzf-complete-line)
" Advanced customization using autoload functions
inoremap <expr> <c-x><c-k> fzf#vim#complete#word({'left': '15%'})
" Replace the default dictionary completion with fzf-based fuzzy completion
inoremap <expr> <c-x><c-k> fzf#complete('cat /usr/share/dict/words')
" Status line (neovim)
function! s:fzf_statusline()
" Override statusline as you like
highlight fzf1 ctermfg=161 ctermbg=251
highlight fzf2 ctermfg=23 ctermbg=251
highlight fzf3 ctermfg=237 ctermbg=251
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endfunction
autocmd! User FzfStatusLine call <SID>fzf_statusline()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment