From 3a24d1b8b40436db3a45c2ed0390e6f99d2f2da8 Mon Sep 17 00:00:00 2001 From: Jinzhou Zhang Date: Thu, 5 Oct 2017 18:54:42 +0800 Subject: [PATCH] set better default SKIM_DEFAULT_COMMAND for vim As described in #3, I do think a better default for SKIM_DEFAULT_COMMAND is good for both new and old users. --- README.md | 33 +++++++++++++++++++++++++++++++++ plugin/skim.vim | 4 ++++ 2 files changed, 37 insertions(+) diff --git a/README.md b/README.md index 56a01015..6c3c7f48 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,9 @@ skim provides a single executable: `sk`, basically anywhere you would want to us - [Interactive Mode](#interactive-mode) - [Preview Window](#preview-window) - [Fields Support](#fields-support) +- [FAQ](#faq) + - [How to ignore files?](#how-to-ignore-files) + - [Some files are not shown in vim plugin](#some-files-are-not-shown-in-vim-plugin) - [Difference to fzf](#difference-to-fzf) - [How to contribute](#how-to-contribute) @@ -376,6 +379,36 @@ Also you can use `--with-nth` to re-arrange the order of fields. - `start..end` -- starting from `start`-th field, all the way to `end`-th field, excluding `end`. +# FAQ + +## How to ignore files? + +Skim invoke `find .` to fetch a list of files for filtering. You can override +that by setting the environment variable `SKIM_DEFAULT_COMMAND`. For example: + +```sh +$ SKIM_DEFAULT_COMMAND="git ls-tree -r --name-only HEAD || rg --files || find ." +$ sk +``` + +You could put it in your `.bashrc` or `.zshrc` if you like it to be default. + +## Some files are not shown in vim plugin + +If you use the vim plugin and execute the `:SK` command, you might find some +of your files not shown. + +As described in [#3](https://github.com/lotabout/skim/issues/3), in the vim +plugin, `SKIM_DEFAULT_COMMAND` is set to the command by default: + +``` +let $SKIM_DEFAULT_COMMAND = "git ls-tree -r --name-only HEAD || rg --files || ag -l -g \"\" || find ." +``` + +That means the files not recognized by git will not shown. Either override the +default with `let $SKIM_DEFAULT_COMMAND = ''` or find the missing file by +yourself. + # Difference to fzf [fzf](https://github.com/junegunn/fzf) is a command-line fuzzy finder written diff --git a/plugin/skim.vim b/plugin/skim.vim index 8cee98f1..c57a42b6 100644 --- a/plugin/skim.vim +++ b/plugin/skim.vim @@ -26,6 +26,10 @@ if exists('g:loaded_skim') endif let g:loaded_skim = 1 +if empty($SKIM_DEFAULT_COMMAND) + let $SKIM_DEFAULT_COMMAND = "git ls-tree -r --name-only HEAD || rg --files || ag -l -g \"\" || find ." +endif + let s:is_win = has('win32') || has('win64') if s:is_win && &shellslash set noshellslash