neovim

Personal neovim configuration files
git clone git://gtms.dev:neovim
Log | Files | Refs

commit aa46651b351dc85fc20bf52ffb7988ddc8196067
parent a884f0d045aa28aad14db028a2ab823792245c3a
Author: Tomas Nemec <owl@gtms.dev>
Date:   Wed, 31 May 2023 04:57:28 +0200

update

Diffstat:
Dafter/plugin/exrc.lua | 7-------
Mafter/plugin/refactoring.lua | 49+++++++++++++++++++++++++++++++++++++++++++------
Mlua/plugins.lua | 2+-
3 files changed, 44 insertions(+), 14 deletions(-)

diff --git a/after/plugin/exrc.lua b/after/plugin/exrc.lua @@ -1,7 +0,0 @@ -if not pcall(require, 'exrc') then - return -end - -vim.o.exrc = false - -require('exrc').setup {} diff --git a/after/plugin/refactoring.lua b/after/plugin/refactoring.lua @@ -1,7 +1,44 @@ -do return end -if not pcall(require, 'refactoring') then return end +if not pcall(require, 'refactoring') then + return +end + local refactor = require('refactoring') -refactor.setup({}) -vim.keymap.set('n', '<leader>re', require('refactoring').refactor('Extract Function'), { silent = true }) -vim.keymap.set('v', '<leader>rf', require('refactoring').refactor('Extract Function To File'), { silent = true }) -vim.keymap.set('n', '<leader>rv', require('refactoring').refactor('Extract Variable'), { silent = true }) +refactor.setup({ printf_statements = { dart = { 'print("%s");' } } }) + +vim.keymap.set('n', '<space>re', function() + require('refactoring').refactor('Extract Function') +end, { silent = true }) + +vim.keymap.set('v', '<space>rf', function() + require('refactoring').refactor('Extract Function To File') +end, { silent = true }) + +vim.keymap.set('n', '<space>rv', function() + require('refactoring').refactor('Extract Variable') +end, { silent = true }) + +vim.keymap.set('n', '<space>ri', function() + require('refactoring').refactor('Inline Variable') +end, { silent = true }) + +vim.keymap.set('v', '<space>rr', function() + require('refactoring').select_refactor() +end, { silent = true }) + +vim.keymap.set('n', '<space>rp', function() + require('refactoring').debug.printf({ below = false }) +end, {}) + +-- Remap in normal mode and passing { normal = true } will automatically find the variable under the cursor and print it +vim.keymap.set('n', '<space>rv', function() + require('refactoring').debug.print_var({ normal = true }) +end, {}) +-- Remap in visual mode will print whatever is in the visual selection +vim.keymap.set('v', '<space>rv', function() + require('refactoring').debug.print_var({}) +end, {}) + +-- Cleanup function: this remap should be made in normal mode +vim.keymap.set('n', '<space>rc', function() + require('refactoring').debug.cleanup({}) +end, {}) diff --git a/lua/plugins.lua b/lua/plugins.lua @@ -14,7 +14,6 @@ return packer.startup({ -- meta use 'tweekmonster/startuptime.vim' - use 'MunifTanjim/exrc.nvim' -- colorscheme use 'tjdevries/colorbuddy.nvim' @@ -138,6 +137,7 @@ return packer.startup({ use 'JoosepAlviste/nvim-ts-context-commentstring' use 'lewis6991/nvim-treesitter-context' use 'cshuaimin/ssr.nvim' + use 'ThePrimeagen/refactoring.nvim' -- telescope use {