Skip to content

Commit

Permalink
set better default SKIM_DEFAULT_COMMAND for vim
Browse files Browse the repository at this point in the history
As described in #3, I do think a better default for SKIM_DEFAULT_COMMAND
is good for both new and old users.
  • Loading branch information
lotabout committed Oct 5, 2017
1 parent d8844ba commit 3a24d1b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions plugin/skim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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 ."

This comment has been minimized.

Copy link
@polyzen
endif

let s:is_win = has('win32') || has('win64')
if s:is_win && &shellslash
set noshellslash
Expand Down

0 comments on commit 3a24d1b

Please sign in to comment.