refactor(nvim-plugins)
This commit is contained in:
parent
a3f20d2b04
commit
4fd17ccf0c
@ -60,7 +60,7 @@ alias nowdate='date +"%d-%m-%Y"'
|
||||
alias cal='cal -m'
|
||||
|
||||
# vim
|
||||
alias vi='\nvim'
|
||||
alias vi='nvim'
|
||||
alias svi="sudo -E nvim"
|
||||
|
||||
# net
|
||||
|
||||
101
home/user/.config/nvim/lua/plugins/coding.lua
Normal file
101
home/user/.config/nvim/lua/plugins/coding.lua
Normal file
@ -0,0 +1,101 @@
|
||||
return {
|
||||
{
|
||||
"ellisonleao/dotenv.nvim",
|
||||
config = function()
|
||||
require('dotenv').setup({
|
||||
enable_on_load = true, -- will load your .env file upon loading a buffer
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = "*", callback = require('dotenv').autocmd
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("refactoring")
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<space>rr",
|
||||
":lua require('refactoring').select_refactor()<CR>",
|
||||
desc = "Select refactoring",
|
||||
mode = {"n", "x"},
|
||||
},
|
||||
-- Refactoring operations
|
||||
{
|
||||
"<space>re",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>",
|
||||
desc = "Extract Function",
|
||||
mode = "x",
|
||||
},
|
||||
{
|
||||
"<space>rf",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>",
|
||||
desc = "Extract Function To File",
|
||||
mode = "x",
|
||||
},
|
||||
{
|
||||
"<space>rv",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>",
|
||||
desc = "Extract Variable",
|
||||
mode = "x",
|
||||
},
|
||||
{
|
||||
"<space>rI",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Inline Function')<CR>",
|
||||
desc = "Inline Function",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<space>ri",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>",
|
||||
desc = "Inline Variable",
|
||||
mode = {"n", "x"},
|
||||
},
|
||||
-- Extract block
|
||||
{
|
||||
"<space>rb",
|
||||
"<Cmd>lua require('refactoring').refactor('Extract Block')<CR>",
|
||||
desc = "Extract Block",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<space>rbf",
|
||||
"<Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>",
|
||||
desc = "Extract Block To File",
|
||||
mode = "n",
|
||||
},
|
||||
-- Telescope
|
||||
{
|
||||
"<leader>fr",
|
||||
"<Cmd>lua require('telescope').extensions.refactoring.refactors()<CR>",
|
||||
mode = "n",
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
'folke/neodev.nvim',
|
||||
ft = {'lua'},
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig'
|
||||
},
|
||||
config = function()
|
||||
require('neodev').setup()
|
||||
require('lspconfig').lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
return {
|
||||
{
|
||||
'EdenEast/nightfox.nvim',
|
||||
config = function()
|
||||
local colorscheme = require("nightfox")
|
||||
colorscheme.compile()
|
||||
colorscheme.setup()
|
||||
vim.cmd.colorscheme("nightfox")
|
||||
end
|
||||
},
|
||||
{
|
||||
'ellisonleao/gruvbox.nvim'
|
||||
},
|
||||
{
|
||||
'xiyaowong/transparent.nvim',
|
||||
config = function()
|
||||
require("transparent").setup({
|
||||
exclude_groups = {'CursorLine'},
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'lukas-reineke/virt-column.nvim',
|
||||
config = function()
|
||||
require("virt-column").setup({
|
||||
virtcolumn = '81'
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
return {
|
||||
"ellisonleao/dotenv.nvim",
|
||||
config = function()
|
||||
require('dotenv').setup({
|
||||
enable_on_load = true, -- will load your .env file upon loading a buffer
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = "*", callback = require('dotenv').autocmd
|
||||
})
|
||||
end
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
config = function()
|
||||
require("ibl").setup({
|
||||
scope = { enabled = false },
|
||||
})
|
||||
end,
|
||||
main = "ibl"
|
||||
}
|
||||
@ -1,74 +0,0 @@
|
||||
|
||||
local function get_virtual_env()
|
||||
return vim.fs.basename(os.getenv("VIRTUAL_ENV"))
|
||||
end
|
||||
|
||||
function GET_FORMATTED_VIRTUAL_ENV()
|
||||
if vim.bo.filetype == 'python' then
|
||||
return "<" .. get_virtual_env() .. ">"
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
function DETECT_INDENT_TYPE()
|
||||
if vim.bo.expandtab then
|
||||
return vim.bo.shiftwidth .. " spaces"
|
||||
else
|
||||
return vim.bo.shiftwidth / vim.bo.tabstop .. " tabs (" .. vim.bo.tabstop .. ")"
|
||||
end
|
||||
end
|
||||
|
||||
local function is_absolute_path(path)
|
||||
return string.sub(path, 1, 1) == '/' or string.sub(path, 1, 1) == '~'
|
||||
end
|
||||
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
component_separators = { left = '', right = '' },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {
|
||||
{
|
||||
'vim.fn.getcwd()',
|
||||
fmt = function(str)
|
||||
local res = str
|
||||
|
||||
res = str:gsub(os.getenv("HOME"), "~")
|
||||
|
||||
return res
|
||||
end,
|
||||
color = { fg = 'white', gui='bold' },
|
||||
padding = { left = 1, right = 0 }
|
||||
},
|
||||
{
|
||||
'filename',
|
||||
fmt = function(str)
|
||||
local res = str
|
||||
|
||||
if is_absolute_path(res) then
|
||||
res = " " .. res
|
||||
else
|
||||
res = "/" .. res
|
||||
end
|
||||
|
||||
return res
|
||||
end,
|
||||
file_status = true,
|
||||
path = 1,
|
||||
padding = { left = 0, right = 1 }
|
||||
},
|
||||
},
|
||||
lualine_x = {'GET_FORMATTED_VIRTUAL_ENV()', 'DETECT_INDENT_TYPE()', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'},
|
||||
},
|
||||
})
|
||||
end,
|
||||
dependencies = { 'kyazdani42/nvim-web-devicons' }
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
return {
|
||||
"thek4n/mdimage.nvim",
|
||||
config = function()
|
||||
require("mdimage").setup({
|
||||
target_path = "./.img",
|
||||
})
|
||||
end
|
||||
}
|
||||
@ -1,9 +1,7 @@
|
||||
return {
|
||||
'HiPhish/rainbow-delimiters.nvim',
|
||||
'tpope/vim-repeat',
|
||||
'google/vim-searchindex',
|
||||
'rbgrouleff/bclose.vim',
|
||||
'chaoren/vim-wordmotion',
|
||||
'preservim/vim-pencil',
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
@ -33,12 +31,6 @@ return {
|
||||
require("Comment").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
config = function()
|
||||
require('colorizer').setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
@ -53,10 +45,6 @@ return {
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
},
|
||||
{
|
||||
'folke/trouble.nvim',
|
||||
dependencies = { 'kyazdani42/nvim-web-devicons' },
|
||||
@ -64,4 +52,18 @@ return {
|
||||
require("trouble").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
"thek4n/mdimage.nvim",
|
||||
config = function()
|
||||
require("mdimage").setup({
|
||||
target_path = "./.img",
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"thek4n/postman.nvim",
|
||||
config = function()
|
||||
vim.keymap.set("n", "<Leader>rl", '<cmd>PostmanExec<CR>')
|
||||
end
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
return {
|
||||
'folke/neodev.nvim',
|
||||
ft = {'lua'},
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig'
|
||||
},
|
||||
config = function()
|
||||
require('neodev').setup()
|
||||
require('lspconfig').lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
return {
|
||||
'karb94/neoscroll.nvim',
|
||||
config = function()
|
||||
require('neoscroll').setup({
|
||||
mappings = {'<C-u>', '<C-d>', '<C-b>',
|
||||
'<C-y>', '<C-e>', 'zt', 'zz', 'zb'},
|
||||
respect_scrolloff = false,
|
||||
})
|
||||
end
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
return {
|
||||
"thek4n/postman.nvim",
|
||||
config = function()
|
||||
vim.keymap.set("n", "<Leader>rl", '<cmd>PostmanExec<CR>')
|
||||
end
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
return {
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("refactoring")
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<space>rr",
|
||||
":lua require('refactoring').select_refactor()<CR>",
|
||||
desc = "Select refactoring",
|
||||
mode = {"n", "x"},
|
||||
},
|
||||
-- Refactoring operations
|
||||
{
|
||||
"<space>re",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>",
|
||||
desc = "Extract Function",
|
||||
mode = "x",
|
||||
},
|
||||
{
|
||||
"<space>rf",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>",
|
||||
desc = "Extract Function To File",
|
||||
mode = "x",
|
||||
},
|
||||
{
|
||||
"<space>rv",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>",
|
||||
desc = "Extract Variable",
|
||||
mode = "x",
|
||||
},
|
||||
{
|
||||
"<space>rI",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Inline Function')<CR>",
|
||||
desc = "Inline Function",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<space>ri",
|
||||
"<Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>",
|
||||
desc = "Inline Variable",
|
||||
mode = {"n", "x"},
|
||||
},
|
||||
-- Extract block
|
||||
{
|
||||
"<space>rb",
|
||||
"<Cmd>lua require('refactoring').refactor('Extract Block')<CR>",
|
||||
desc = "Extract Block",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<space>rbf",
|
||||
"<Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>",
|
||||
desc = "Extract Block To File",
|
||||
mode = "n",
|
||||
},
|
||||
-- Telescope
|
||||
{
|
||||
"<leader>fr",
|
||||
"<Cmd>lua require('telescope').extensions.refactoring.refactors()<CR>",
|
||||
mode = "n",
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -8,5 +8,12 @@ return {
|
||||
'sgur/vim-textobj-parameter',
|
||||
event = "InsertEnter",
|
||||
dependencies = { 'kana/vim-textobj-user' }
|
||||
}
|
||||
},
|
||||
{
|
||||
'chaoren/vim-wordmotion',
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
},
|
||||
}
|
||||
136
home/user/.config/nvim/lua/plugins/ui.lua
Normal file
136
home/user/.config/nvim/lua/plugins/ui.lua
Normal file
@ -0,0 +1,136 @@
|
||||
local function get_virtual_env()
|
||||
return vim.fs.basename(os.getenv("VIRTUAL_ENV"))
|
||||
end
|
||||
|
||||
function GET_FORMATTED_VIRTUAL_ENV()
|
||||
if vim.bo.filetype == 'python' then
|
||||
return "<" .. get_virtual_env() .. ">"
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
function DETECT_INDENT_TYPE()
|
||||
if vim.bo.expandtab then
|
||||
return vim.bo.shiftwidth .. " spaces"
|
||||
else
|
||||
return vim.bo.shiftwidth / vim.bo.tabstop .. " tabs (" .. vim.bo.tabstop .. ")"
|
||||
end
|
||||
end
|
||||
|
||||
local function is_absolute_path(path)
|
||||
return string.sub(path, 1, 1) == '/' or string.sub(path, 1, 1) == '~'
|
||||
end
|
||||
|
||||
return {
|
||||
"folke/twilight.nvim",
|
||||
'HiPhish/rainbow-delimiters.nvim',
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
component_separators = { left = '', right = '' },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {
|
||||
{
|
||||
'vim.fn.getcwd()',
|
||||
fmt = function(str)
|
||||
local res = str
|
||||
|
||||
res = str:gsub(os.getenv("HOME"), "~")
|
||||
|
||||
return res
|
||||
end,
|
||||
color = { fg = 'white', gui='bold' },
|
||||
padding = { left = 1, right = 0 }
|
||||
},
|
||||
{
|
||||
'filename',
|
||||
fmt = function(str)
|
||||
local res = str
|
||||
|
||||
if is_absolute_path(res) then
|
||||
res = " " .. res
|
||||
else
|
||||
res = "/" .. res
|
||||
end
|
||||
|
||||
return res
|
||||
end,
|
||||
file_status = true,
|
||||
path = 1,
|
||||
padding = { left = 0, right = 1 }
|
||||
},
|
||||
},
|
||||
lualine_x = {'GET_FORMATTED_VIRTUAL_ENV()', 'DETECT_INDENT_TYPE()', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'},
|
||||
},
|
||||
})
|
||||
end,
|
||||
dependencies = { 'kyazdani42/nvim-web-devicons' },
|
||||
},
|
||||
{
|
||||
'EdenEast/nightfox.nvim',
|
||||
config = function()
|
||||
local colorscheme = require("nightfox")
|
||||
colorscheme.compile()
|
||||
colorscheme.setup()
|
||||
vim.cmd.colorscheme("nightfox")
|
||||
end
|
||||
},
|
||||
{
|
||||
'ellisonleao/gruvbox.nvim'
|
||||
},
|
||||
{
|
||||
'xiyaowong/transparent.nvim',
|
||||
config = function()
|
||||
require("transparent").setup({
|
||||
exclude_groups = {'CursorLine'},
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'lukas-reineke/virt-column.nvim',
|
||||
config = function()
|
||||
require("virt-column").setup({
|
||||
virtcolumn = '81'
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
config = function()
|
||||
require('colorizer').setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
config = function()
|
||||
require("ibl").setup({
|
||||
scope = { enabled = false },
|
||||
})
|
||||
end,
|
||||
main = "ibl"
|
||||
},
|
||||
{
|
||||
'karb94/neoscroll.nvim',
|
||||
config = function()
|
||||
require('neoscroll').setup({
|
||||
mappings = {'<C-u>', '<C-d>', '<C-b>',
|
||||
'<C-y>', '<C-e>', 'zt', 'zz', 'zb'},
|
||||
respect_scrolloff = false,
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
config = function()
|
||||
require("which-key").setup()
|
||||
end
|
||||
},
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
return {
|
||||
'folke/which-key.nvim',
|
||||
config = function()
|
||||
require("which-key").setup()
|
||||
end
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
weekend 31
|
||||
today 30;47
|
||||
header 1;37
|
||||
Loading…
x
Reference in New Issue
Block a user