Skip to content

Commit

Permalink
feat: add ddu setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ucpr committed Mar 31, 2024
1 parent 20f81bf commit fe4585f
Show file tree
Hide file tree
Showing 2 changed files with 183 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nvim/dpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ export class Config extends BaseConfig {
) as Toml,
);

tomls.push(
await args.dpp.extAction(
args.denops,
context,
options,
"toml",
"load",
{
path: await fn.expand(args.denops, dotfilesDir + "tomls/ddu.toml"),
options: {
lazy: true,
},
},
) as Toml,
);

const recordPlugins: Record<string, Plugin> = {};
const ftplugins: Record<string, string> = {};
const hooksFiles: string[] = [];
Expand Down
167 changes: 167 additions & 0 deletions nvim/tomls/ddu.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
[[plugins]]
repo = 'Shougo/ddu.vim'
on_event = 'VimEnter'
lua_add = '''
vim.fn["ddu#custom#patch_global"]({
ui = "ff",
uiParams = {
ff = {
filterFloatingPosition = "bottom",
filterSplitDirection = "floating",
floatingBorder = "rounded",
previewFloating = true,
previewFloatingBorder = "rounded",
previewFloatingTitle = "Preview",
previewSplit = "horizontal",
prompt = "> ",
split = "floating",
startFilter = true,
}
},
sourceOptions = {
_ = {
matchers = { "matcher_fzf" },
sorters = { "sorter_fzf" },
converters = { "converter_devicon" },
ignoreCase = true,
},
},
kindOptions = {
action = {
defaultAction = "do",
},
},
})
vim.fn["ddu#custom#patch_local"]("file_recursive", {
sources = {
{
name = { "file_rec" },
options = {
converters = {
"converter_devicon",
},
},
params = {
ignoredDirectories = { "node_modules", ".git", ".vscode" },
},
},
},
kindOptions = {
file = {
defaultAction = "open",
},
},
})
vim.fn["ddu#custom#patch_local"]("grep", {
sourceParams = {
rg = {
args = { "--column", "--no-heading", "--color", "never" },
},
},
kindOptions = {
file = {
defaultAction = "open",
},
},
uiParams = {
ff = {
startFilter = false,
previewFloating = false,
previewSplit = "vertical",
},
},
})
vim.api.nvim_create_autocmd("FileType",{
pattern = "ddu-ff",
callback = function()
local opts = { noremap = true, silent = true, buffer = true }
vim.keymap.set({ "n" }, "q", [[<Cmd>call ddu#ui#do_action("quit")<CR>]], opts)
vim.keymap.set({ "n" }, "a", [[<Cmd>call ddu#ui#do_action("chooseAction")<CR>]], opts)
vim.keymap.set({ "n" }, "<Cr>", [[<Cmd>call ddu#ui#do_action("itemAction")<CR>]], opts)
vim.keymap.set({ "n" }, "<C-v>", [[<Cmd>call ddu#ui#do_action("itemAction", {'params': {'command': 'vsplit'}})<CR>]], opts)
vim.keymap.set({ "n" }, "<C-x>", [[<Cmd>call ddu#ui#do_action("itemAction", {'params': {'command': 'split'}})<CR>]], opts)
vim.keymap.set({ "n" }, "i", [[<Cmd>call ddu#ui#do_action("openFilterWindow")<CR>]], opts)
vim.keymap.set({ "n" }, "P", [[<Cmd>call ddu#ui#do_action("togglePreview")<CR>]], opts)
end,
})
vim.api.nvim_create_autocmd("FileType",{
pattern = "ddu-ff-filter",
callback = function()
local opts = { noremap = true, silent = true, buffer = true }
vim.keymap.set({ "n", "i" }, "<CR>", [[<Esc><Cmd>close<CR>]], opts)
end,
})
vim.fn["ddu#custom#patch_local"]("colorscheme", {
sources = {
{
name = { "colorscheme" },
},
},
kindOptions = {
colorscheme = {
defaultAction = "set",
}
}
})
vim.keymap.set("n", "<Space>ff", "<Cmd>call ddu#start(#{name:'file_recursive'})<CR>")
vim.keymap.set("n", "<Space>g", "<Cmd>call ddu#start(#{name:'grep', sources: [#{ name: 'rg', params: #{ input: expand('<cword>') } }]})<CR>")
'''

### DDU SOURCE ###

[[plugins]]
repo = 'Shougo/ddu-source-file'
on_source = 'ddu.vim'

[[plugins]]
repo = 'Shougo/ddu-source-file_rec'
on_source = 'ddu.vim'

[[plugins]]
repo = 'Shougo/ddu-source-action'
on_source = 'ddu.vim'

[[plugins]]
repo = 'matsui54/ddu-source-file_external'
on_source = 'ddu.vim'

[[plugins]]
repo = 'shun/ddu-source-rg'
on_source = 'ddu.vim'

[[plugins]]
repo = '4513ECHO/ddu-source-colorscheme'
on_source = 'ddu.vim'

### DDU KIND ###

[[plugins]]
repo = 'Shougo/ddu-kind-file'
on_source = 'ddu.vim'

### DDU UI ###

[[plugins]]
repo = 'Shougo/ddu-ui-ff'
on_source = 'ddu.vim'

### DDU FILTER ###

[[plugins]]
repo = 'Shougo/ddu-filter-matcher_substring'
on_source = 'ddu.vim'

[[plugins]]
repo = 'uga-rosa/ddu-filter-converter_devicon'
on_source = 'ddu.vim'

[[plugins]]
repo = 'yuki-yano/ddu-filter-fzf'
on_source = 'ddu.vim'

### ETC ###

[[plugins]]
repo = 'Shougo/ddu-commands.vim'
on_source = 'ddu.vim'

0 comments on commit fe4585f

Please sign in to comment.