diff options
| author | Ariel D'Alessandro <ariel.dalessandro@auto1.com> | 2022-03-31 20:05:06 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <ariel.dalessandro@auto1.com> | 2022-03-31 20:07:01 +0200 |
| commit | 6cb6aff87f8a67ad4a8131b9ac2e483c0688f996 (patch) | |
| tree | 483cf97a0ad5f87079e5cd7df77d7307170d92fd /lua/alpha/refactoring.lua | |
| parent | 7bce550187e2a812d2f85be361e4945f31c8a887 (diff) | |
| download | nvim-conf-6cb6aff87f8a67ad4a8131b9ac2e483c0688f996.tar.gz nvim-conf-6cb6aff87f8a67ad4a8131b9ac2e483c0688f996.zip | |
update refactoring
Diffstat (limited to 'lua/alpha/refactoring.lua')
| -rw-r--r-- | lua/alpha/refactoring.lua | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/lua/alpha/refactoring.lua b/lua/alpha/refactoring.lua deleted file mode 100644 index 22ea11e..0000000 --- a/lua/alpha/refactoring.lua +++ /dev/null @@ -1,36 +0,0 @@ -local refactor = require("refactoring") -refactor.setup({}) - --- telescope refactoring helper -local function refactor(prompt_bufnr) - local content = require("telescope.actions.state").get_selected_entry( - prompt_bufnr - ) - require("telescope.actions").close(prompt_bufnr) - require("refactoring").refactor(content.value) -end --- NOTE: M is a global object --- for the sake of simplicity in this example --- you can extract this function and the helper above --- and then require the file and call the extracted function --- in the mappings below -M = {} -M.refactors = function() - local opts = require("telescope.themes").get_cursor() -- set personal telescope options - require("telescope.pickers").new(opts, { - prompt_title = "refactors", - finder = require("telescope.finders").new_table({ - results = require("refactoring").get_refactors(), - }), - sorter = require("telescope.config").values.generic_sorter(opts), - attach_mappings = function(_, map) - map("i", "<CR>", refactor) - map("n", "<CR>", refactor) - return true - end - }):find() -end - -vim.api.nvim_set_keymap("v", "<Leader>re", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("v", "<Leader>rf", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("v", "<Leader>rt", [[ <Esc><Cmd>lua M.refactors()<CR>]], {noremap = true, silent = true, expr = false}) |