diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-02-13 12:32:19 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-02-13 12:32:19 +0100 |
| commit | d43a4f3b7455599968b9e61c64944ef2759458d6 (patch) | |
| tree | 051652cd7bb8d272f40d70146cdd38b1b089ff98 /lua/alpha/telescope/init.lua | |
| parent | 535b2236a134a4e36979ae27159c3f46e808ca6c (diff) | |
| download | nvim-conf-d43a4f3b7455599968b9e61c64944ef2759458d6.tar.gz nvim-conf-d43a4f3b7455599968b9e61c64944ef2759458d6.zip | |
More refactor move telescope to it's own repo and restructure
Diffstat (limited to 'lua/alpha/telescope/init.lua')
| -rw-r--r-- | lua/alpha/telescope/init.lua | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lua/alpha/telescope/init.lua b/lua/alpha/telescope/init.lua new file mode 100644 index 0000000..7b0ffd2 --- /dev/null +++ b/lua/alpha/telescope/init.lua @@ -0,0 +1,63 @@ +local actions = require('telescope.actions') + +local M = {} + +function M.project_files() + local opts = {} -- define here if you want to define something + local ok = pcall(require'telescope.builtin'.git_files, opts) + if not ok then require'telescope.builtin'.find_files(opts) end +end + +function M.branches() + require'telescope.builtin'.git_branches({ attach_mappings = function(_, map) + map('i', '<c-j>', actions.git_create_branch) + map('n', '<c-j>', actions.git_create_branch) + return true + end}) +end + +function M.search_config() + require("telescope.builtin").git_files({ + prompt_title = "< dotfiles >", + cwd = "$HOME/.dotfiles", + }) +end + +function M.grep_string() + vim.ui.input("Grep for > ", function (input) + if input == nil then + return + end + require('telescope.builtin').grep_string({ search = input}) + end) +end + +function M.grep_word() + require('telescope.builtin').grep_string({ search = vim.fn.expand("<cword>")}) +end + +function M.find_symbol () + vim.ui.input("Symbol for > ", function (input) + if input == nil then + return + end + require('telescope.builtin').lsp_workspace_symbols({ search = input}) + end) +end + +function M.my_plugins() + require("telescope.builtin").find_files { + cwd = "~/plugins/", + } +end + +return setmetatable({}, { + __index = function(_, k) + + if M[k] then + return M[k] + else + return require("telescope.builtin")[k] + end + end, +}) |