Skip to content

Instantly share code, notes, and snippets.

@mrboli
Last active October 14, 2016 21:28
Show Gist options
  • Save mrboli/41943967ba1f610b37a16842c4284c5b to your computer and use it in GitHub Desktop.
Save mrboli/41943967ba1f610b37a16842c4284c5b to your computer and use it in GitHub Desktop.
dotfiles
# Plugins
run-shell ~/Dev/opensource/tmux-resurrect/resurrect.tmux
run-shell ~/Dev/opensource/tmux-continuum/continuum.tmux
set -g @resurrect-strategy-vim 'session'
set -g @continuum-restore 'on'
setw -g mode-keys vi
bind -n C-k send-keys -R \; clear-history
# Shortcuts
bind -nr M-S-Right resize-pane -R 5
bind -nr M-S-Left resize-pane -L 5
bind -nr M-S-Up resize-pane -U 5
bind -nr M-S-Down resize-pane -D 5
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on
# Center the window list
# set-option -g status-utf8 on
set-option -g status-interval 1
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
set-option -g status-left "#(~/path/to/tmux-powerline/powerline.sh left)"
set-option -g status-right "#(~/path/to/tmux-powerline/powerline.sh right)"
" Variables
let mapleader = "\<Space>"
let s:is_windows = has('win32') || has('win64')
let s:is_nvim = has('nvim')
" Vim Plug
if !filereadable(expand("~/.vim/autoload/plug.vim"))
echo "Installing vim-plug and plugins. Restart vim after finishing the process."
silent call mkdir(expand("~/.vim/autoload", 1), 'p')
execute "!curl -fLo ".expand("~/.vim/autoload/plug.vim", 1)." https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
autocmd VimEnter * PlugInstall
endif
call plug#begin('~/.vim/plugged')
let g:plug_url_format = 'https://github.com/%s.git'
" Plug 'tpope/vim-sleuth' " Detect Indentation
Plug 'ciaranm/detectindent'
let g:detectindent_preferred_expandtab = 0
let g:detectindent_preferred_indent = 4
let g:detectindent_preferred_when_mixed = 1
Plug 'pangloss/vim-javascript'
Plug 'mattn/emmet-vim'
" Visual
Plug 'scwood/vim-hybrid'
Plug 'edkolev/tmuxline.vim'
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline_theme='base16'
let g:airline_powerline_fonts = 1
" Plug 'nathanaelkane/vim-indent-guides'
" " set ts=4 sw=4 et
" let g:indent_guides_guide_size = 1
" " let g:indent_guides_enable_on_vim_startup = 1
" Generic Code Manipulation
Plug 'raimondi/delimitmate'
Plug 'scrooloose/nerdcommenter'
Plug 'konfekt/fastfold'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'terryma/vim-multiple-cursors'
let g:multi_cursor_exit_from_insert_mode = 0
Plug 'junegunn/vim-easy-align'
xmap gl <Plug>(EasyAlign)
nmap gl <Plug>(EasyAlign)
" File System
Plug 'kien/ctrlp.vim'
nnoremap <leader>e :CtrlP<cr>
nnoremap <leader>E :CtrlPMRUFiles<cr>
nnoremap <leader>b :CtrlPBuffer<cr>
nnoremap <leader>t :CtrlPBufTag<cr>
nnoremap <leader>T :CtrlPTag<cr>
nnoremap <leader>r :CtrlPRTS<cr>
nnoremap <leader>l :CtrlPLine<cr>
let g:ctrlp_match_window = 'bottom,order:btt,min:0,max:15,results:15'
let g:ctrlp_working_path_mode = 0
" let g:ctrlp_custom_ignore = {
" \ 'dir': '\v[\/](\.git|\.hg|\.svn)$',
" \ 'file': '\.pyc$\|\.pyo$',
" \ }
let g:ctrlp_open_multiple_files = '1jr'
let g:ctrlp_max_files = 0
let g:ctrlp_lazy_update = 50
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } "{{{
nnoremap <silent> <F4> :NERDTreeToggle<CR>
nnoremap <silent> <F5> :NERDTreeFind<CR>
" Search
Plug 'mhinz/vim-grepper' "{{{
let g:grepper = {
\ 'tools': ['ag', 'csearch', 'findstr'],
\ 'dispatch': 1,
\ 'open': 1,
\ 'switch': 0,
\ 'jump': 0,
\ 'ag': {
\ 'grepprg': 'ag --nogroup --nocolor --column',
\ 'grepformat': '%f:%l:%c:%m'
\ }}
nnoremap <leader>ag :Grepper -tool ag -grepprg ag --vimgrep *<cr>
nmap gs <plug>(GrepperOperator)
xmap gs <plug>(GrepperOperator)
call plug#end()
" Vim Settings
set nocompatible
set encoding=utf-8
set listchars=tab:➤─,eol:$,space:.,trail:✴
set conceallevel=1
set concealcursor=nvic
syntax match NonText
"" hi SpecialKey ctermfg=grey guifg=grey70
set statusline=%-4m%f\ %y\ \ %=%{&ff}\ \|\ %{&fenc}\ [%l:%c]
set incsearch hlsearch
set cursorline
set ignorecase smartcase
set noswapfile
" Indents
filetype plugin indent on
set autoindent
set breakindent
set smartindent
set tabstop=4 shiftwidth=4 softtabstop=4 expandtab
set smarttab
set pastetoggle=<f6>
" Line Numbers
set relativenumber
set number
" Visual
set term=xterm-256
set t_ut= " setting for looking properly in tmux
set t_Co=256
syntax on
set background=dark
colorscheme hybrid
set colorcolumn=80
" Vim Copy in Windows
function! Putclip(type, ...) range
let sel_save = &selection
let &selection = "inclusive"
let reg_save = @@
if a:type == 'n'
silent exe a:firstline . "," . a:lastline . "y"
elseif a:type == 'c'
silent exe a:1 . "," . a:2 . "y"
else
silent exe "normal! `<" . a:type . "`>y"
endif
call
writefile(split(@@,"\n"),
'/dev/clipboard')
let &selection =
sel_save
let @@ = reg_save
endfunction
vnoremap <silent> <leader>y :call Putclip(visualmode(), 1)<CR>
nnoremap <silent> <leader>y :call Putclip('n', 1)<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment