From c6723a045c7311dcef2a9f0240a23523242cdc2a Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 10 Apr 2017 17:29:01 +0200 Subject: [PATCH] Fix editorconfig for markdown, improve tab compl Signed-off-by: Tomas Slusny --- .editorconfig | 3 +++ README.md | 15 ++++++----- editorconfig/.editorconfig | 3 +++ .../fzf-contrib/autoload/fzf/contrib.vim | 27 +++++++++---------- .../bundle/fzf-contrib/plugin/fzf-contrib.vim | 4 +-- zsh/.zshrc | 2 ++ 6 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.editorconfig b/.editorconfig index f1a24789..bd10f194 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,6 +8,9 @@ end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true +[*.md] +trim_trailing_whitespace = false + [Makefile] indent_style = tab indent_size = 8 diff --git a/README.md b/README.md index f51a754a..2fc53e3d 100644 --- a/README.md +++ b/README.md @@ -69,17 +69,17 @@ To add your own Vim, Tmux or Zsh plugin you can just clone it to proper * [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): + * [__cdls__*](https://github.com/deathbeam/dotfiles/tree/master/zsh/.zsh/bundle/cdls.plugin.zsh): Runs `ls -A` on directory change - * [codi](https://github.com/deathbeam/dotfiles/tree/master/zsh/.zsh/bundle/codi.plugin.zsh): + * [__codi__*](https://github.com/deathbeam/dotfiles/tree/master/zsh/.zsh/bundle/codi.plugin.zsh): A nice way to use Codi is through a shell wrapper * [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): + * [__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): + * [__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): + * [__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 @@ -94,7 +94,7 @@ To add your own Vim, Tmux or Zsh plugin you can just clone it to proper * [editorconfig-vim](https://github.com/editorconfig/editorconfig-vim): EditorConfig plugin for Vim * [fzf.vim](https://github.com/junegunn/fzf.vim): fzf :heart: vim - * [fzf-contrib](https://github.com/deathbeam/dotfiles/tree/master/vim/.vim/bundle/fzf-contrib): + * [__fzf-contrib__*](https://github.com/deathbeam/dotfiles/tree/master/vim/.vim/bundle/fzf-contrib): Completion menu using FZF, tab-completion, support for `ripgrep` in FZF * [syntastic](https://github.com/scrooloose/syntastic): Syntax checking hacks for vim @@ -155,3 +155,6 @@ To add your own Vim, Tmux or Zsh plugin you can just clone it to proper system clipboard * [vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator): Seamless navigation between tmux panes and vim splits + +__*__ _These plugins are made by me, so do not bother searching for them online_ +__**__ _These plugins are copied from oh-my-zsh, with some modifications_ diff --git a/editorconfig/.editorconfig b/editorconfig/.editorconfig index f1a24789..bd10f194 100644 --- a/editorconfig/.editorconfig +++ b/editorconfig/.editorconfig @@ -8,6 +8,9 @@ end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true +[*.md] +trim_trailing_whitespace = false + [Makefile] indent_style = tab indent_size = 8 diff --git a/vim/.vim/bundle/fzf-contrib/autoload/fzf/contrib.vim b/vim/.vim/bundle/fzf-contrib/autoload/fzf/contrib.vim index 91c29ccf..43202afb 100644 --- a/vim/.vim/bundle/fzf-contrib/autoload/fzf/contrib.vim +++ b/vim/.vim/bundle/fzf-contrib/autoload/fzf/contrib.vim @@ -1,4 +1,4 @@ -function! fzf#contrib#complete(findstart, base) +function! fzf#contrib#completefunc(findstart, base) abort let Func = function(get(g:, 'fzf#contrib#completefunc', &omnifunc)) let results = Func(a:findstart, a:base) echom a:base @@ -20,30 +20,27 @@ function! fzf#contrib#complete(findstart, base) if exists('*UltiSnips#ExpandSnippet') \ && len(results) == 1 \ && len(results[0]) > 1 - \ && match(split(results[0], "\t")[1], '\[snip\]') != -1 + \ && split(results[0], "\t")[1] =~? '\[snip\]' call feedkeys("\=UltiSnips#ExpandSnippet()\") endif return map(results, 'split(v:val, "\t")[0]') endfunction -function! fzf#contrib#trigger_complete() - setlocal completefunc=fzf#contrib#complete +function! fzf#contrib#complete(...) abort + if len(a:000) && a:000[0] + if getline('.')[col('.') - 1] !~# '\S' + call feedkeys("\", 'n') + return + endif + endif + + setlocal completefunc=fzf#contrib#completefunc setlocal completeopt=menu call feedkeys("\\", 'n') endfunction -function! fzf#contrib#tab_complete() - let col = col('.') - 1 - - if !col || getline('.')[col - 1] !~# '\k' - call feedkeys("\", 'n') - else - call fzf#contrib#trigger_complete() - endif -endfunction - -function! fzf#contrib#grep(query, ...) +function! fzf#contrib#grep(query, ...) abort if executable('rg') let query = empty(a:query) ? '^.' : a:query let args = copy(a:000) diff --git a/vim/.vim/bundle/fzf-contrib/plugin/fzf-contrib.vim b/vim/.vim/bundle/fzf-contrib/plugin/fzf-contrib.vim index 517e4b1d..538da89e 100644 --- a/vim/.vim/bundle/fzf-contrib/plugin/fzf-contrib.vim +++ b/vim/.vim/bundle/fzf-contrib/plugin/fzf-contrib.vim @@ -1,3 +1,3 @@ -imap :call fzf#contrib#trigger_complete() -inoremap :call fzf#contrib#tab_complete() +inoremap :call fzf#contrib#complete() +inoremap :call fzf#contrib#complete(1) command! -bang -nargs=* Grep call fzf#contrib#grep(, 0) diff --git a/zsh/.zshrc b/zsh/.zshrc index d85d0ac1..098c3f0d 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -73,8 +73,10 @@ while read filename; do source "$filename"; done # 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/*"' + export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND elif command -v ag >/dev/null 2>&1; then export FZF_DEFAULT_COMMAND='ag -g ""' + export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND fi # Load base16 theme