Skip to content

Commit

Permalink
feat: utils file
Browse files Browse the repository at this point in the history
  • Loading branch information
senelway committed May 8, 2023
1 parent 625a24a commit c31a903
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
18 changes: 9 additions & 9 deletions nvim/lua/core/default_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ M.ui = {
hl_override = {},
changed_themes = {},
theme_toggle = { "onedark", "one_light" },
theme = "onedark", -- default theme
theme = "onedark", -- default theme
transparency = false,
lsp_semantic_tokens = false, -- needs nvim v0.9, just adds highlight groups for lsp semantic tokens

Expand All @@ -22,8 +22,8 @@ M.ui = {
cmp = {
icons = true,
lspkind_text = true,
style = "default", -- default/flat_light/flat_dark/atom/atom_colored
border_color = "grey_fg", -- only applicable for "default" style, use color names from base30 variables
style = "default", -- default/flat_light/flat_dark/atom/atom_colored
border_color = "grey_fg", -- only applicable for "default" style, use color names from base30 variables
selected_item_bg = "colored", -- colored / simple
},

Expand Down Expand Up @@ -63,12 +63,12 @@ M.ui = {
},

buttons = {
{ " Find File", "Spc f f", "Telescope find_files" },
{ " Find File", "Spc f f", "Telescope find_files" },
{ " Recent Files", "Spc f o", "Telescope oldfiles" },
{ " Find Word", "Spc f w", "Telescope live_grep" },
{ " Bookmarks", "Spc b m", "Telescope marks" },
{ " Themes", "Spc t h", "Telescope themes" },
{ " Mappings", "Spc c h", "NvCheatsheet" },
{ " Find Word", "Spc f w", "Telescope live_grep" },
{ " Bookmarks", "Spc b m", "Telescope marks" },
{ " Themes", "Spc t h", "Telescope themes" },
{ " Mappings", "Spc c h", "NvCheatsheet" },
},
},

Expand All @@ -83,7 +83,7 @@ M.ui = {
},
}

M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file
M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file

M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options

Expand Down
32 changes: 32 additions & 0 deletions nvim/lua/custom/utils/helpers.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
local M = {}

local function filter(arr, fn)
if type(arr) ~= "table" then
return arr
end

local filtered = {}
for k, v in pairs(arr) do
if fn(v, k, arr) then
table.insert(filtered, v)
end
end

return filtered
end

local function filterReactDTS(value)
return string.match(value.filename, "node_modules/@types/react/ts*") == nil
end

M.definition_on_list = function(options)
local items = options.items
if #items > 1 then
items = filter(items, filterReactDTS)
end

vim.fn.setqflist({}, " ", { title = options.title, items = items, context = options.context })
vim.api.nvim_command "cfirst" -- or maybe you want 'copen' instead of 'cfirst'
end

return M

0 comments on commit c31a903

Please sign in to comment.