Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Windows (requires 0.16.10) #372

Closed
wants to merge 17 commits into from
Closed

Conversation

janlazo
Copy link
Contributor

@janlazo janlazo commented May 13, 2017

Main PR to fix commands for Windows and use list type for options if required.
Added workarounds for commands not using list type for options such as :Helptags

fzf#shellescape is not used in this PR so shellslash is set/unset depending on the function.

  • set shellslash
    • path functions such as expand and glob to avoid \"
    • shellescape commands on sh
  • set noshellslash
    • shellescape commands on cmd.exe

Requirements

Functions

  • s:fzf (48ad1c3, supports list type for options)
  • s:wrap (48ad1c3, supports list type for options)
  • fzf#vim#grep (9a72951)
    • requires list type for option if prompt contains quotes or escape characters (\^")
  • fzf#vim#complete
    • s:complete_trigger (da8f862)
    • fzf#vim#complete#word (f1619d4, not supported)
      • relies on /usr/share/dict/words which does not exist in Windows (no equivalent??)
    • fzf#vim#complete#path (24c6594)
      • requires set shellslash for now
      • TODO: use list type for options to resolve shellescape issues in cmd.exe
    • fzf#vim#complete#line
    • fzf#vim#complete#buffer_line
  • fzf#vim#map (no fixes required)
  • fzf#vim#with_preview (9535460)

Commands

  • Files (48ad1c3)
  • GFiles (no fixes required)
  • GFiles? (7e5a6af, list type for options not required, requires sh.exe from Cygwin)
  • Buffers (48ad1c3)
  • Colors (no fixes required)
  • Ag (a943f21)
    • depends on fzf#vim#grep
  • Lines (cb86ba6)
  • BLines (48ad1c3)
  • Tags (7ed4abb)
  • BTags (7cfbeca)
  • Marks (no fixes required)
  • Windows (no fixes required)
  • Locate (052ec67, not supported)
    • locate requires Cygwin and is useless without indexing in Windows 7/8
    • no built-in alternative in Windows 7/8
    • need some check to enable the command for WSL users
  • History (no fixes required)
  • History: (no fixes required)
  • History/ (no fixes required)
  • Snippets (no fixes required)
  • Commits (6d49ed1, requires sh.exe from Cygwin)
  • Commands
  • Maps (no fixes required)
  • Helptags (Helptags implementation #376)
    • Resolve command for source (6858b23, 03c85fd)
      • uses sh, grep, perl, sort (requires Cygwin)
      • initial run takes about 1 minute (vimscript bottleneck?) resolved with 990834a
  • Filetypes (no fixes required)

Mappings

  • <plug>(fzf-complete-word) (f1619d4, not supported)

  • <plug>(fzf-complete-path) (24c6594)

    • outputs absolute path in Windows
  • <plug>(fzf-complete-file) (24c6594)

    • outputs absolute path in Windows
  • <plug>(fzf-complete-file-ag) (24c6594)

  • <plug>(fzf-complete-line)

  • <plug>(fzf-complete-buffer-line)

  • <plug>(fzf-maps-n) (no fixes required)

  • <plug>(fzf-maps-i) (no fixes required)

  • <plug>(fzf-maps-x) (no fixes required)

  • <plug>(fzf-maps-o) (no fixes required)

@janlazo
Copy link
Contributor Author

janlazo commented May 13, 2017

@junegunn Can the source command for :Helptags be rewritten to not use grep, perl, printf, and sort?
If not, then :Helptags requires cygwin or Git for Windows or Strawberry Perl, ... for unix utilities.

Side note:
https://github.com/junegunn/fzf.vim#why-you-should-use-fzf-on-vim should be updated about Windows support.

@janlazo janlazo changed the title Support Windows by using list type for options Support Windows (requires 0.16.7 to use list type for options) May 17, 2017
@junegunn junegunn mentioned this pull request May 30, 2017
9 tasks
@janlazo janlazo changed the title Support Windows (requires 0.16.7 to use list type for options) Support Windows (requires 0.16.8) Jun 6, 2017
@janlazo
Copy link
Contributor Author

janlazo commented Jun 29, 2017

Rebasing on master for s:get_git_root and fzf#complete

junegunn added a commit that referenced this pull request Jun 29, 2017
- put commands in scripts for sh and perl
- resolve filepath regex in perl command
- use shellslash for filepaths
- requires cygwin or Git for Window for Window 7 or 8
- fzf does not officially support cygwin
- locate does not have a built-in Windows equivalent in Windows 7/8
    - requires an additional check for Win 10 and WSL
- use temp file to prevent Vim from tampering the source command
- shellescape based on the shell
        - noshellslash for cmd.exe
        - shellslash for sh.exe (requires Cygwin)
- list type for fzf options
- nul, not /dev/null, for error redirection in cmd.exe
- configure shellslash for expand() and shellescape()
- use list type for options
- use '--output-format=e-ctags' for slashes in Windows paths
- respect shellslash by passing output of expand() to s:open
- use noshellslash for the source command
- let vim plugin of fzf shellescape the prompt
@janlazo
Copy link
Contributor Author

janlazo commented Jul 4, 2017

@junegunn Is s:q needed outside of autoload/fzf/vim.vim? None of the commands use it anymore.

@junegunn
Copy link
Owner

junegunn commented Jul 4, 2017

No, it's a script-local function anyway.

@janlazo
Copy link
Contributor Author

janlazo commented Jul 5, 2017

In fzf#vim#with_preview, can the preview command be wrapped in one line?
Escaping space with backslash doesn't not work in cmd.exe.

  let preview = printf(' --preview-window %s --preview "%s"\ %s\ {}',
        \ window,
        \ shellescape(s:bin.preview), window =~ 'up\|down' ? '-v' : '')

- fix bin/ directory for "noshellslash" in Windows
- put preview command in one list entry for shellescaping in cmd.exe
- use dir for file/path completion (see junegunn/fzf#971)
- double-quote shell args via 'set noshellslash' for cmd.exe
@janlazo
Copy link
Contributor Author

janlazo commented Jul 15, 2017

@junegunn There's a FIXME comment in fzf#vim#complete about the --no-expect flag. Can you update it because of junegunn/fzf@b13fcfd? I prefer to not work around it because I need to use list type for options in fzf#vim#complete#path from autoload/fzf/vim/complete.vim

@junegunn
Copy link
Owner

I'll fix it after a new official binary release containing the commit is released.

@janlazo janlazo changed the title Support Windows (requires 0.16.8) Support Windows (requires 0.16.10) Jul 22, 2017
@janlazo
Copy link
Contributor Author

janlazo commented Jul 22, 2017

Bumping minimum required version to consider relative paths for the completer so it will be in sync with the default command(junegunn/fzf#971) and work in both vim/neovim.

@janlazo
Copy link
Contributor Author

janlazo commented Aug 19, 2017

#418 is merged and the decision to use fzf#shellescape is incompatible with this PR which relies on sh.exe for parsing.
Work in this PR will be ported to fix #410

@janlazo janlazo closed this Aug 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants