-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
88 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import { BaseConfig } from "https://deno.land/x/[email protected]/types.ts"; | ||
import { ConfigArguments } from "https://deno.land/x/[email protected]/base/config.ts"; | ||
import { Denops, fn } from "https://deno.land/x/[email protected]/deps.ts"; | ||
import { | ||
Params as FfParams, | ||
Ui as FfUi, | ||
} from "https://deno.land/x/[email protected]/ff.ts"; | ||
import { BaseConfig, Denops } from "jsr:@shougo/ddu-vim@~5.0.0/types"; | ||
import { ConfigArguments } from "jsr:@shougo/ddu-vim@~5.0.0/config"; | ||
import { Params as FfParams } from "jsr:@shougo/ddu-ui-ff@~1.2.0"; | ||
import { Params as FilerParams } from "jsr:@shougo/ddu-ui-filer@~1.2.0"; | ||
import * as fn from "jsr:@denops/std@~7.0.1/function"; | ||
|
||
export class Config extends BaseConfig { | ||
override config({ | ||
|
@@ -16,57 +14,57 @@ export class Config extends BaseConfig { | |
setAlias("source", "mrw", "mr"); | ||
setAlias("source", "mrr", "mr"); | ||
|
||
const ffParamsDefault = new FfUi().params(); | ||
const ffUiParams: FfParams = { | ||
...ffParamsDefault, | ||
ignoreEmpty: true, | ||
startAutoAction: false, | ||
autoAction: { | ||
name: "preview", | ||
delay: 250, // same as telescope.nvim | ||
}, | ||
autoResize: false, | ||
displaySourceName: "no", | ||
floatingBorder: "none", | ||
split: "floating", | ||
winCol: "&columns / 4", | ||
winWidth: "&columns / 2", | ||
winRow: "&lines / 3", | ||
filterFloatingPosition: "top", | ||
filterSplitDirection: "topleft", | ||
highlights: { | ||
filterText: "Statement", | ||
floating: "NormalFloat", | ||
floatingBorder: "none", | ||
selected: "CursorLine", | ||
}, | ||
onPreview: async (args: { denops: Denops; previewWinId: number }) => { | ||
await fn.win_execute(args.denops, args.previewWinId, "normal! zt"); | ||
}, | ||
previewFloating: true, | ||
previewFloatingBorder: "none", | ||
previewSplit: "vertical", | ||
previewCol: "1", | ||
previewWidth: "&columns / 2 - 2", | ||
previewHeight: "&lines / 3", | ||
prompt: " ", | ||
statusline: false, | ||
}; | ||
|
||
contextBuilder.patchGlobal({ | ||
sources: ["file", "file_rec", "file_external", "mr", "ghq"], | ||
ui: "ff", | ||
profile: false, | ||
sources: ["file", "file_rec", "file_external", "mr", "ghq"], | ||
// TODO: | ||
uiOptions: {}, | ||
uiParams: { | ||
ff: ffUiParams, | ||
ff: { | ||
autoAction: { | ||
name: "preview", | ||
delay: 250, // same as telescope.nvim | ||
}, | ||
filterSplitDirection: "floating", | ||
floatingBorder: "none", | ||
highlights: { | ||
filterText: "Statement", | ||
floating: "Normal", | ||
floatingBorder: "Special", | ||
}, | ||
maxHighlightItems: 50, | ||
onPreview: async (args: { denops: Denops; previewWinId: number }) => { | ||
await fn.win_execute(args.denops, args.previewWinId, "normal! zt"); | ||
}, | ||
previewFloating: true, | ||
previewFloatingBorder: "single", | ||
updateTime: 0, | ||
winWidth: 100, | ||
} as Partial<FfParams>, | ||
filer: { | ||
previewFloating: true, | ||
sort: "filename", | ||
sortTreesFirst: true, | ||
split: "no", | ||
toggle: true, | ||
} as Partial<FilerParams>, | ||
}, | ||
sourceOptions: { | ||
_: { | ||
matchers: ["matcher_fzf"], | ||
sorters: ["sorter_fzf"], | ||
smartCase: true, | ||
}, | ||
mru: { | ||
matchers: ["matcher_ignore_files", "matcher_relative", "matcher_fzf"], | ||
}, | ||
mrw: { | ||
matchers: ["matcher_ignore_files", "matcher_relative", "matcher_fzf"], | ||
}, | ||
mrr: { | ||
matchers: ["matcher_ignore_files", "matcher_relative", "matcher_fzf"], | ||
}, | ||
file: { | ||
matchers: ["matcher_substring", "matcher_hidden"], | ||
sorters: ["sorter_alpha"], | ||
|
@@ -101,18 +99,18 @@ export class Config extends BaseConfig { | |
file_fd: { | ||
cmd: ["fd", ".", "-H", "-t", "f", "--exclude", ".git"], | ||
}, | ||
rg: { | ||
args: ["--json"], | ||
}, | ||
}, | ||
filterOptions: {}, | ||
filterParams: { | ||
matcher_substring: { | ||
highlightMatched: "Search", | ||
}, | ||
matcher_fzf: { | ||
highlightMatched: "Search", | ||
}, | ||
matcher_ignore_files: { | ||
ignoreGlobs: [], | ||
ignorePatterns: [/.*\/COMMIT_EDITMSG$/], | ||
}, | ||
converter_hl_dir: { | ||
hlGroup: ["Directory", "Keyword"], | ||
}, | ||
|
@@ -121,11 +119,21 @@ export class Config extends BaseConfig { | |
file: { | ||
defaultAction: "open", | ||
}, | ||
url: { | ||
defaultAction: "browse", | ||
}, | ||
}, | ||
kindParams: {}, | ||
actionOptions: {}, | ||
actionParams: {}, | ||
actionOptions: { | ||
narrow: { | ||
quit: false, | ||
}, | ||
tabopen: { | ||
quit: false, | ||
}, | ||
}, | ||
}); | ||
|
||
return Promise.resolve(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
setlocal cursorline | ||
nnoremap <buffer> i <Cmd>call ddu#ui#do_action('openFilterWindow')<CR> | ||
nnoremap <buffer> q <Cmd>call ddu#ui#do_action('quit')<CR> | ||
nnoremap <buffer> <C-c> <Cmd>call ddu#ui#do_action('quit')<CR> | ||
nnoremap <buffer> <CR> <Cmd>call ddu#ui#do_action('itemAction')<CR> | ||
nnoremap <buffer> <Space> <Cmd>call ddu#ui#do_action('toggleSelectItem')<CR> | ||
nnoremap <buffer><C-n> <Cmd>call ddu#ui#do_action('cursorNext', #{ loop: v:true })<CR> | ||
nnoremap <buffer><C-p> <Cmd>call ddu#ui#do_action('cursorPrevious', #{ loop: v:true })<CR> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
" setup | ||
call ddu#custom#load_config(s:args['ts_config']) | ||
|
||
" Note: the matchers should be empty for performance | ||
function! s:ddu_rg_live() abort | ||
call ddu#start({ | ||
\ 'name': 'rg', | ||
\ 'sources': [{ | ||
\ 'name': 'rg', | ||
\ 'options': { | ||
\ 'matchers': [], | ||
\ 'volatile': v:true, | ||
\ }, | ||
\ }], | ||
\ 'uiParams': { | ||
\ 'ff': { | ||
\ 'ignoreEmpty': v:false, | ||
\ 'autoResize': v:false, | ||
\ } | ||
\ }, | ||
\ }) | ||
function s:ddu_send_all_to_qf() abort | ||
call ddu#ui#do_action('clearSelectAllItems') | ||
call ddu#ui#do_action('toggleAllItems') | ||
call ddu#ui#do_action('itemAction', { 'name': 'quickfix'}) | ||
endfunction | ||
|
||
command! DduRgLive call <SID>ddu_rg_live() | ||
function s:ddu_ff_filter_open() abort | ||
call ddu#ui#ff#save_cmaps([ | ||
\ '<C-f>', '<C-b>', '<C-c>', '<C-q>', '<CR>', | ||
\ ]) | ||
cnoremap <C-n> <Cmd>call ddu#ui#do_action('cursorNext', #{ loop: v:true })<CR> | ||
cnoremap <C-p> <Cmd>call ddu#ui#do_action('cursorPrevious', #{ loop: v:true })<CR> | ||
cnoremap <C-c> <ESC><Cmd>call ddu#ui#do_action('quit')<CR> | ||
cnoremap <C-q> <ESC><Cmd>call <SID>ddu_send_all_to_qf()<CR> | ||
cnoremap <CR> <ESC><Cmd>call ddu#ui#do_action('itemAction')<CR> | ||
endfunction | ||
|
||
function s:ddu_ff_filter_close() abort | ||
call ddu#ui#ff#restore_cmaps() | ||
endfunction | ||
|
||
au User Ddu:ui:ff:openFilterWindow call s:ddu_ff_filter_open() | ||
au User Ddu:ui:ff:closeFilterWindow call s:ddu_ff_filter_close() |