Skip to content

Commit b7344cb

Browse files
author
midchildan
committed
Add Compilers and BCompilers commands
1 parent ad113a6 commit b7344cb

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ Commands
8181
| `Commits` | Git commits (requires [fugitive.vim][f]) |
8282
| `BCommits` | Git commits for the current buffer |
8383
| `Commands` | Commands |
84+
| `Compilers` | Compilers |
85+
| `BCompilers` | Compilers for the current buffer |
8486
| `Maps` | Normal mode mappings |
8587
| `Helptags` | Help tags <sup id="a1">[1](#helptags)</sup> |
8688
| `Filetypes` | File types

autoload/fzf/vim.vim

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,36 @@ function! fzf#vim#commands(...)
934934
\ ' --tiebreak=index --header-lines 1 -x --prompt "Commands> " -n2,3,2..3 -d'.s:nbs}, a:000)
935935
endfunction
936936

937+
" ------------------------------------------------------------------
938+
" Compilers
939+
" ------------------------------------------------------------------
940+
function! fzf#vim#compilers(...)
941+
let compilers = split(globpath(&rtp, "compiler/*.vim"), "\n")
942+
if has('packages')
943+
let compilers += split(globpath(&packpath, "pack/*/opt/*/compiler/*.vim"), "\n")
944+
endif
945+
return s:fzf('compilers', {
946+
\ 'source': fzf#vim#_uniq(map(compilers, "substitute(fnamemodify(v:val, ':t'), '\\..\\{-}$', '', '')")),
947+
\ 'sink': 'compiler!',
948+
\ 'options': '+m --prompt="Compilers> "'
949+
\}, a:000)
950+
endfunction
951+
952+
" ------------------------------------------------------------------
953+
" BCompilers
954+
" ------------------------------------------------------------------
955+
function! fzf#vim#buffer_compilers(...)
956+
let compilers = split(globpath(&rtp, "compiler/*.vim"), "\n")
957+
if has('packages')
958+
let compilers += split(globpath(&packpath, "pack/*/opt/*/compiler/*.vim"), "\n")
959+
endif
960+
return s:fzf('compilers', {
961+
\ 'source': fzf#vim#_uniq(map(compilers, "substitute(fnamemodify(v:val, ':t'), '\\..\\{-}$', '', '')")),
962+
\ 'sink': 'compiler',
963+
\ 'options': '+m --prompt="BCompilers> "'
964+
\}, a:000)
965+
endfunction
966+
937967
" ------------------------------------------------------------------
938968
" Marks
939969
" ------------------------------------------------------------------

plugin/fzf.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ call s:defs([
4747
\'command! -bang -nargs=* Lines call fzf#vim#lines(<q-args>, <bang>0)',
4848
\'command! -bang -nargs=* BLines call fzf#vim#buffer_lines(<q-args>, <bang>0)',
4949
\'command! -bar -bang Colors call fzf#vim#colors(<bang>0)',
50+
\'command! -bar -bang Compilers call fzf#vim#compilers(<bang>0)',
51+
\'command! -bar -bang BCompilers call fzf#vim#buffer_compilers(<bang>0)',
5052
\'command! -bang -nargs=+ -complete=dir Locate call fzf#vim#locate(<q-args>, <bang>0)',
5153
\'command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, <bang>0)',
5254
\'command! -bang -nargs=* Tags call fzf#vim#tags(<q-args>, <bang>0)',

0 commit comments

Comments
 (0)