vim --recycle --add-fuzzy-matching; bash --add-fuzzy-matching

crash2
Geoffrey Frogeye 2018-06-24 18:27:20 +02:00
parent 57f9edbf56
commit 81a0bc59c5
4 changed files with 107 additions and 99 deletions

11
bashrc
View File

@ -42,8 +42,6 @@ alias dd='dd status=progress'
alias rm='rm -Iv --one-file-system'
alias free='free -m'
alias df='df -h'
alias pacman='pacman --color auto'
alias pacaur='pacaur --color auto'
alias dmesg='dmesg --ctime'
# Frequent mistakes
@ -105,7 +103,7 @@ shopt -s hostcomplete
export HISTSIZE=100000
export HISTFILESIZE=${HISTSIZE}
export HISTCONTROL=ignorespace:erasedups
export HISTTIMEFORMAT="%d/%m/%y %H:%M:%S "
export HISTTIMEFORMAT="%y-%m-%d %H:%M:%S "
# PROMPT CUSTOMIZATION
@ -132,6 +130,13 @@ export PATH="$HOME/.bin/:$HOME/.scripts/:$PATH"
# Bash completion
[ -f /etc/bash_completion ] && . /etc/bash_completion
# Fuzzy matching all the way
export FZF_DEFAULT_OPTS="--height 100% --layout=default"
export FZF_CTRL_T_OPTS="--preview '[[ -d {} ]] && ls -l --color=always {} || [[ \$(file --mime {}) =~ binary ]] && echo {} is a binary file || (highlight -O ansi -l {} || coderay {} || rougify {} || cat {}) 2> /dev/null | head -500'"
export FZF_COMPLETION_OPTS="${FZF_CTRL_T_OPTS}"
[ -f /usr/share/fzf/completion.bash ] && source /usr/share/fzf/completion.bash
[ -f /usr/share/fzf/key-bindings.bash ] && source /usr/share/fzf/key-bindings.bash
# Bad day mood-saver
function fuck {
if which thefuck &> /dev/null

View File

@ -174,7 +174,6 @@ function systemdUserUnit {
# Common CLI
.Xresources.d/configure
# Utils
inst coreutils man openssl-tool grep sed sh tar
@ -184,9 +183,10 @@ if [ $TERMUX == 1 ]; then
inst tsu
fi
fi
inst moreutils screen ncdu lsof htop proxytunnel pv curl wget sshfs netcat mosh bash-completion rsync pwgen
inst moreutils screen ncdu lsof htop proxytunnel pv curl wget netcat mosh bash-completion rsync pwgen fzf highlight
# TODO Test those who are on Debian machines and those who aren't
if [ $ARCH == 1 ]; then
inst bash-completion
inst bash-completion tldr
altInst gopass
else
inst pass
@ -226,31 +226,12 @@ if [ $DEBIAN == 1 ]; then
else
inst ctags
fi
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
# YouCompleteMe (vim plugin)
if [ $ARCH == 1 ] && [ $ADMIN == 1 ]; then
if [ $EXTRA == 1 ]; then
altInst vim-youcompleteme-git
else
altInst vim-youcompleteme-core-git
fi
else
if [ $DEBIAN == 1 || $TERMUX == 1 ]; then
inst python-dev python3-dev cmake
fi
YCM_ARGS=""
if [ $TERMUX != 1 ]; then
YCM_ARGS="$YCM_ARGS --clang-completer --tern-completer"
fi
python $HOME/.vim/bundle/YouCompleteMe/install.py $YCM_ARGS
fi
vim +PlugUpgrade +PlugUpdate +PlugInstall +qall
# Common GUI
if [ $GUI == 1 ]; then
.Xresources.d/configure
# Desktop manager
inst i3 i3lock dunst unclutter xautolock feh numlockx scrot rxvt-unicode xclip
curl "https://raw.githubusercontent.com/FortAwesome/Font-Awesome/a8386aae19e200ddb0f6845b5feeee5eb7013687/fonts/fontawesome-webfont.ttf" > ~/.local/share/fonts/fontawesome-webfont.ttf
@ -323,6 +304,7 @@ fi
if [ $EXTRA == 1 ]; then
# Extra dev
inst cmake clang llvm npm
inst python-rope
# Extra CLI
inst ffmpeg youtube-dl optipng syncthing ccache mutt

View File

@ -52,7 +52,7 @@ function _machines-api {
wget $MACHINES_API/$route --content-on-error --quiet --output-document=- "$@"
result=$?
if [ $result != 0 ]; then
echo "[ERROR] wget returned $result..." > /dev/stderr
echo "[ERROR] wget returned $result..." 1>&2;
exit 2
fi
}
@ -77,7 +77,7 @@ function _machines-pubFromCrt {
function _machines-verifyCertificate {
return
if openssl verify $MACHINES_CONFIG/machines.crt | grep -v 'error 18' | grep 'error' --quiet; then
echo "[ERROR] Invalid certificate" > /dev/stderr
echo "[ERROR] Invalid certificate" 1>&2;
exit 1
fi
}
@ -92,7 +92,7 @@ function _machines-ensurePub {
if [ $? == 1 ]; then
mv $CERT_FILE $MACHINES_CONFIG/machines.crt &> /dev/null
else
echo "[ERROR] Certificate rejected." > /dev/stderr
echo "[ERROR] Certificate rejected." 1>&2;
exit 1
fi
fi
@ -105,7 +105,7 @@ function _machines-ensurePub {
function _machines-ensureAdmin {
if [ ! -f $MACHINES_CONFIG/machines.key ]; then
echo "[ERROR] You need have to have the private key to do that" > /dev/stderr
echo "[ERROR] You need have to have the private key to do that" 1>&2;
exit 1
fi
}
@ -127,9 +127,9 @@ function _machines-getAkey { # network
SIGN_FILE=$(mktemp)
_machines-api akey/$1 > $KEY_FILE
_machines-api akey/$1?signature > $SIGN_FILE
md5sum $KEY_FILE &> /dev/stderr
md5sum $SIGN_FILE &> /dev/stderr
md5sum $MACHINES_CONFIG/machines.pub &> /dev/stderr
md5sum $KEY_FILE &1>&2;
md5sum $SIGN_FILE &1>&2;
md5sum $MACHINES_CONFIG/machines.pub &1>&2;
openssl dgst -sha256 -verify $MACHINES_CONFIG/machines.pub -signature $SIGN_FILE $KEY_FILE &> /dev/null
if [ $? == 0 ]; then
@ -151,7 +151,7 @@ function _machines-updateAkey {
return 0
else
cat $MYKEY_FILE
echo "[ERROR] Authorized keys are not properly signed" > /dev/stderr
echo "[ERROR] Authorized keys are not properly signed" 1>&2;
rm $MYKEY_FILE
exit 1
fi
@ -378,7 +378,7 @@ function machines_update-all {
function machines_regen-keys {
if [[ -e $MACHINES_CONFIG/machines.key || -e $MACHINES_CONFIG/machines.pub || -e $MACHINES_CONFIG/machines.crt ]]; then
echo "[ERROR] Please delete the pem files manually to prove you know what you're doing." > /dev/stderr
echo "[ERROR] Please delete the pem files manually to prove you know what you're doing." 1>&2;
exit 1
else
openssl genrsa -out $MACHINES_CONFIG/machines.key 4096
@ -394,7 +394,7 @@ function machines_regen-keys {
function machines_setup {
if [ -e $MACHINES_CONFIG/this.name ]; then
echo "[ERROR] This machine is already set up" > /dev/stderr
echo "[ERROR] This machine is already set up" 1>&2;
exit 1
fi

143
vimrc
View File

@ -5,57 +5,52 @@ set nocompatible
filetype off
""" PLUGINS MANAGEMENT """
" Voir :h vundle
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
" NOTE 18-06-24 Got rid of Vundle in favor of vim-plug (why: more recent, supports
" Neovim, simpler). Commented out plugins that seemed useless, feel free to
" uncomment them again if you need to
Plugin 'L9'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'tomasr/molokai'
"Bundle 'Shougo/neosnippet'
"Bundle 'Shougo/neosnippet-snippets'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/tpope-vim-abolish'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'airblade/vim-gitgutter'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'mbbill/undotree'
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-easytags'
Plugin 'majutsushi/tagbar'
Plugin 'wellle/targets.vim'
Plugin 'Chiel92/vim-autoformat'
" Plugin 'Valloric/YouCompleteMe'
Plugin 'artur-shaik/vim-javacomplete2'
Plugin 'tomtom/tcomment_vim'
Plugin 'Shougo/denite.nvim'
Plugin 'tomlion/vim-solidity'
Plugin 'godlygeek/tabular'
Plugin 'jrozner/vim-antlr'
" Auto-install vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call vundle#end() " required
filetype plugin indent on " required
" Plugin definition
call plug#begin()
" Plug 'L9'
" Plug 'rstacruz/sparkup', {'rtp': 'vim/'}
Plug 'tomasr/molokai'
" Plug 'tpope/vim-surround'
" Plug 'tpope/vim-fugitive'
" Plug 'tpope/vim-repeat'
" Plug 'tpope/tpope-vim-abolish'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'mbbill/undotree'
Plug 'xolox/vim-misc' " Required for 'xolox/vim-easytags'
Plug 'xolox/vim-easytags'
Plug 'majutsushi/tagbar'
" Plug 'wellle/targets.vim'
Plug 'Chiel92/vim-autoformat'
Plug 'tomtom/tcomment_vim'
" Plug 'Shougo/denite.nvim'
" Plug 'tomlion/vim-solidity'
" Plug 'godlygeek/tabular'
" Plug 'jrozner/vim-antlr'
Plug 'maralla/completor.vim'
Plug 'python-mode/python-mode', { 'branch': 'develop' }
Plug 'junegunn/fzf', {'do': './install --bin'}
Plug 'junegunn/fzf.vim'
call plug#end()
""" UNDOTREE """
nmap <F7> :UndotreeToggle<CR>:UndotreeFocus<CR>
""" CTRLP """
let g:ctrlp_custom_ignore = {
\ 'dir': '\v([\/]\.(git|hg|svn)|log|node_modules|bower_components|__pycache__|vendor|output|buildroot|doc)$',
\ 'file': '\v\.(exe|so|dll|o|pyc|a)$',
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
\ }
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlPMixed'
map <a-p> :CtrlPMRUFiles<CR>
nmap <F7> :UndotreeToggle<CR>
""" TAGBAR """
@ -74,25 +69,47 @@ let g:airline_section_b = airline#section#create(['branch', 'hunks'])
let g:airline_section_z = airline#section#create(['%B', '@', '%l', ':', '%c'])
let g:airline_theme = 'wombat'
""" YOUCOMPLETEME """
" let g:ycm_global_ycm_extra_conf = '~/.config/ycm_extra_conf.py'
let g:ycm_global_ycm_extra_conf = '/usr/share/vim/vimfiles/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_server_python_interpreter = '/usr/bin/python2'
nmap gTi :YcmCompleter GoToInclude<CR>
nmap gTc :YcmCompleter GoToDeclaration<CR>
nmap gTf :YcmCompleter GoToDefinition<CR>
nmap gt :YcmCompleter GoTo<CR>
nmap gT :YcmCompleter GoToImprecise<CR>
nmap gTr :YcmCompleter GoToReference<CR>
""" AUTOFORMAT """
nmap <F3> :Autoformat<CR>
""" JAVACOMPLETE """
""" PYMODE """
" let g:pymode_lint_ignore = ["C901"]
let g:pymode_lint_cwindow = 0
""" FZF """
let g:fzf_layout = { 'down': '~100%' }
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'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
nmap gF :Files<CR>
nmap gf :GFiles<CR>
nmap gb :Buffers<CR>
nmap gL :Lines<CR>
nmap gl :BLines<CR>
nmap gT :Tags<CR>
nmap gt :BTags<CR>
nmap gm :Marks<CR>
nmap gw :Windows<CR>
nmap gh :History<CR>
nmap gH :History:<CR>
nmap gS :History/<CR>
nmap gs :Snippets<CR>
autocmd FileType java setlocal omnifunc=javacomplete#Complete
""" VIM SETTINGS """
@ -141,6 +158,9 @@ filetype on
filetype plugin on
filetype indent on
set wildmode=longest,list
set showcmd
" Put plugins and dictionaries in this dir (also on Windows)
let vimDir = '$HOME/.vim'
let &runtimepath.=','.vimDir
@ -161,7 +181,8 @@ cmap w!! w !sudo tee > /dev/null %
imap jk <Esc>
imap<Esc>
map <Enter> o<Esc>
nmap <Enter> o<Esc>
nmap <C-H> :bp<CR>
nmap <C-L> :bn<CR>
nmap <C-K> kkkkkkkkkkkkkkkkkkkkk