mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 03:30:36 +00:00
feat: add support for Jedi-Vim plugin
- Add configuration for Jedi-Vim plugin in `lua/absolute/plugins/jedi.lua` - Create `lua/absolute/after/jedi.lua` to set Jedi-Vim mappings and options fix: fix lualine theme and add custom section - Update `lua/absolute/after/lualine.lua` to fix the lualine theme configuration - Add a custom section to display the Poetv status line in lualine feat: add keybindings for Poetv plugin - Add keybindings for activating and deactivating virtualenv in `lua/absolute/after/poet-v.lua` fix: fix remap keybindings - Update `lua/absolute/remap.lua` to fix and improve remap keybindings feat: add alternate escape keybinding - Add keybinding to use <C-c> as an alternate escape key in insert mode fix: disable Q keybinding - Disable the Q keybinding to prevent accidentally entering Ex mode feat: add keybinding for formatting document with LSP Formatter - Add keybinding to format the document using the LSP Formatter feat: add keybindings for navigation quick fixes - Add keybindings for navigating through quick fixes in the location list and the quickfix list feat: add keybinding for regex replace - Add keybinding to perform a regex replace in the entire file feat: add keybinding for sourcing file - Add keybinding to source the current file feat: add keybinding for toggling TMUX pane - Add keybinding to toggle the TMUX pane using MaximizerToggle command
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" },
|
||||
"gitignore.nvim": { "branch": "master", "commit": "e0e0c511595681ef826a91a9e8449e86049406a0" },
|
||||
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
|
||||
"jedi-vim": { "branch": "master", "commit": "9bd79ee41ac59a33f5890fa50b6d6a446fcc38c7" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "7f26cf5e27e2bd910ce0ea00c514da2bf97423b8" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
|
||||
@@ -24,12 +25,12 @@
|
||||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||
"nvim-dap": { "branch": "master", "commit": "f0dca670fa059eb89dda8869a6310c804241345c" },
|
||||
"nvim-dap-python": { "branch": "master", "commit": "091e4ae00a12085f9ed4200a3cd04af7179b8a23" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "947660daced01c3eb673e3dc9527c988e42fe4cc" },
|
||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "8e7223e138590c1bd9d86d3de810e65939d8b12f" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ce0e625df61be77abe1340fbc9afe9ad39b31dd8" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "f1b3e6a7eb92da492bd693257367d9256839ed3d" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "65ef62092ef997d2ecf68ede01a0afbda17808c3" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "cff25ce621e6d15fae0b0bfe38c00be50ce38468" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "3ef514b10b9557e3905b9817ca632e7506dd384a" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "3e24abe1ae66532135cec911562f553fe247cb56" },
|
||||
"nvim_lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
|
||||
|
||||
10
lua/absolute/after/jedi.lua
Normal file
10
lua/absolute/after/jedi.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
vim.g["jedi#goto_command"] = "" -- "<leader>d"
|
||||
vim.g["jedi#goto_assignments_command"] = "<leader>gD"
|
||||
vim.g["jedi#goto_stubs_command"] = "" -- "<leader>s"
|
||||
vim.g["jedi#goto_definitions_command"] = "gd"
|
||||
vim.g["jedi#documentation_command"] = "K"
|
||||
vim.g["jedi#usages_command"] = "<leader>n"
|
||||
vim.g["jedi#completions_command"] = "<C-Space>"
|
||||
vim.g["jedi#rename_command"] = "<leader>rn"
|
||||
vim.g["jedi#rename_command_keep_name"] = "" -- "<leader>R"
|
||||
|
||||
@@ -45,6 +45,34 @@ local my_lualine_theme = {
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
function GetPoetvStatusLine()
|
||||
-- Get the poetv statusline
|
||||
-- If poetv is not active, return empty string
|
||||
|
||||
if IsPoetvActive() then
|
||||
local poetv_name = vim.g.poetv_name
|
||||
local poetv_statusline_symbol = vim.g.poetv_statusline_symbol
|
||||
|
||||
local result = string.sub(poetv_name, 1, 20) .. " " .. poetv_statusline_symbol
|
||||
|
||||
return result
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
function IsPoetvActive()
|
||||
-- Check if vim.g.poetv_name exists
|
||||
-- If it does, then poetv is active
|
||||
|
||||
if vim.g.poetv_name ~= nil then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- configure lualine with modified theme
|
||||
lualine.setup({
|
||||
options = {
|
||||
@@ -52,6 +80,11 @@ lualine.setup({
|
||||
},
|
||||
sections = {
|
||||
lualine_x = {
|
||||
{
|
||||
GetPoetvStatusLine,
|
||||
cond = IsPoetvActive,
|
||||
color = { fg = "#ff9e64" },
|
||||
},
|
||||
{
|
||||
lazy_status.updates,
|
||||
cond = lazy_status.has_updates,
|
||||
|
||||
@@ -2,3 +2,16 @@ vim.g.poetv_executables = { "poetry", "pipenv" }
|
||||
vim.g.poetv_auto_activate = 1
|
||||
vim.g.poetv_set_environment = 1
|
||||
vim.g.poetv_statusline_symbol = "🐍"
|
||||
|
||||
|
||||
-- Keybindings
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Poetv: Activate Virtualenv
|
||||
opts.desc = "Poetv: Activate virtualenv"
|
||||
vim.keymap.set("n", "<leader>pva", "<cmd>PoetvActivate<CR>", opts)
|
||||
|
||||
-- Poetv: Deactivate Virtualenv
|
||||
opts.desc = "Poetv: Deactivate virtualenv"
|
||||
vim.keymap.set("n", "<leader>pvd", "<cmd>PoetvDeactivate<CR>", opts)
|
||||
|
||||
@@ -31,4 +31,3 @@ vim.opt.updatetime = 50
|
||||
vim.opt.colorcolumn = ""
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
6
lua/absolute/plugins/jedi.lua
Normal file
6
lua/absolute/plugins/jedi.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
"davidhalter/jedi-vim",
|
||||
config = function()
|
||||
require("absolute.after.jedi")
|
||||
end
|
||||
}
|
||||
@@ -1,59 +1,90 @@
|
||||
vim.keymap.set("n", "<leader>\\", "<cmd>NvimTreeToggle<CR>") -- toggle file explorer
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
opts.desc = "Toggle File Explorer"
|
||||
vim.keymap.set("n", "<leader>\\", "<cmd>NvimTreeToggle<CR>", opts) -- toggle file explorer
|
||||
|
||||
|
||||
-- Move selected line / block of text in visual mode up
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
opts.desc = "Move selected line / block of text in visual mode up"
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", opts)
|
||||
|
||||
-- Move selected line / block of text in visual mode down
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
opts.desc = "Move selected line / block of text in visual mode down"
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", opts)
|
||||
|
||||
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
-- Join current line with the line below it
|
||||
opts.desc = "Join current line with the line below it"
|
||||
vim.keymap.set("n", "J", "mzJ`z", opts)
|
||||
|
||||
|
||||
-- Move half page down
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
opts.desc = "Move half page down"
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz", opts)
|
||||
|
||||
-- Move half page up
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
opts.desc = "Move half page up"
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz", opts)
|
||||
|
||||
-- Navigate to next search result, center screen and expand folded text
|
||||
opts.desc = "Navigate to next search result, center screen and expand folded text"
|
||||
vim.keymap.set("n", "n", "nzzzv", opts)
|
||||
|
||||
-- Navigate to previous search result, center screen and expand folded text,
|
||||
opts.desc = "Navigate to previous search result, center screen and expand folded text"
|
||||
vim.keymap.set("n", "N", "Nzzzv", opts)
|
||||
|
||||
-- Delete selected text and paste from register
|
||||
opts.desc = "Delete selected text and paste from register"
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]], opts)
|
||||
|
||||
-- Copy selected text into system clipboard
|
||||
opts.desc = "Copy selected text into system clipboard"
|
||||
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]], opts)
|
||||
|
||||
-- Copy current line into system clipboard
|
||||
opts.desc = "Copy current line into system clipboard"
|
||||
vim.keymap.set("n", "<leader>Y", [["+Y]], opts)
|
||||
|
||||
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]])
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
|
||||
vim.keymap.set("n", "<leader>Y", [["+Y]])
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
|
||||
-- Delete (blackhole)
|
||||
opts.desc = "Delete current line (blackhole)"
|
||||
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]], opts)
|
||||
|
||||
|
||||
-- Alternate Escape (Easy to Reach)
|
||||
vim.keymap.set("i", "<C-c>", "<Esc>")
|
||||
opts.desc = "Alternate Escape (Easy to Reach)"
|
||||
vim.keymap.set("i", "<C-c>", "<Esc>", opts)
|
||||
|
||||
|
||||
-- Disable Q - Nothing Good Ever Happens
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
-- Q is normally used to enable Ex mode. We dont want that
|
||||
opts.desc = "Disable Q - Nothing Good Ever Happens"
|
||||
vim.keymap.set("n", "Q", "<nop>", opts)
|
||||
|
||||
-- Format document with LSP Formatter
|
||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
|
||||
opts.desc = "Format document with LSP Formatter"
|
||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format, opts)
|
||||
|
||||
-- Navigation Quick Fixes
|
||||
|
||||
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
||||
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
||||
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
||||
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||
|
||||
--
|
||||
-- vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz", opts)
|
||||
-- vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz", opts)
|
||||
-- vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz", opts)
|
||||
-- vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz", opts)
|
||||
--
|
||||
|
||||
-- Search Regex Keymap
|
||||
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
opts.desc = "Regex Replace"
|
||||
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], opts)
|
||||
|
||||
|
||||
-- Source File Keymap
|
||||
opts.desc = "Source File"
|
||||
vim.keymap.set("n", "<leader><leader>", function()
|
||||
vim.cmd("so")
|
||||
end)
|
||||
end, opts)
|
||||
|
||||
-- Manage VIM Maximizer
|
||||
vim.keymap.set("n", "<leader>sm", "<cmd>MaximizerToggle<CR>")
|
||||
opts.desc = "Toggle TMUX Pane"
|
||||
vim.keymap.set("n", "<leader>sm", "<cmd>MaximizerToggle<CR>", opts)
|
||||
|
||||
Reference in New Issue
Block a user