From b4097c681dcbe727fee4a1c324918c381a05cf77 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sat, 1 Apr 2017 20:32:51 +0200 Subject: [PATCH] Replace Signed-off-by: Tomas Slusny --- README.md | 3 +- tmux/.tmux.conf | 145 +++---- vim/.vimrc | 741 +++++++++++++++++----------------- zsh/.zsh/bundle/ix.plugin.zsh | 33 ++ zsh/.zshrc | 161 ++++---- 5 files changed, 557 insertions(+), 526 deletions(-) create mode 100644 zsh/.zsh/bundle/ix.plugin.zsh diff --git a/README.md b/README.md index 1de6597a..89065184 100644 --- a/README.md +++ b/README.md @@ -63,13 +63,14 @@ git clone git://github.com/Tarrasch/zsh-autoenv ~/.zsh/bundle/local/zsh-autoenv ## Included stuff -### Shell +### ZSH * [alias-tips](https://github.com/djui/alias-tips): A plugin to help remembering those aliases you defined once * [base-16-shell](https://github.com/chriskempson/base16-shell): A shell script to change your shell's default ANSI colors but most importantly, colors 17 to 21 of your shell's 256 colorspace (if supported by your terminal) * [cdls](https://github.com/deathbeam/dotfiles/tree/master/zsh/.zsh/bundle/cdls.plugin.zsh): Runs `ls -A` on directory change * [fzf](https://github.com/junegunn/fzf): A command-line fuzzy finder written in Go * [globalias](https://github.com/deathbeam/dotfiles/tree/master/zsh/.zsh/bundle/globalias.plugin.zsh): Expands all glob expressions, subcommands and aliases (including global) + * [ix](https://github.com/deathbeam/dotfiles/tree/master/zsh/.zsh/bundle/ix.plugin.zsh): A command line pastebin - shell * [vi-mode](https://github.com/deathbeam/dotfiles/tree/master/zsh/.zsh/bundle/vi-mode.plugin.zsh): Enhanced Vi mode for zsh with history substring search support * [zim](https://github.com/Eriner/zim): ZIM - Zsh IMproved diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 0aac7261..24cce267 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -1,106 +1,107 @@ -# vim:foldmethod=marker:set ft=conf: +# vim:foldmethod=marker: # General {{{ - # Renumber windows sequentially after closing any of them - set -g renumber-windows on +# Renumber windows sequentially after closing any of them +set -g renumber-windows on - # Start window numbers at 1 to match keyboard order with tmux window order - set -g base-index 1 - set-window-option -g pane-base-index 1 +# Start window numbers at 1 to match keyboard order with tmux window order +set -g base-index 1 +set-window-option -g pane-base-index 1 - # Vi mode - set -g status-keys vi - setw -g mode-keys vi +# Vi mode +set -g status-keys vi +setw -g mode-keys vi + +# Fix cursor change under Tmux +set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' - # Fix cursor change under Tmux - set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' # }}} # Mappings {{{ - # Use ^Space as prefix (do not interfere with Vim) - unbind C-b - set -g prefix C-Space - bind C-space send-prefix +# Use ^Space as prefix (do not interfere with Vim) +unbind C-b +set -g prefix C-Space +bind C-space send-prefix - # Kill current session - bind X kill-session +# Kill current session +bind X kill-session - # Open new windows and tabs with current path - bind c new-window -c "#{pane_current_path}" - bind '"' split-window -h -c "#{pane_current_path}" - bind % split-window -v -c "#{pane_current_path}" +# Open new windows and tabs with current path +bind c new-window -c "#{pane_current_path}" +bind '"' split-window -h -c "#{pane_current_path}" +bind % split-window -v -c "#{pane_current_path}" - # Vim "visual" mode in copy mode - bind-key -t vi-copy v begin-selection - bind-key -t vi-copy y copy-selection +# Vim "visual" mode in copy mode +bind-key -t vi-copy v begin-selection +bind-key -t vi-copy y copy-selection - # Pane resizing is different than in vim, so we cannot - # just use +, -, <, > - bind-key -r J resize-pane -D - bind-key -r K resize-pane -U - bind-key -r H resize-pane -L - bind-key -r L resize-pane -R +# Pane resizing is different than in vim, so we cannot +# just use +, -, <, > +bind-key -r J resize-pane -D +bind-key -r K resize-pane -U +bind-key -r H resize-pane -L +bind-key -r L resize-pane -R - # Vim style pane selection - bind h select-pane -L - bind j select-pane -D - bind k select-pane -U - bind l select-pane -R +# Vim style pane selection +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R - # Clear screen fix - bind C-l send-keys 'C-l' +# Clear screen fix +bind C-l send-keys 'C-l' # }}} # User interface {{{ - # Disable annoying notifications - set-option -g visual-bell off - set-option -g visual-silence off - set-option -g bell-action none - - # Command bar - set -g message-command-bg "colour0" - set -g message-command-fg "colour7" - set -g message-bg "colour0" - set -g message-fg "colour7" - set -g pane-border-fg "colour19" - set -g pane-active-border-fg "colour4" - - # Titles - set -g set-titles on - set -g set-titles-string '#T' - - # Status bar - set -g status on - setw -g status-bg default - setw -g status-fg default - - set -g status-left '' - set -g window-status-format '#[fg=black]#I:#W#F' - set -g window-status-current-format '#[fg=blue]#I:#W#F' - set -g status-right '#[fg=cyan]#{session_name}' +# Disable annoying notifications +set-option -g visual-bell off +set-option -g visual-silence off +set-option -g bell-action none + +# Command bar +set -g message-command-bg "colour0" +set -g message-command-fg "colour7" +set -g message-bg "colour0" +set -g message-fg "colour7" +set -g pane-border-fg "colour19" +set -g pane-active-border-fg "colour4" + +# Titles +set -g set-titles on +set -g set-titles-string '#T' + +# Status bar +set -g status on +setw -g status-bg default +setw -g status-fg default + +set -g status-left '' +set -g window-status-format '#[fg=black]#I:#W#F' +set -g window-status-current-format '#[fg=blue]#I:#W#F' +set -g status-right '#[fg=cyan]#{session_name}' # }}} # Plugins {{{ - # Session save and restore stuff - set -g @resurrect-strategy-vim 'session' - set -g @resurrect-strategy-nvim 'session' - set -g @resurrect-capture-pane-contents 'on' - set -g @continuum-restore 'on' - set -g @continuum-save-interval '10' +# Session save and restore stuff +set -g @resurrect-strategy-vim 'session' +set -g @resurrect-strategy-nvim 'session' +set -g @resurrect-capture-pane-contents 'on' +set -g @continuum-restore 'on' +set -g @continuum-save-interval '10' - # Pathogen-like loader for plugins - run-shell 'find -L ~/.tmux/bundle -type f -name "*.tmux" | while read f; do bash $f; done' +# Pathogen-like loader for plugins +run-shell 'find -L ~/.tmux/bundle -type f -name "*.tmux" | while read f; do bash $f; done' # }}} # User configuration {{{ - run-shell "[ -e ~/.tmux.conf.local ] && tmux source-file ~/.tmux.conf.local; true" +run-shell "[ -e ~/.tmux.conf.local ] && tmux source-file ~/.tmux.conf.local; true" # }}} diff --git a/vim/.vimrc b/vim/.vimrc index 94af88e2..7d51063c 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -2,445 +2,444 @@ " General {{{ - " Reset all auto commands - augroup VimRc - autocmd! - augroup END - - " Sets how many lines of history VIM has to remember - set history=200 - - " Enable filetype plugins - filetype plugin on - filetype indent on - runtime macros/matchit.vim - let loaded_matchparen = 1 " disable matchparen, can be really slow - - " time out for key codes - set ttimeout - set ttimeoutlen=100 " wait up to 100ms after Esc for special key - - " We are fast - set ttyfast - - " Turn backup off, since most stuff is in SVN, git et.c anyway... - set nobackup - set nowritebackup - set noswapfile - - " Turn persistent undo on - " means that you can undo even when you close a buffer/VIM - try - set undodir=$HOME/.vim/undodir - set undofile - catch - endtry - - " Use faster grep alternatives if possible - if executable('rg') - set grepprg=rg\ --vimgrep\ --no-heading - set grepformat^=%f:%l:%c:%m - elseif executable('ag') - set grepprg=ag\ --nogroup\ --nocolor\ --vimgrep - set grepformat^=%f:%l:%c:%m - endif - - " Use system clipboard - if has("clipboard") - set clipboard=unnamedplus - endif +" Reset all auto commands +augroup VimRc + autocmd! +augroup END + +" Sets how many lines of history VIM has to remember +set history=200 + +" Enable filetype plugins +filetype plugin on +filetype indent on +runtime macros/matchit.vim +let loaded_matchparen = 1 " disable matchparen, can be really slow + +" time out for key codes +set ttimeout +set ttimeoutlen=100 " wait up to 100ms after Esc for special key + +" We are fast +set ttyfast + +" Turn backup off, since most stuff is in SVN, git et.c anyway... +set nobackup +set nowritebackup +set noswapfile + +" Turn persistent undo on +" means that you can undo even when you close a buffer/VIM +try + set undodir=$HOME/.vim/undodir + set undofile +catch +endtry + +" Use faster grep alternatives if possible +if executable('rg') + set grepprg=rg\ --vimgrep\ --no-heading + set grepformat^=%f:%l:%c:%m +elseif executable('ag') + set grepprg=ag\ --nogroup\ --nocolor\ --vimgrep + set grepformat^=%f:%l:%c:%m +endif + +" Use system clipboard +if has("clipboard") + set clipboard=unnamedplus +endif " }}} " User interface {{{ - " Set 5 lines to the cursor - when moving vertically using j/k - " and also when you click at top or bottom of the creen with mouse - set scrolloff=5 - - " display completion matches in a status line - set wildmenu - set wildmode=list:longest,list:full - - " after leaving buffer set it as hidden (so we can open buffer without saving - " previous buffer) - set hidden - - " Show what command we are writing - set showcmd - - " Show what mode we are in - set showmode - - " Ignore compiled files - set wildignore=*.o,*~,*.pyc,*.class - if has('win16') || has('win32') - set wildignore+=.git\*,.hg\*,.svn\* +" Set 5 lines to the cursor - when moving vertically using j/k +" and also when you click at top or bottom of the creen with mouse +set scrolloff=5 + +" display completion matches in a status line +set wildmenu +set wildmode=list:longest,list:full + +" after leaving buffer set it as hidden (so we can open buffer without saving +" previous buffer) +set hidden + +" Show what command we are writing +set showcmd + +" Show what mode we are in +set showmode + +" Ignore compiled files +set wildignore=*.o,*~,*.pyc,*.class +if has('win16') || has('win32') + set wildignore+=.git\*,.hg\*,.svn\* +else + set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store +endif + +if has('nvim') + " visible incremental command replace + set inccommand=nosplit + + " allows cursor change + let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1 +else + if exists('$TMUX') + let &t_SI = "\Ptmux;\\e[5 q\\\" + let &t_EI = "\Ptmux;\\e[2 q\\\" else - set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store + let &t_SI = "\e[5 q" + let &t_EI = "\e[2 q" endif +endif - if has('nvim') - " visible incremental command replace - set inccommand=nosplit +" Less annoying error messages +set shortmess=at - " allows cursor change - let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1 - else - if exists('$TMUX') - let &t_SI = "\Ptmux;\\e[5 q\\\" - let &t_EI = "\Ptmux;\\e[2 q\\\" - else - let &t_SI = "\e[5 q" - let &t_EI = "\e[2 q" - endif - endif +"Always show current position +set ruler - " Less annoying error messages - set shortmess=at +" Height of the command bar +set cmdheight=1 - "Always show current position - set ruler +" Configure backspace so it acts as it should act +set backspace=eol,start,indent - " Height of the command bar - set cmdheight=1 +" Ignore case when searching +set ignorecase - " Configure backspace so it acts as it should act - set backspace=eol,start,indent +" When searching try to be smart about cases +set smartcase - " Ignore case when searching - set ignorecase +" Highlight search results +set hlsearch - " When searching try to be smart about cases - set smartcase +" Makes search act like search in modern browsers +set incsearch - " Highlight search results - set hlsearch +" Don't redraw while executing macros (good performance config) +set lazyredraw - " Makes search act like search in modern browsers - set incsearch +" For regular expressions turn magic on +set magic - " Don't redraw while executing macros (good performance config) - set lazyredraw +" Show matching brackets when text indicator is over them +set showmatch - " For regular expressions turn magic on - set magic +" No annoying sound on errors +set noerrorbells +set novisualbell +set t_vb= +set timeoutlen=500 - " Show matching brackets when text indicator is over them - set showmatch +" Open new split panes to right and bottom, which feels more natural +set splitbelow +set splitright - " No annoying sound on errors - set noerrorbells - set novisualbell - set t_vb= - set timeoutlen=500 +" Always show the status line +set laststatus=2 - " Open new split panes to right and bottom, which feels more natural - set splitbelow - set splitright +" Status line format +set statusline= +set statusline +=\ %n\ "buffer number +set statusline +=%{&ff} "file format +set statusline +=%y "file type +set statusline +=\ %<%F "full path +set statusline +=%m "modified flag +set statusline +=%=%5l "current line +set statusline +=/%L "total lines +set statusline +=%4v\ "virtual column number +set statusline +=0x%04B\ "character under cursor - " Always show the status line - set laststatus=2 +" Always use vertical diffs +set diffopt+=vertical - " Status line format - set statusline= - set statusline +=\ %n\ "buffer number - set statusline +=%{&ff} "file format - set statusline +=%y "file type - set statusline +=\ %<%F "full path - set statusline +=%m "modified flag - set statusline +=%=%5l "current line - set statusline +=/%L "total lines - set statusline +=%4v\ "virtual column number - set statusline +=0x%04B\ "character under cursor +" Cursor line (it is slowing Vim a bit, but too useful) +set cursorline - " Always use vertical diffs - set diffopt+=vertical +" Disable text wrap +set nowrap - " Cursor line (it is slowing Vim a bit, but too useful) - set cursorline - - " Disable text wrap - set nowrap - - " Automatically rebalance windows on vim resize - autocmd VimRc VimResized * :wincmd = +" Automatically rebalance windows on vim resize +autocmd VimRc VimResized * :wincmd = " }}} " Colors and Fonts {{{ - " Enable syntax highlighting - syntax enable - - " Enable 256 color mode - set t_Co=256 - - " Set dark background - set background=dark - - " Set utf8 as standard encoding and en_US as the standard language - set encoding=utf8 - - " Use Unix as the standard file type - set fileformats=unix,dos,mac - - " Limit horizontal and vertical syntax rendering - syntax sync minlines=256 - set synmaxcol=256 - - " Adjust syntax highlighting - autocmd VimRc BufEnter * call AdjustHighlighting() - function! AdjustHighlighting() - " Make all these colors less annoying - highlight clear LineNr - highlight clear SignColumn - highlight clear FoldColumn - highlight Search cterm=NONE ctermfg=0 ctermbg=3 - highlight StatusLine ctermbg=NONE ctermfg=4 - highlight StatusLineNC cterm=underline ctermbg=NONE ctermfg=19 - highlight VertSplit ctermbg=NONE ctermfg=19 - highlight Title ctermfg=19 - highlight TabLineSel ctermbg=NONE ctermfg=4 - highlight TabLineFill ctermbg=NONE ctermfg=19 - highlight TabLine ctermbg=NONE ctermfg=19 - endfunction +" Enable syntax highlighting +syntax enable + +" Enable 256 color mode +set t_Co=256 + +" Set dark background +set background=dark + +" Set utf8 as standard encoding and en_US as the standard language +set encoding=utf8 + +" Use Unix as the standard file type +set fileformats=unix,dos,mac + +" Limit horizontal and vertical syntax rendering +syntax sync minlines=256 +set synmaxcol=256 + +" Adjust syntax highlighting +autocmd VimRc BufEnter * call AdjustHighlighting() +function! AdjustHighlighting() + " Make all these colors less annoying + highlight clear LineNr + highlight clear SignColumn + highlight clear FoldColumn + highlight Search cterm=NONE ctermfg=0 ctermbg=3 + highlight StatusLine ctermbg=NONE ctermfg=4 + highlight StatusLineNC cterm=underline ctermbg=NONE ctermfg=19 + highlight VertSplit ctermbg=NONE ctermfg=19 + highlight Title ctermfg=19 + highlight TabLineSel ctermbg=NONE ctermfg=4 + highlight TabLineFill ctermbg=NONE ctermfg=19 + highlight TabLine ctermbg=NONE ctermfg=19 +endfunction " }}} " Text, tab and indent related {{{ - " Search down into subfolders - " Provides tab-completion for all file-related tasks - set path+=** +" Search down into subfolders +" Provides tab-completion for all file-related tasks +set path+=** - " Include spelling completion when spelling enabled - set complete+=kspell +" Include spelling completion when spelling enabled +set complete+=kspell - " Use old regexpengine (maybe better performance) - set regexpengine=1 +" Use old regexpengine (maybe better performance) +set regexpengine=1 - " Includes completion is super slow, disable it - set complete-=i +" Includes completion is super slow, disable it +set complete-=i - " Better completion menu - set completeopt=longest,menuone +" Better completion menu +set completeopt=longest,menuone - " Use spaces instead of tabs - set expandtab +" Use spaces instead of tabs +set expandtab - " Be smart when using tabs - set smarttab +" Be smart when using tabs +set smarttab - " 1 tab == 2 spaces - set shiftwidth=2 - set tabstop=2 +" 1 tab == 2 spaces +set shiftwidth=2 +set tabstop=2 - " Text width is 120 characters - set textwidth=120 +" Text width is 120 characters +set textwidth=120 - " Better automatic indentation - set autoindent - set smartindent +" Better automatic indentation +set autoindent +set smartindent - " When editing a file, always jump to the last known cursor position. - " Don't do it when the position is invalid or when inside an event handler - autocmd BufReadPost * - \ if &ft !~ '^git\c' && ! &diff && line("'\"") > 0 && line("'\"") <= line("$") - \| exe 'normal! g`"zvzz' - \| endif +" When editing a file, always jump to the last known cursor position. +" Don't do it when the position is invalid or when inside an event handler +autocmd BufReadPost * + \ if &ft !~ '^git\c' && ! &diff && line("'\"") > 0 && line("'\"") <= line("$") + \| exe 'normal! g`"zvzz' + \| endif - " use syntax complete if nothing else available - autocmd VimRc Filetype * - \ if &omnifunc == "" | - \ setlocal omnifunc=syntaxcomplete#Complete | - \ endif +" use syntax complete if nothing else available +autocmd VimRc Filetype * + \ if &omnifunc == "" + \| setlocal omnifunc=syntaxcomplete#Complete + \| endif " }}} " GUI related {{{ - if has('gui_running') - " Set extra options when running in GUI mode - set mouse=a - set guitablabel=%M\ %t - autocmd VimRc GUIEnter * set vb t_vb= - autocmd VimRc GUIEnter * set guioptions-=e - - " Disable scrollbars (real hackers don't use scrollbars for navigation!) - set guioptions-=r - set guioptions-=R - set guioptions-=l - set guioptions-=L - - " Disable tabs from gui - set guioptions-=e - set guioptions-=T - - " Set font according to system - if has('mac') || has('macunix') - set guifont=Terminus:h12,Source\ Code\ Pro:h12,Menlo:h12 - elseif has('win16') || has('win32') - set guifont=Terminus:h12,Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 - elseif has('gui_gtk2') - set guifont=Terminus\ 12,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11 - elseif has('linux') - set guifont=Terminus\ 12,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11 - elseif has('unix') - set guifont=Monospace\ 11 - endif +if has('gui_running') + " Set extra options when running in GUI mode + set mouse=a + set guitablabel=%M\ %t + autocmd VimRc GUIEnter * set vb t_vb= + autocmd VimRc GUIEnter * set guioptions-=e + + " Disable scrollbars (real hackers don't use scrollbars for navigation!) + set guioptions-=r + set guioptions-=R + set guioptions-=l + set guioptions-=L + + " Disable tabs from gui + set guioptions-=e + set guioptions-=T + + " Set font according to system + if has('mac') || has('macunix') + set guifont=Terminus:h12,Source\ Code\ Pro:h12,Menlo:h12 + elseif has('win16') || has('win32') + set guifont=Terminus:h12,Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 + elseif has('gui_gtk2') + set guifont=Terminus\ 12,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11 + elseif has('linux') + set guifont=Terminus\ 12,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11 + elseif has('unix') + set guifont=Monospace\ 11 endif +endif " }}} " Mappings {{{ - " With a map leader it's possible to do extra key combinations - let mapleader = ' ' - let maplocalleader = ' ' - let g:mapleader = ' ' - - " Clear last search highlight - map :noh - - " Quickfix and location list - nmap oc :copen - nmap ol :lopen - - " Emacs like keybindings for the command line (:) are better - " and we cannot use Vi style-binding here anyway, because ESC - " just closes the command line and using Home and End.. just no, f.e. OSX keyboards - " do not even have them, because they are useless. - cnoremap - cnoremap - cnoremap - cnoremap - cnoremap - - " :W sudo saves the file - " (useful for handling the permission-denied error) - command! W w !sudo tee % > /dev/null - - " If session file exists, source it, and then start session recording - function! Session() - if filereadable('Session.vim') - source Session.vim - endif - - :Obsession - endfunction - command! -bar Session :call Session() +" With a map leader it's possible to do extra key combinations +let mapleader = ' ' +let maplocalleader = ' ' +let g:mapleader = ' ' + +" Clear last search highlight +map :noh + +" Quickfix and location list +nmap oc :copen +nmap ol :lopen + +" Emacs like keybindings for the command line (:) are better +" and we cannot use Vi style-binding here anyway, because ESC +" just closes the command line and using Home and End.. just no, f.e. OSX keyboards +" do not even have them, because they are useless. +cnoremap +cnoremap +cnoremap +cnoremap +cnoremap + +" :W sudo saves the file +" (useful for handling the permission-denied error) +command! W w !sudo tee % > /dev/null + +" If session file exists, source it, and then start session recording +function! Session() + if filereadable('Session.vim') + source Session.vim + endif + + :Obsession +endfunction +command! -bar Session :call Session() " }}} " Plugins {{{ - " Modify runtime path - set rtp+=~/.fzf - runtime bundle/vim-pathogen/autoload/pathogen.vim - execute pathogen#infect() - execute pathogen#infect('~/.vim/bundle/local/{}') - execute pathogen#helptags() - - " If base16 theme is set from shell, load it - if filereadable(expand('~/.vimrc_background')) - let base16colorspace=256 - source ~/.vimrc_background - else - " Set theme if possible - try - colorscheme base16-solarized-dark - catch - endtry +" Modify runtime path +set rtp+=~/.fzf +runtime bundle/vim-pathogen/autoload/pathogen.vim +execute pathogen#infect() +execute pathogen#infect('~/.vim/bundle/local/{}') +execute pathogen#helptags() + +" If base16 theme is set from shell, load it +if filereadable(expand('~/.vimrc_background')) + let base16colorspace=256 + source ~/.vimrc_background +else + " Set theme if possible + try + colorscheme base16-solarized-dark + catch + endtry +endif + +" VimWiki +let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}] +let g:vimwiki_global_ext=0 + +" EditorConfig +let g:EditorConfig_core_mode = 'external_command' " Speed up editorconfig plugin +let g:EditorConfig_exclude_patterns = ['fugitive://.*'] " Fix EditorConfig for fugitive + +" Completor and UltiSnips +let g:UltiSnipsExpandTrigger="" +let g:completor_auto_trigger = 0 +inoremap pumvisible() ? "\" : "\\\" +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\\" : "\" + +" Fugitive +autocmd VimRc BufReadPost fugitive://* set bufhidden=delete +nnoremap gs :Gstatus +nnoremap gd :Gdiff +nnoremap gc :Gcommit +nnoremap gb :Gblame +nnoremap gl :Glog +nnoremap gp :Git push +nnoremap gw :Gwrite +nnoremap gr :Gremove + +" Syntastic +nmap mf :SyntasticCheck +nmap mF :make +let g:syntastic_always_populate_loc_list = 1 +set statusline+=%#warningmsg#%{SyntasticStatuslineFlag()}%* + +" Vim Test +let test#strategy = 'make' +nmap mt :TestFile +nmap mT :TestSuite +nmap mtt :TestNearest + +" FZF {{{ +" rg command suffix, [options] +function! VRg_raw(command_suffix, ...) + return call('fzf#vim#grep', extend(['rg --no-heading --column --color always '.a:command_suffix, 1], a:000)) +endfunction + +" query, [[ag options], options] +function! VRg(query, ...) + let query = empty(a:query) ? '^.' : a:query + let args = copy(a:000) + let ag_opts = len(args) > 1 ? remove(args, 0) : '' + let command = ag_opts . ' ' . "'".substitute(query, "'", "'\\\\''", 'g')."'" + return call('VRg_raw', insert(args, command, 0)) +endfunction + +" Try to use ripgrep, otherwise fallback to ag +function! VFind(query, ...) + let args = insert(copy(a:000), a:query, 0) + if executable('rg') + return call('VRg', args) endif - " VimWiki - let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}] - let g:vimwiki_global_ext=0 - - " EditorConfig - let g:EditorConfig_core_mode = 'external_command' " Speed up editorconfig plugin - let g:EditorConfig_exclude_patterns = ['fugitive://.*'] " Fix EditorConfig for fugitive - - " Completor and UltiSnips - let g:UltiSnipsExpandTrigger="" - let g:completor_auto_trigger = 0 - inoremap pumvisible() ? "\" : "\\\" - inoremap pumvisible() ? "\" : "\" - inoremap pumvisible() ? "\\" : "\" - - " Fugitive - autocmd VimRc BufReadPost fugitive://* set bufhidden=delete - nnoremap gs :Gstatus - nnoremap gd :Gdiff - nnoremap gc :Gcommit - nnoremap gb :Gblame - nnoremap gl :Glog - nnoremap gp :Git push - nnoremap gw :Gwrite - nnoremap gr :Gremove - - " Syntastic - nmap mf :SyntasticCheck - nmap mF :make - let g:syntastic_always_populate_loc_list = 1 - set statusline+=%#warningmsg#%{SyntasticStatuslineFlag()}%* - - " Vim Test - let test#strategy = 'make' - nmap mt :TestFile - nmap mT :TestSuite - nmap mtt :TestNearest - - " FZF {{{ - " rg command suffix, [options] - function! VRg_raw(command_suffix, ...) - return call('fzf#vim#grep', extend(['rg --no-heading --column --color always '.a:command_suffix, 1], a:000)) - endfunction - - " query, [[ag options], options] - function! VRg(query, ...) - let query = empty(a:query) ? '^.' : a:query - let args = copy(a:000) - let ag_opts = len(args) > 1 ? remove(args, 0) : '' - let command = ag_opts . ' ' . "'".substitute(query, "'", "'\\\\''", 'g')."'" - return call('VRg_raw', insert(args, command, 0)) - endfunction - - " Try to use ripgrep, otherwise fallback to ag - function! VFind(query, ...) - let args = insert(copy(a:000), a:query, 0) - if executable('rg') - return call('VRg', args) - endif - - return call('fzf#vim#ag', args) - endfunction - command! -bang -nargs=* Find call VFind(, 0) - - " Menus - nmap / :Find - nmap T :Tags - nmap t :BTags - nmap F :Files - nmap f :GFiles - nmap a :Commands - nmap h :History - nmap b :Buffers - nmap w :Windows - nmap s :Snippets - nmap c :Commits - nmap ? :Helptags - " }}} + return call('fzf#vim#ag', args) +endfunction +command! -bang -nargs=* Find call VFind(, 0) + +nmap / :Find +nmap T :Tags +nmap t :BTags +nmap F :Files +nmap f :GFiles +nmap a :Commands +nmap h :History +nmap b :Buffers +nmap w :Windows +nmap s :Snippets +nmap c :Commits +nmap ? :Helptags +" }}} " }}} " User configuration {{{ -" - try - " Load user configuration - source ~/.vimrc.local - catch - endtry + +try + " Load user configuration + source ~/.vimrc.local +catch +endtry " }}} diff --git a/zsh/.zsh/bundle/ix.plugin.zsh b/zsh/.zsh/bundle/ix.plugin.zsh new file mode 100644 index 00000000..f87aec63 --- /dev/null +++ b/zsh/.zsh/bundle/ix.plugin.zsh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# Examples: +# ix hello.txt # paste file (name/ext will be set). +# echo Hello world. | ix # read from STDIN (won't set name/ext). +# ix -n 1 self_destruct.txt # paste will be deleted after one read. +# ix -i ID hello.txt # replace ID, if you have permission. +# ix -d ID + +ix() { + local opts + local OPTIND + [ -f "$HOME/.netrc" ] && opts='-n' + while getopts ":hd:i:n:" x; do + case $x in + h) echo "ix [-d ID] [-i ID] [-n N] [opts]"; return;; + d) $echo curl $opts -X DELETE ix.io/$OPTARG; return;; + i) opts="$opts -X PUT"; local id="$OPTARG";; + n) opts="$opts -F read:1=$OPTARG";; + esac + done + shift $(($OPTIND - 1)) + [ -t 0 ] && { + local filename="$1" + shift + [ "$filename" ] && { + curl $opts -F f:1=@"$filename" $* ix.io/$id + return + } + echo "^C to cancel, ^D to send." + } + curl $opts -F f:1='<-' $* ix.io/$id +} diff --git a/zsh/.zshrc b/zsh/.zshrc index eaf1f767..de8fb2fe 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -2,104 +2,101 @@ # General {{{ - # Source .profile - if [ -f ~/.profile ]; then - source ~/.profile - fi +# Source .profile +if [ -f ~/.profile ]; then + source ~/.profile +fi - # Enable colors - export CLICOLOR=1 +# Enable colors +export CLICOLOR=1 # }}} # Aliases & functions {{{ - # Alias xclip copy/paste - if command -v xclip >/dev/null 2>&1; then - alias xcopy='xclip -i -selection clipboard' - alias xpaste='xclip -o -selection clipboard' - fi +# Alias xclip copy/paste +if command -v xclip >/dev/null 2>&1; then + alias xcopy='xclip -i -selection clipboard' + alias xpaste='xclip -o -selection clipboard' +fi - # Open Vim and start saving it's session - alias vims='vim -c "Session"' - - # Hastebin fast share - haste() { a=$(cat); curl -X POST -s -d "$a" https://hastebin.com/documents | awk -F '"' '{print "https://hastebin.com/"$4}'; } +# Open Vim and start saving it's session +alias vims='vim -c "Session"' # }}} # Plugins {{{ - # Load zim - if [ -f ~/.zim/init.zsh ]; then - # Select what modules you would like enabled. - zmodules=( \ - archive \ - directory \ - environment \ - fasd \ - git \ - git-info \ - history \ - input \ - utility \ - prompt \ - syntax-highlighting \ - history-substring-search \ - completion) - - # Set the string below to the desired terminal title format string. - # Below uses the following format: 'username@host:/current/directory' - ztermtitle='%n@%m:%~' - - # This determines what highlighters will be used with the syntax-highlighting module. - zhighlighters=(main brackets cursor) - - # Set prompt theme - zprompt_theme='pure' - PURE_PROMPT_SYMBOL='$' - - # Source zim - source ~/.zim/init.zsh - fi - - # Load hub alias - command -v hub >/dev/null 2>&1 && eval "$(hub alias -s)" - - # Pathogen-like loader for plugins - find -L ~/.zsh/bundle -type f -name "*.plugin.zsh" | sort | - while read filename; do source "$filename"; done - - # Load fzf after plugins to be able to override them - [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - - # Use faster FZF grep command if possible - if command -v rg >/dev/null 2>&1; then - export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --glob "!.git/*"' - elif command -v ag >/dev/null 2>&1; then - export FZF_DEFAULT_COMMAND='ag -g ""' - fi - - # Load base16 theme - [ -z $BASE16_THEME ] && base16_solarized-dark - - unalias z - z() { - local dir - dir="$(fasd -Rdl "$1" | fzf -1 -0 --height 40% --no-sort +m)" && cd "${dir}" || return 1 - } - - unalias v - v() { - local file - file="$(fasd -Rfl "$1" | fzf -1 -0 --height 40% --no-sort +m)" && vim "${file}" || return 1 - } +# Load zim +if [ -f ~/.zim/init.zsh ]; then + # Select what modules you would like enabled. + zmodules=( \ + archive \ + directory \ + environment \ + fasd \ + git \ + git-info \ + history \ + input \ + utility \ + prompt \ + syntax-highlighting \ + history-substring-search \ + completion) + + # Set the string below to the desired terminal title format string. + # Below uses the following format: 'username@host:/current/directory' + ztermtitle='%n@%m:%~' + + # This determines what highlighters will be used with the syntax-highlighting module. + zhighlighters=(main brackets cursor) + + # Set prompt theme + zprompt_theme='pure' + PURE_PROMPT_SYMBOL='$' + + # Source zim + source ~/.zim/init.zsh +fi + +# Load hub alias +command -v hub >/dev/null 2>&1 && eval "$(hub alias -s)" + +# Pathogen-like loader for plugins +find -L ~/.zsh/bundle -type f -name "*.plugin.zsh" | sort | +while read filename; do source "$filename"; done + +# Load fzf after plugins to be able to override them +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +# Use faster FZF grep command if possible +if command -v rg >/dev/null 2>&1; then + export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --glob "!.git/*"' +elif command -v ag >/dev/null 2>&1; then + export FZF_DEFAULT_COMMAND='ag -g ""' +fi + +# Load base16 theme +[ -z $BASE16_THEME ] && base16_solarized-dark + +unalias z +z() { + local dir + dir="$(fasd -Rdl "$1" | fzf -1 -0 --height 40% --no-sort +m)" && cd "${dir}" || return 1 +} + +unalias v +v() { + local file + file="$(fasd -Rfl "$1" | fzf -1 -0 --height 40% --no-sort +m)" && vim "${file}" || return 1 +} # }}} # User configuration {{{ - # Load user config - [[ -f "~/.zshrc.local" ]] && source "~/.zshrc.local" +# Load user config +[[ -f "~/.zshrc.local" ]] && source "~/.zshrc.local" # }}}