Allow refactoring (plus minor tweaks)
This commit is contained in:
parent
2be2cae29c
commit
3569e4ec8e
5 changed files with 89 additions and 11 deletions
|
|
@ -2,8 +2,12 @@
|
|||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
--
|
||||
-- When a file has been detected to have been changed outside of Vim and it has not been changed inside of Vim, automatically read it again.
|
||||
vim.opt.autoread = true
|
||||
|
||||
return {
|
||||
vim.keymap.set('n', '<leader>sm', function()
|
||||
require('telescope.builtin').live_grep { search_dirs = { '/home/ccs/missbrenner/Documents/ns-3/ns3-mmwave-iab/src/mmwave/' } }
|
||||
end, { desc = '[S]earch [M]mwave files' }),
|
||||
end, { desc = '[S]earch [M]mwave File Contents' }),
|
||||
}
|
||||
|
|
|
|||
61
lua/custom/plugins/refactoring.lua
Normal file
61
lua/custom/plugins/refactoring.lua
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
return {
|
||||
'ThePrimeagen/refactoring.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('refactoring').setup {
|
||||
prompt_func_return_type = {
|
||||
go = false,
|
||||
java = false,
|
||||
|
||||
cpp = false,
|
||||
c = false,
|
||||
h = false,
|
||||
hpp = false,
|
||||
cxx = false,
|
||||
},
|
||||
prompt_func_param_type = {
|
||||
go = false,
|
||||
java = false,
|
||||
|
||||
cpp = false,
|
||||
c = false,
|
||||
h = false,
|
||||
hpp = false,
|
||||
cxx = false,
|
||||
},
|
||||
printf_statements = {},
|
||||
print_var_statements = {},
|
||||
show_success_message = true, -- shows a message with information about the refactor on success
|
||||
-- i.e. [Refactor] Inlined 3 variable occurrences
|
||||
}
|
||||
end,
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>cr', function()
|
||||
return require('refactoring').refactor 'Code Refactor'
|
||||
end, { expr = true, desc = '[C]ode [R]efactor' }),
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>cre', function()
|
||||
return require('refactoring').refactor 'Extract Function'
|
||||
end, { expr = true, desc = '[R]efactor [E]xtract Function' }),
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>crf', function()
|
||||
return require('refactoring').refactor 'Extract Function To File'
|
||||
end, { expr = true, desc = '[R]efactor Extract Function To [F]ile' }),
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>crv', function()
|
||||
return require('refactoring').refactor 'Extract Variable'
|
||||
end, { expr = true, desc = '[R]efactor Extract [V]ariable' }),
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>crI', function()
|
||||
return require('refactoring').refactor 'Inline Function'
|
||||
end, { expr = true, desc = '[R]efactor [I]nline Function' }),
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>cri', function()
|
||||
return require('refactoring').refactor 'Inline Variable'
|
||||
end, { expr = true, desc = '[R]efactor [I]nline Variable' }),
|
||||
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>crbb', function()
|
||||
return require('refactoring').refactor 'Extract Block'
|
||||
end, { expr = true, desc = '[R]efactor Extract [B]lock' }),
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>crbf', function()
|
||||
return require('refactoring').refactor 'Extract Block To File'
|
||||
end, { expr = true, desc = '[R]efactor Extract [B]lock To [F]ile' }),
|
||||
}
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
config = function()
|
||||
require'treesitter-context'.setup{
|
||||
require('treesitter-context').setup {
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
multiwindow = false, -- Enable multiwindow support.
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||
line_numbers = true,
|
||||
multiline_threshold = 20, -- Maximum number of lines to show for a single context
|
||||
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
mode = 'topline', -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||
trim_scope = 'inner', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||
-- Separator between context and content. Should be a single character string, like '-'.
|
||||
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
||||
separator = nil,
|
||||
|
|
@ -17,4 +17,7 @@ return {
|
|||
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
|
||||
}
|
||||
end,
|
||||
vim.keymap.set('n', '[c', function()
|
||||
require('treesitter-context').go_to_context(vim.v.count1)
|
||||
end, { silent = true, desc = '[C]ontext (upwards)' }),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue