First commit: migration to new config
This commit is contained in:
commit
8762db9743
6
.stylua.toml
Normal file
6
.stylua.toml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
column_width = 120
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
call_parentheses = "None"
|
||||||
24
LICENSE
Normal file
24
LICENSE
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <https://unlicense.org>
|
||||||
104
README.md
Normal file
104
README.md
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
## Plugins
|
||||||
|
- neovim:
|
||||||
|
- neovim/nvim-lspconfig
|
||||||
|
- LSP for neovim
|
||||||
|
- nvim-*:
|
||||||
|
- nvim-lua/plenary.nvim
|
||||||
|
- Lua module to interact with system processes
|
||||||
|
- nvim-telescope/telescope-dap.nvim
|
||||||
|
- Integration of nvim-dap with telescope
|
||||||
|
- nvim-telescope/telescope-fzf-native.nvim
|
||||||
|
- Fzf-native is a `c` port of `fzf`
|
||||||
|
- nvim-telescope/telescope-live-grep-args.nvim
|
||||||
|
- Enable passing arguments to the grep command `rg`
|
||||||
|
- nvim-telescope/telescope.nvim
|
||||||
|
- Really? You don't know telescope?
|
||||||
|
- nvim-tree/nvim-tree.lua
|
||||||
|
- File explorer tree
|
||||||
|
- nvim-tree/nvim-web-devicons
|
||||||
|
- Fork of vim-devicons, provides icons
|
||||||
|
- nvim-treesitter/nvim-treesitter
|
||||||
|
- Configurations and abstraction layer for Nvim tree-sitter
|
||||||
|
- nvim-treesitter/nvim-treesitter-textobjects
|
||||||
|
- Syntax aware text-objects, select, move, swap and peek support
|
||||||
|
- tpope:
|
||||||
|
- tpope/vim-fugitive
|
||||||
|
- *The* git wrapper
|
||||||
|
- tpope/vim-obsession
|
||||||
|
- Continuously updated session files
|
||||||
|
- tpope/vim-surround
|
||||||
|
- Delete/change/add parenthese/quote/much more with ease
|
||||||
|
- folke:
|
||||||
|
- folke/noice.nvim
|
||||||
|
- Replace the UI for messages, cmdline and the popupmenu
|
||||||
|
- folke/todo-comments.nvi
|
||||||
|
- Highlight, list and search todo comments
|
||||||
|
- folke/trouble.nvim
|
||||||
|
- A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing
|
||||||
|
- folke/which-key.nvim
|
||||||
|
- Create key bindings that stick. WhichKey helps you remember your Neovim keymaps, by showing available keybindings in a popup as you type
|
||||||
|
- mfussenegger:
|
||||||
|
- mfussenegger/nvim-dap
|
||||||
|
- Debug Adapter Protocol client implementation
|
||||||
|
- mfussenegger/nvim-dap-python
|
||||||
|
- Default config for DAP python
|
||||||
|
- sindrets:
|
||||||
|
- sindrets/diffview.nvim
|
||||||
|
- Single tabpage interface for diffs
|
||||||
|
- sindrets/winshift.nvim
|
||||||
|
- Rearrange your windows with ease
|
||||||
|
- stevearc:
|
||||||
|
- stevearc/conform.nvim
|
||||||
|
- Lightweight yet powerful formatter plugin
|
||||||
|
- stevearc/quicker.nvim
|
||||||
|
- Improved UI and workflow for the quickfix list
|
||||||
|
- Others:
|
||||||
|
- aaronhallaert/advanced-git-search.nvim
|
||||||
|
- Search your git history by commit message, content and author
|
||||||
|
- anuvyklack/hydra.nvim
|
||||||
|
- Create custom submodes and menus
|
||||||
|
- desdic/macrothis.nvim
|
||||||
|
- Save and load macros
|
||||||
|
- emaniacs/vim-rest-console
|
||||||
|
- REST console
|
||||||
|
- gioele/vim-autoswap
|
||||||
|
- Please Vim, stop with these swap file messages. Just switch to the correct window!
|
||||||
|
- hrsh7th/nvim-cmp
|
||||||
|
- A completion plugin
|
||||||
|
- iamcco/markdown-preview.nvim
|
||||||
|
- Markdown previewer
|
||||||
|
- kdheepak/lazygit.nvim
|
||||||
|
- Simple terminal UI for git commands
|
||||||
|
- L3MON4D3/LuaSnip
|
||||||
|
- Snippet Engine
|
||||||
|
- lewis6991/gitsigns.nvim
|
||||||
|
- Git integration for buffers
|
||||||
|
- ludovicchabant/vim-gutentags
|
||||||
|
- Manage your tag files
|
||||||
|
- lukas-reineke/indent-blankline.nvim
|
||||||
|
- Indent guides
|
||||||
|
- mangelozzi/rgflow.nvim
|
||||||
|
- Help you get in the flow with ripgrep
|
||||||
|
- natecraddock/workspaces.nvim
|
||||||
|
- Manage workspace directories
|
||||||
|
- numToStr/Comment.nvim
|
||||||
|
- Smart and powerful comment plugin. Support treesitter, dot reaper, left-right/up-down motions, hooks and more
|
||||||
|
- onsails/diaglist.nvim
|
||||||
|
- Live render workspace diagnostics in quickfix with current buf errors on top, buffer diagnostics in loclist
|
||||||
|
- preservim/tagbar
|
||||||
|
- Displays tags in a window, ordered by scope
|
||||||
|
- rbong/vim-flog
|
||||||
|
- A fast, beautiful, and powerful git branch viewer
|
||||||
|
- rcarriga/nvim-dap-ui
|
||||||
|
- UI for nvim-dap
|
||||||
|
- rebelot/kanagawa.nvim
|
||||||
|
- Dark colorscheme inspired by the colors of the famous painting by Katsushika Hokusai
|
||||||
|
- ThePrimeagen/harpoon
|
||||||
|
- Weissle/persistent-breakpoints.nvim
|
||||||
|
- Persistent breakpoints for DAP
|
||||||
|
- williamboman/mason.nvim
|
||||||
|
- Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters
|
||||||
|
- windwp/nvim-autopairs
|
||||||
|
- Autopairs that support multiple characters
|
||||||
|
- yorickpeterse/nvim-window
|
||||||
|
- Easily jump between windows
|
||||||
37
init.lua
Normal file
37
init.lua
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
|
-- bootstrap lazy and all plugins
|
||||||
|
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||||
|
|
||||||
|
if not vim.uv.fs_stat(lazypath) then
|
||||||
|
local repo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
local lazy_config = require "configs.lazy"
|
||||||
|
|
||||||
|
-- load plugins
|
||||||
|
require("lazy").setup({
|
||||||
|
{
|
||||||
|
"NvChad/NvChad",
|
||||||
|
lazy = false,
|
||||||
|
branch = "v2.5",
|
||||||
|
import = "nvchad.plugins",
|
||||||
|
},
|
||||||
|
|
||||||
|
{ import = "plugins" },
|
||||||
|
}, lazy_config)
|
||||||
|
|
||||||
|
-- load theme
|
||||||
|
dofile(vim.g.base46_cache .. "defaults")
|
||||||
|
dofile(vim.g.base46_cache .. "statusline")
|
||||||
|
|
||||||
|
require "options"
|
||||||
|
require "nvchad.autocmds"
|
||||||
|
|
||||||
|
vim.schedule(function()
|
||||||
|
require "mappings"
|
||||||
|
end)
|
||||||
58
lua/chadrc.lua
Normal file
58
lua/chadrc.lua
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
-- This file needs to have same structure as nvconfig.lua
|
||||||
|
-- https://github.com/NvChad/ui/blob/v2.5/lua/nvconfig.lua
|
||||||
|
|
||||||
|
---@type ChadrcConfig
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.base46 = {
|
||||||
|
theme = "onedark",
|
||||||
|
transparency = true,
|
||||||
|
|
||||||
|
hl_override = {
|
||||||
|
Comment = { italic = true },
|
||||||
|
["@comment"] = { italic = true },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
M.ui = {
|
||||||
|
theme = "onedark",
|
||||||
|
statusline = {
|
||||||
|
theme = "default",
|
||||||
|
separator_style = "arrow",
|
||||||
|
order = {
|
||||||
|
"macro",
|
||||||
|
"mode",
|
||||||
|
"relativepath",
|
||||||
|
"file",
|
||||||
|
"git",
|
||||||
|
"%=",
|
||||||
|
"lsp_msg",
|
||||||
|
"%=",
|
||||||
|
"diagnostics",
|
||||||
|
"lsp",
|
||||||
|
"cwd",
|
||||||
|
"cursor",
|
||||||
|
},
|
||||||
|
modules = {
|
||||||
|
macro = function()
|
||||||
|
local noice = require "noice"
|
||||||
|
if noice.api.statusline.mode.has() then
|
||||||
|
return "%#St_CommandMode#" .. noice.api.statusline.mode.get()
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end,
|
||||||
|
relativepath = function()
|
||||||
|
local stbufnr = vim.api.nvim_win_get_buf(vim.g.statusline_winid or 0)
|
||||||
|
local path = vim.api.nvim_buf_get_name(stbufnr)
|
||||||
|
|
||||||
|
if path == "" then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
return "%#St_file# " .. vim.fn.expand "%:.:h" .. " /"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return M
|
||||||
21
lua/configs/blankline.lua
Normal file
21
lua/configs/blankline.lua
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
return {}
|
||||||
|
-- return {
|
||||||
|
-- indentLine_enabled = 1,
|
||||||
|
-- filetype_exclude = {
|
||||||
|
-- "help",
|
||||||
|
-- "terminal",
|
||||||
|
-- "lazy",
|
||||||
|
-- "lspinfo",
|
||||||
|
-- "TelescopePrompt",
|
||||||
|
-- "TelescopeResults",
|
||||||
|
-- "mason",
|
||||||
|
-- "nvdash",
|
||||||
|
-- "nvcheatsheet",
|
||||||
|
-- "",
|
||||||
|
-- },
|
||||||
|
-- buftype_exclude = { "terminal" },
|
||||||
|
-- show_trailing_blankline_indent = false,;
|
||||||
|
-- show_first_indent_level = false,
|
||||||
|
-- show_current_context = true,
|
||||||
|
-- show_current_context_start = true,
|
||||||
|
-- }
|
||||||
0
lua/configs/cmp.lua
Normal file
0
lua/configs/cmp.lua
Normal file
15
lua/configs/conform.lua
Normal file
15
lua/configs/conform.lua
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
local options = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { "stylua" },
|
||||||
|
-- css = { "prettier" },
|
||||||
|
-- html = { "prettier" },
|
||||||
|
},
|
||||||
|
|
||||||
|
format_on_save = {
|
||||||
|
-- These options will be passed to conform.format()
|
||||||
|
timeout_ms = 500,
|
||||||
|
lsp_fallback = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
||||||
1
lua/configs/diffview.lua
Normal file
1
lua/configs/diffview.lua
Normal file
@ -0,0 +1 @@
|
|||||||
|
return {}
|
||||||
138
lua/configs/gitlab.lua
Normal file
138
lua/configs/gitlab.lua
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
local M = {
|
||||||
|
port = nil, -- The port of the Go server, which runs in the background, if omitted or `nil` the port will be chosen automatically
|
||||||
|
log_path = vim.fn.stdpath "cache" .. "/gitlab.nvim.log", -- Log path for the Go server
|
||||||
|
config_path = nil, -- Custom path for `.gitlab.nvim` file, please read the "Connecting to Gitlab" section
|
||||||
|
debug = {
|
||||||
|
go_request = false,
|
||||||
|
go_response = false,
|
||||||
|
},
|
||||||
|
attachment_dir = nil, -- The local directory for files (see the "summary" section)
|
||||||
|
reviewer_settings = {
|
||||||
|
diffview = {
|
||||||
|
imply_local = false, -- If true, will attempt to use --imply_local option when calling |:DiffviewOpen|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
connection_settings = {
|
||||||
|
insecure = false, -- Like curl's --insecure option, ignore bad x509 certificates on connection
|
||||||
|
},
|
||||||
|
help = "g?", -- Opens a help popup for local keymaps when a relevant view is focused (popup, discussion panel, etc)
|
||||||
|
popup = { -- The popup for comment creation, editing, and replying
|
||||||
|
keymaps = {
|
||||||
|
next_field = "<Tab>", -- Cycle to the next field. Accepts count.
|
||||||
|
prev_field = "<S-Tab>", -- Cycle to the previous field. Accepts count.
|
||||||
|
},
|
||||||
|
perform_action = "<leader>s", -- Once in normal mode, does action (like saving comment or editing description, etc)
|
||||||
|
perform_linewise_action = "<leader>l", -- Once in normal mode, does the linewise action (see logs for this job, etc)
|
||||||
|
width = "50%",
|
||||||
|
height = "80%",
|
||||||
|
border = "rounded", -- One of "
|
||||||
|
opacity = 1.0, -- From 0.0 (fully transparent) to 1.0 (fully opaque)
|
||||||
|
comment = nil, -- Individual popup overrides, e.g. { width = "60%", height = "80%", border = "single", opacity = 0.85 },
|
||||||
|
edit = nil,
|
||||||
|
note = nil,
|
||||||
|
pipeline = nil,
|
||||||
|
reply = nil,
|
||||||
|
squash_message = nil,
|
||||||
|
temp_registers = {}, -- List of registers for backing up popup content (see `:h gitlab.nvim.temp-registers`)
|
||||||
|
},
|
||||||
|
discussion_tree = { -- The discussion tree that holds all comments
|
||||||
|
auto_open = true, -- Automatically open when the reviewer is opened
|
||||||
|
switch_view = "S", -- Toggles between the notes and discussions views
|
||||||
|
default_view = "discussions", -- Show "discussions" or "notes" by default
|
||||||
|
blacklist = {}, -- List of usernames to remove from tree (bots, CI, etc)
|
||||||
|
jump_to_file = "o", -- Jump to comment location in file
|
||||||
|
jump_to_reviewer = "m", -- Jump to the location in the reviewer window
|
||||||
|
edit_comment = "e", -- Edit comment
|
||||||
|
delete_comment = "dd", -- Delete comment
|
||||||
|
reply = "r", -- Reply to comment
|
||||||
|
toggle_node = "t", -- Opens or closes the discussion
|
||||||
|
add_emoji = "Ea", -- Add an emoji to the note/comment
|
||||||
|
-- add_emoji = "Ed", -- Remove an emoji from a note/comment
|
||||||
|
toggle_all_discussions = "T", -- Open or close separately both resolved and unresolved discussions
|
||||||
|
toggle_resolved_discussions = "R", -- Open or close all resolved discussions
|
||||||
|
toggle_unresolved_discussions = "U", -- Open or close all unresolved discussions
|
||||||
|
keep_current_open = false, -- If true, current discussion stays open even if it should otherwise be closed when toggling
|
||||||
|
publish_draft = "P", -- Publishes the currently focused note/comment
|
||||||
|
toggle_resolved = "p", -- Toggles the resolved status of the whole discussion
|
||||||
|
position = "left", -- "top", "right", "bottom" or "left"
|
||||||
|
open_in_browser = "b", -- Jump to the URL of the current note/discussion
|
||||||
|
copy_node_url = "u", -- Copy the URL of the current node to clipboard
|
||||||
|
size = "30%", -- Size of split
|
||||||
|
relative = "editor", -- Position of tree split relative to "editor" or "window"
|
||||||
|
resolved = "✓", -- Symbol to show next to resolved discussions
|
||||||
|
unresolved = "✗", -- Symbol to show next to unresolved discussions
|
||||||
|
tree_type = "by_file_name", -- Type of discussion tree - "simple" means just list of discussions, "by_file_name" means file tree with discussions under file
|
||||||
|
toggle_tree_type = "i", -- Toggle type of discussion tree - "simple", or "by_file_name"
|
||||||
|
draft_mode = false, -- Whether comments are posted as drafts as part of a review
|
||||||
|
toggle_draft_mode = "D", -- Toggle between draft mode (comments posted as drafts) and live mode (comments are posted immediately)
|
||||||
|
winbar = nil, -- Custom function to return winbar title, should return a string. Provided with WinbarTable (defined in annotations.lua)
|
||||||
|
-- If using lualine, please add "gitlab" to disabled file types, otherwise you will not see the winbar.
|
||||||
|
},
|
||||||
|
choose_merge_request = {
|
||||||
|
open_reviewer = true, -- Open the reviewer window automatically after switching merge requests
|
||||||
|
},
|
||||||
|
info = { -- Show additional fields in the summary view
|
||||||
|
enabled = true,
|
||||||
|
horizontal = false, -- Display metadata to the left of the summary rather than underneath
|
||||||
|
fields = { -- The fields listed here will be displayed, in whatever order you choose
|
||||||
|
"author",
|
||||||
|
"created_at",
|
||||||
|
"updated_at",
|
||||||
|
"merge_status",
|
||||||
|
"draft",
|
||||||
|
"conflicts",
|
||||||
|
"assignees",
|
||||||
|
"reviewers",
|
||||||
|
"pipeline",
|
||||||
|
"branch",
|
||||||
|
"target_branch",
|
||||||
|
"delete_branch",
|
||||||
|
"squash",
|
||||||
|
"labels",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
discussion_signs = {
|
||||||
|
enabled = true, -- Show diagnostics for gitlab comments in the reviewer
|
||||||
|
skip_resolved_discussion = false, -- Show diagnostics for resolved discussions
|
||||||
|
severity = vim.diagnostic.severity.INFO, -- ERROR, WARN, INFO, or HINT
|
||||||
|
virtual_text = false, -- Whether to show the comment text inline as floating virtual text
|
||||||
|
priority = 100, -- Higher will override LSP warnings, etc
|
||||||
|
icons = {
|
||||||
|
comment = "→|",
|
||||||
|
range = " |",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pipeline = {
|
||||||
|
created = "",
|
||||||
|
pending = "",
|
||||||
|
preparing = "",
|
||||||
|
scheduled = "",
|
||||||
|
running = "",
|
||||||
|
canceled = "↪",
|
||||||
|
skipped = "↪",
|
||||||
|
success = "✓",
|
||||||
|
failed = "",
|
||||||
|
},
|
||||||
|
create_mr = {
|
||||||
|
target = "master", -- Default branch to target when creating an MR
|
||||||
|
template_file = nil, -- Default MR template in .gitlab/merge_request_templates
|
||||||
|
delete_branch = false, -- Whether the source branch will be marked for deletion
|
||||||
|
squash = false, -- Whether the commits will be marked for squashing
|
||||||
|
title_input = { -- Default settings for MR title input window
|
||||||
|
width = 40,
|
||||||
|
border = "rounded",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
colors = {
|
||||||
|
discussion_tree = {
|
||||||
|
username = "Keyword",
|
||||||
|
date = "Comment",
|
||||||
|
chevron = "DiffviewNonText",
|
||||||
|
directory = "Directory",
|
||||||
|
directory_icon = "DiffviewFolderSign",
|
||||||
|
file_name = "Normal",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return M
|
||||||
10
lua/configs/gitsigns.lua
Normal file
10
lua/configs/gitsigns.lua
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
return {
|
||||||
|
signs = {
|
||||||
|
add = { text = "│" },
|
||||||
|
change = { text = "│" },
|
||||||
|
delete = { text = "" },
|
||||||
|
topdelete = { text = "‾" },
|
||||||
|
changedelete = { text = "~" },
|
||||||
|
untracked = { text = "│" },
|
||||||
|
},
|
||||||
|
}
|
||||||
35
lua/configs/hydra.lua
Normal file
35
lua/configs/hydra.lua
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
local Hydra = require "hydra"
|
||||||
|
|
||||||
|
Hydra {
|
||||||
|
name = "Change / Resize Window",
|
||||||
|
mode = { "n" },
|
||||||
|
body = "<leader>t",
|
||||||
|
config = {
|
||||||
|
-- color = "pink",
|
||||||
|
},
|
||||||
|
heads = {
|
||||||
|
-- move between windows
|
||||||
|
{ "<C-h>", "<C-w>h", { desc = "Noot nooty" } },
|
||||||
|
{ "<C-j>", "<C-w>j" },
|
||||||
|
{ "<C-k>", "<C-w>k" },
|
||||||
|
{ "<C-l>", "<C-w>l" },
|
||||||
|
|
||||||
|
-- resizing window
|
||||||
|
{ "H", "<C-w>3<" },
|
||||||
|
{ "L", "<C-w>3>" },
|
||||||
|
{ "K", "<C-w>2+" },
|
||||||
|
{ "J", "<C-w>2-" },
|
||||||
|
|
||||||
|
-- equalize window sizes
|
||||||
|
{ "e", "<C-w>=" },
|
||||||
|
|
||||||
|
-- close active window
|
||||||
|
{ "Q", ":q<cr>" },
|
||||||
|
{ "<C-q>", ":q<cr>" },
|
||||||
|
|
||||||
|
-- exit this Hydra
|
||||||
|
{ "q", nil, { exit = true, nowait = true } },
|
||||||
|
{ ";", nil, { exit = true, nowait = true } },
|
||||||
|
{ "<Esc>", nil, { exit = true, nowait = true } },
|
||||||
|
},
|
||||||
|
}
|
||||||
47
lua/configs/lazy.lua
Normal file
47
lua/configs/lazy.lua
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
return {
|
||||||
|
defaults = { lazy = true },
|
||||||
|
install = { colorscheme = { "nvchad" } },
|
||||||
|
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
ft = "",
|
||||||
|
lazy = " ",
|
||||||
|
loaded = "",
|
||||||
|
not_loaded = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
performance = {
|
||||||
|
rtp = {
|
||||||
|
disabled_plugins = {
|
||||||
|
"2html_plugin",
|
||||||
|
"tohtml",
|
||||||
|
"getscript",
|
||||||
|
"getscriptPlugin",
|
||||||
|
"gzip",
|
||||||
|
"logipat",
|
||||||
|
"netrw",
|
||||||
|
"netrwPlugin",
|
||||||
|
"netrwSettings",
|
||||||
|
"netrwFileHandlers",
|
||||||
|
"matchit",
|
||||||
|
"tar",
|
||||||
|
"tarPlugin",
|
||||||
|
"rrhelper",
|
||||||
|
"spellfile_plugin",
|
||||||
|
"vimball",
|
||||||
|
"vimballPlugin",
|
||||||
|
"zip",
|
||||||
|
"zipPlugin",
|
||||||
|
"tutor",
|
||||||
|
"rplugin",
|
||||||
|
"syntax",
|
||||||
|
"synmenu",
|
||||||
|
"optwin",
|
||||||
|
"compiler",
|
||||||
|
"bugreport",
|
||||||
|
"ftplugin",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
24
lua/configs/lspconfig.lua
Normal file
24
lua/configs/lspconfig.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
-- load defaults i.e lua_lsp
|
||||||
|
require("nvchad.configs.lspconfig").defaults()
|
||||||
|
|
||||||
|
local lspconfig = require "lspconfig"
|
||||||
|
|
||||||
|
-- EXAMPLE
|
||||||
|
local servers = { "html", "cssls" }
|
||||||
|
local nvlsp = require "nvchad.configs.lspconfig"
|
||||||
|
|
||||||
|
-- lsps with default config
|
||||||
|
for _, lsp in ipairs(servers) do
|
||||||
|
lspconfig[lsp].setup {
|
||||||
|
on_attach = nvlsp.on_attach,
|
||||||
|
on_init = nvlsp.on_init,
|
||||||
|
capabilities = nvlsp.capabilities,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- configuring single server, example: typescript
|
||||||
|
-- lspconfig.tsserver.setup {
|
||||||
|
-- on_attach = nvlsp.on_attach,
|
||||||
|
-- on_init = nvlsp.on_init,
|
||||||
|
-- capabilities = nvlsp.capabilities,
|
||||||
|
-- }
|
||||||
28
lua/configs/luasnip.lua
Normal file
28
lua/configs/luasnip.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
local luasnip = function(opts)
|
||||||
|
require("luasnip").config.set_config(opts)
|
||||||
|
|
||||||
|
-- vscode format
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
|
||||||
|
|
||||||
|
-- snipmate format
|
||||||
|
require("luasnip.loaders.from_snipmate").load()
|
||||||
|
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
|
||||||
|
|
||||||
|
-- lua format
|
||||||
|
require("luasnip.loaders.from_lua").load()
|
||||||
|
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||||
|
callback = function()
|
||||||
|
if
|
||||||
|
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||||
|
and not require("luasnip").session.jump_active
|
||||||
|
then
|
||||||
|
require("luasnip").unlink_current()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return luasnip
|
||||||
28
lua/configs/mason.lua
Normal file
28
lua/configs/mason.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
local options = {
|
||||||
|
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
|
||||||
|
|
||||||
|
PATH = "prepand",
|
||||||
|
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
package_pending = " ",
|
||||||
|
package_installed = " ",
|
||||||
|
package_uninstalled = " ",
|
||||||
|
},
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
toggle_server_expand = "<CR>",
|
||||||
|
install_server = "i",
|
||||||
|
update_server = "u",
|
||||||
|
check_server_version = "c",
|
||||||
|
update_all_servers = "U",
|
||||||
|
check_outdated_servers = "C",
|
||||||
|
uninstall_server = "X",
|
||||||
|
cancel_installation = "<C-c>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
max_concurrent_installers = 10,
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
||||||
46
lua/configs/noice.lua
Normal file
46
lua/configs/noice.lua
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
local M = {
|
||||||
|
lsp = {
|
||||||
|
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||||
|
override = {
|
||||||
|
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||||
|
["vim.lsp.util.stylize_markdown"] = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- you can enable a preset for easier configuration
|
||||||
|
presets = {
|
||||||
|
bottom_search = true, -- use a classic bottom cmdline for search
|
||||||
|
command_palette = true, -- position the cmdline and popupmenu together
|
||||||
|
long_message_to_split = true, -- long messages will be sent to a split
|
||||||
|
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||||
|
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||||
|
},
|
||||||
|
views = {
|
||||||
|
cmdline_popup = {
|
||||||
|
-- border = {
|
||||||
|
-- style = "none",
|
||||||
|
-- padding = { 2, 3 },
|
||||||
|
-- },
|
||||||
|
-- position = {
|
||||||
|
-- row = "85%",
|
||||||
|
-- col = "50%",
|
||||||
|
-- },
|
||||||
|
size = {
|
||||||
|
width = 120,
|
||||||
|
height = "auto",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
popupmenu = {
|
||||||
|
-- relative = "editor",
|
||||||
|
-- position = {
|
||||||
|
-- row = 25,
|
||||||
|
-- col = "50%",
|
||||||
|
-- },
|
||||||
|
size = {
|
||||||
|
width = 120,
|
||||||
|
-- height = 10,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return M
|
||||||
77
lua/configs/nvimtree.lua
Normal file
77
lua/configs/nvimtree.lua
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
local options = {
|
||||||
|
filters = {
|
||||||
|
dotfiles = false,
|
||||||
|
exclude = { vim.fn.stdpath "config" .. "/lua/custom" },
|
||||||
|
},
|
||||||
|
disable_netrw = true,
|
||||||
|
hijack_netrw = true,
|
||||||
|
hijack_cursor = true,
|
||||||
|
hijack_unnamed_buffer_when_opening = false,
|
||||||
|
sync_root_with_cwd = true,
|
||||||
|
update_focused_file = {
|
||||||
|
enable = true,
|
||||||
|
update_root = false,
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
adaptive_size = false,
|
||||||
|
side = "left",
|
||||||
|
width = 30,
|
||||||
|
preserve_window_proportions = true,
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
enable = false,
|
||||||
|
ignore = true,
|
||||||
|
},
|
||||||
|
filesystem_watchers = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
open_file = {
|
||||||
|
resize_window = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
renderer = {
|
||||||
|
root_folder_label = false,
|
||||||
|
highlight_git = false,
|
||||||
|
highlight_opened_files = "none",
|
||||||
|
|
||||||
|
indent_markers = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
icons = {
|
||||||
|
show = {
|
||||||
|
file = true,
|
||||||
|
folder = true,
|
||||||
|
folder_arrow = true,
|
||||||
|
git = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
glyphs = {
|
||||||
|
default = "",
|
||||||
|
symlink = "",
|
||||||
|
folder = {
|
||||||
|
default = "",
|
||||||
|
empty = "",
|
||||||
|
empty_open = "",
|
||||||
|
open = "",
|
||||||
|
symlink = "",
|
||||||
|
symlink_open = "",
|
||||||
|
arrow_open = "",
|
||||||
|
arrow_closed = "",
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
unstaged = "✗",
|
||||||
|
staged = "✓",
|
||||||
|
unmerged = "",
|
||||||
|
renamed = "➜",
|
||||||
|
untracked = "★",
|
||||||
|
deleted = "",
|
||||||
|
ignored = "◌",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
||||||
48
lua/configs/ruff_lsp.lua
Normal file
48
lua/configs/ruff_lsp.lua
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
-- See: https://github.com/neovim/nvim-lspconfig/tree/54eb2a070a4f389b1be0f98070f81d23e2b1a715#suggested-configuration
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
vim.keymap.set("n", "<space>k", vim.diagnostic.open_float, opts)
|
||||||
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||||
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||||
|
-- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||||
|
|
||||||
|
-- Use an on_attach function to only map the following keys
|
||||||
|
-- after the language server attaches to the current buffer
|
||||||
|
local on_attach = function(_, bufnr)
|
||||||
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
|
-- vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
|
||||||
|
-- vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
|
||||||
|
-- vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
|
||||||
|
-- vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts)
|
||||||
|
-- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||||
|
-- vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, bufopts)
|
||||||
|
-- vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||||
|
-- vim.keymap.set("n", "<space>wl", function()
|
||||||
|
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
-- end, bufopts)
|
||||||
|
|
||||||
|
-- vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts)
|
||||||
|
-- vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts)
|
||||||
|
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
|
||||||
|
-- vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts)
|
||||||
|
-- vim.keymap.set("n", "<space>f", function()
|
||||||
|
-- vim.lsp.buf.format { async = true }
|
||||||
|
-- end, bufopts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Configure `ruff-lsp`.
|
||||||
|
-- See: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#ruff_lsp
|
||||||
|
-- For the default config, along with instructions on how to customize the settings
|
||||||
|
require("lspconfig").ruff_lsp.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
init_options = {
|
||||||
|
settings = {
|
||||||
|
-- Any extra CLI arguments for `ruff` go here.
|
||||||
|
args = { "--ignore", "E741" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
3
lua/configs/telescope/commands.lua
Normal file
3
lua/configs/telescope/commands.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
return {
|
||||||
|
{ "Replace {{X}} with {{ X }} in jinja template", "%s/{{\\(.[^ ]*\\)}}/{{ \\1 }}/g" },
|
||||||
|
}
|
||||||
108
lua/configs/telescope/custom.lua
Normal file
108
lua/configs/telescope/custom.lua
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
-- Implement delta as previewer for diffs
|
||||||
|
|
||||||
|
local previewers = require "telescope.previewers"
|
||||||
|
local builtin = require "telescope.builtin"
|
||||||
|
local pickers = require "telescope.pickers"
|
||||||
|
local finders = require "telescope.finders"
|
||||||
|
local actions = require "telescope.actions"
|
||||||
|
local action_state = require "telescope.actions.state"
|
||||||
|
local conf = require("telescope.config").values
|
||||||
|
|
||||||
|
local E = {}
|
||||||
|
|
||||||
|
local delta = previewers.new_termopen_previewer {
|
||||||
|
get_command = function(entry)
|
||||||
|
-- this is for status
|
||||||
|
-- You can get the AM things in entry.status. So we are displaying file if entry.status == '??' or 'A '
|
||||||
|
-- just do an if and return a different command
|
||||||
|
if entry.status == "??" or "A " then
|
||||||
|
return { "git", "-c", "core.pager=delta", "-c", "delta.side-by-side=false", "diff", entry.value }
|
||||||
|
end
|
||||||
|
|
||||||
|
-- note we can't use pipes
|
||||||
|
-- this command is for git_commits and git_bcommits
|
||||||
|
return { "git", "-c", "core.pager=delta", "-c", "delta.side-by-side=false", "diff", entry.value .. "^!" }
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
E.my_git_commits = function(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.previewer = delta
|
||||||
|
|
||||||
|
builtin.git_commits(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
E.my_git_bcommits = function(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.previewer = delta
|
||||||
|
|
||||||
|
builtin.git_bcommits(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
E.my_git_status = function(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.previewer = delta
|
||||||
|
|
||||||
|
builtin.git_status(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
E.my_git_branches = function(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.previewer = delta
|
||||||
|
|
||||||
|
builtin.git_branches(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
E.project_files = function()
|
||||||
|
local opts = {} -- define here if you want to define something
|
||||||
|
vim.fn.system "git rev-parse --is-inside-work-tree"
|
||||||
|
if vim.v.shell_error == 0 then
|
||||||
|
require("telescope.builtin").git_files(opts)
|
||||||
|
else
|
||||||
|
require("telescope.builtin").find_files(opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local custom_commands = require "configs.telescope.commands"
|
||||||
|
|
||||||
|
E.cpickers = function(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
pickers
|
||||||
|
.new(opts, {
|
||||||
|
prompt_title = "Commands",
|
||||||
|
|
||||||
|
finder = finders.new_table {
|
||||||
|
results = custom_commands,
|
||||||
|
entry_maker = function(entry)
|
||||||
|
return {
|
||||||
|
value = entry,
|
||||||
|
display = entry[1],
|
||||||
|
ordinal = entry[2],
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
previewer = previewers.new_buffer_previewer {
|
||||||
|
title = "Custom commands preview",
|
||||||
|
define_preview = function(self, entry, _)
|
||||||
|
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, {
|
||||||
|
entry["ordinal"],
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
attach_mappings = function(prompt_bufnr, _)
|
||||||
|
actions.select_default:replace(function()
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
local selection = action_state.get_selected_entry()
|
||||||
|
vim.cmd(selection.ordinal)
|
||||||
|
end)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
sorter = conf.generic_sorter(opts),
|
||||||
|
})
|
||||||
|
:find()
|
||||||
|
end
|
||||||
|
|
||||||
|
return E
|
||||||
351
lua/configs/telescope/init.lua
Normal file
351
lua/configs/telescope/init.lua
Normal file
@ -0,0 +1,351 @@
|
|||||||
|
local custom_actions = {}
|
||||||
|
local actions = require "telescope.actions"
|
||||||
|
local lga_actions = require "telescope-live-grep-args.actions"
|
||||||
|
local action_state = require "telescope.actions.state"
|
||||||
|
local from_entry = require "telescope.from_entry"
|
||||||
|
local scan = require "plenary.scandir"
|
||||||
|
local pickers = require "telescope.pickers"
|
||||||
|
local finders = require "telescope.finders"
|
||||||
|
local make_entry = require "telescope.make_entry"
|
||||||
|
local action_set = require "telescope.actions.set"
|
||||||
|
local conf = require("telescope.config").values
|
||||||
|
local builtin = require "telescope.builtin"
|
||||||
|
|
||||||
|
-- Usefull:
|
||||||
|
-- [[
|
||||||
|
-- https://github.com/JoosepAlviste/dotfiles/blob/master/config/nvim/lua/j/telescope_custom_pickers.lua
|
||||||
|
-- ]]
|
||||||
|
|
||||||
|
local entry_to_qf = function(entry)
|
||||||
|
local text = entry.text
|
||||||
|
|
||||||
|
if not text then
|
||||||
|
if type(entry.value) == "table" then
|
||||||
|
text = entry.value.text
|
||||||
|
else
|
||||||
|
text = entry.value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
bufnr = entry.bufnr,
|
||||||
|
filename = from_entry.path(entry, false, false),
|
||||||
|
lnum = vim.F.if_nil(entry.lnum, 1),
|
||||||
|
col = vim.F.if_nil(entry.col, 1),
|
||||||
|
text = text,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local send_selected_to_list_without_closing_prompt = function(prompt_bufnr, mode, target)
|
||||||
|
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||||
|
|
||||||
|
local qf_entries = {}
|
||||||
|
for _, entry in ipairs(picker:get_multi_selection()) do
|
||||||
|
table.insert(qf_entries, entry_to_qf(entry))
|
||||||
|
end
|
||||||
|
|
||||||
|
local prompt = picker:_get_prompt()
|
||||||
|
-- actions.close(prompt_bufnr)
|
||||||
|
|
||||||
|
vim.api.nvim_exec_autocmds("QuickFixCmdPre", {})
|
||||||
|
if target == "loclist" then
|
||||||
|
vim.fn.setloclist(picker.original_win_id, qf_entries, mode)
|
||||||
|
else
|
||||||
|
local qf_title = string.format([[%s (%s)]], picker.prompt_title, prompt)
|
||||||
|
vim.fn.setqflist(qf_entries, mode)
|
||||||
|
vim.fn.setqflist({}, "a", { title = qf_title })
|
||||||
|
end
|
||||||
|
vim.api.nvim_exec_autocmds("QuickFixCmdPost", {})
|
||||||
|
end
|
||||||
|
|
||||||
|
function custom_actions._multiopen(prompt_bufnr, cmd, cmd2, mode, list)
|
||||||
|
-- actions.send_selected_to_loclist(prompt_bufnr)
|
||||||
|
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||||
|
local multi = picker:get_multi_selection()
|
||||||
|
local single = picker:get_selection()
|
||||||
|
|
||||||
|
local str = ""
|
||||||
|
|
||||||
|
if #multi > 0 then
|
||||||
|
send_selected_to_list_without_closing_prompt(prompt_bufnr, mode, list)
|
||||||
|
|
||||||
|
for i, j in ipairs(multi) do
|
||||||
|
if i % 2 == 1 then
|
||||||
|
str = str .. cmd .. " " .. j[1] .. " | "
|
||||||
|
else
|
||||||
|
str = str .. cmd2 .. " " .. j[1] .. " | "
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
str = cmd .. " " .. single[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- To avoid populating qf or doing ":edit! file", close the prompt first
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
vim.api.nvim_command(str)
|
||||||
|
end
|
||||||
|
|
||||||
|
function custom_actions.multi_selection_open(prompt_bufnr)
|
||||||
|
return custom_actions._multiopen(prompt_bufnr, "edit", "edit", "a", "loclist")
|
||||||
|
end
|
||||||
|
|
||||||
|
function custom_actions.multi_selection_vsplit(prompt_bufnr)
|
||||||
|
return custom_actions._multiopen(prompt_bufnr, "vsplit", "split", "a", "loclist")
|
||||||
|
end
|
||||||
|
|
||||||
|
function custom_actions.multi_selection_split(prompt_bufnr)
|
||||||
|
return custom_actions._multiopen(prompt_bufnr, "split", "vsplit", "a", "loclist")
|
||||||
|
end
|
||||||
|
|
||||||
|
function custom_actions.multi_selection_vtab(prompt_bufnr)
|
||||||
|
return custom_actions._multiopen(prompt_bufnr, "tabe", "tabe", "a", "loclist")
|
||||||
|
end
|
||||||
|
|
||||||
|
function custom_actions.set_extension(prompt_bufnr)
|
||||||
|
local current_input = action_state.get_current_line()
|
||||||
|
|
||||||
|
vim.ui.input({ prompt = "Search in extension: *." }, function(input)
|
||||||
|
if input == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Close and reopen a prompt with the same input
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
builtin.live_grep { default_text = current_input, type_filter = input }
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function custom_actions.to_live_grep_args(prompt_bufnr)
|
||||||
|
local current_input = action_state.get_current_line()
|
||||||
|
|
||||||
|
-- Close and reopen a prompt with live_grep_args
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
require("telescope").extensions.live_grep_args.live_grep_args { default_text = current_input }
|
||||||
|
end
|
||||||
|
|
||||||
|
function custom_actions.set_folders(prompt_bufnr)
|
||||||
|
local current_input = action_state.get_current_line()
|
||||||
|
|
||||||
|
local data = {}
|
||||||
|
scan.scan_dir(vim.loop.cwd(), {
|
||||||
|
hidden = true,
|
||||||
|
only_dirs = true,
|
||||||
|
respect_gitignore = true,
|
||||||
|
on_insert = function(entry)
|
||||||
|
table.insert(data, entry .. "/")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
table.insert(data, 1, "./")
|
||||||
|
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
-- Create a new picker with Telescope to select folders we want to filter in
|
||||||
|
pickers
|
||||||
|
.new({
|
||||||
|
prompt_title = 'Select folders for current ("' .. current_input .. '") search',
|
||||||
|
finder = finders.new_table { results = data, entry_maker = make_entry.gen_from_file {} },
|
||||||
|
previewer = conf.file_previewer {},
|
||||||
|
sorter = conf.file_sorter {},
|
||||||
|
attach_mappings = function(prompt_bufnr2)
|
||||||
|
action_set.select:replace(function()
|
||||||
|
local current_picker = action_state.get_current_picker(prompt_bufnr2)
|
||||||
|
|
||||||
|
local dirs = {}
|
||||||
|
local selections = current_picker:get_multi_selection()
|
||||||
|
if vim.tbl_isempty(selections) then
|
||||||
|
table.insert(dirs, action_state.get_selected_entry().value)
|
||||||
|
else
|
||||||
|
for _, selection in ipairs(selections) do
|
||||||
|
table.insert(dirs, selection.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
actions.close(prompt_bufnr2)
|
||||||
|
builtin.live_grep { default_text = current_input, search_dirs = dirs }
|
||||||
|
end)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
:find()
|
||||||
|
end
|
||||||
|
|
||||||
|
function custom_actions.set_files(prompt_bufnr)
|
||||||
|
local current_input = action_state.get_current_line()
|
||||||
|
local find_command = { "rg", "--files", "--color=never", "--no-heading" }
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
if current_input ~= "" then
|
||||||
|
find_command = { "rg", "--color=never", "--no-heading", "-l", current_input }
|
||||||
|
end
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
entry_maker = make_entry.gen_from_file(),
|
||||||
|
find_command = find_command,
|
||||||
|
}
|
||||||
|
|
||||||
|
print(vim.inspect(find_command))
|
||||||
|
-- Create a new picker with Telescope to select files we want to filter in
|
||||||
|
pickers
|
||||||
|
.new(opts, {
|
||||||
|
prompt_title = 'Select files for current ("' .. current_input .. '") search',
|
||||||
|
__locations_input = true,
|
||||||
|
finder = finders.new_oneshot_job(find_command, opts),
|
||||||
|
previewer = conf.grep_previewer(opts),
|
||||||
|
sorter = conf.file_sorter(opts),
|
||||||
|
attach_mappings = function(prompt_bufnr2)
|
||||||
|
actions.select_default:replace(function()
|
||||||
|
local current_picker = action_state.get_current_picker(prompt_bufnr2)
|
||||||
|
|
||||||
|
local files = {}
|
||||||
|
local selections = current_picker:get_multi_selection()
|
||||||
|
if vim.tbl_isempty(selections) then
|
||||||
|
local entry = action_state.get_selected_entry()
|
||||||
|
table.insert(files, entry.value)
|
||||||
|
else
|
||||||
|
for _, selection in ipairs(selections) do
|
||||||
|
table.insert(files, selection.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Close the preview picker and select a new one, restricted to the files selected
|
||||||
|
actions.close(prompt_bufnr2)
|
||||||
|
builtin.live_grep { default_text = current_input, search_dirs = files }
|
||||||
|
end)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
:find()
|
||||||
|
end
|
||||||
|
|
||||||
|
local options = {
|
||||||
|
defaults = {
|
||||||
|
vimgrep_arguments = {
|
||||||
|
"rg",
|
||||||
|
"-L",
|
||||||
|
"--color=never",
|
||||||
|
"--no-heading",
|
||||||
|
"--with-filename",
|
||||||
|
"--line-number",
|
||||||
|
"--column",
|
||||||
|
"--smart-case",
|
||||||
|
},
|
||||||
|
prompt_prefix = " ",
|
||||||
|
selection_caret = " ",
|
||||||
|
entry_prefix = " ",
|
||||||
|
initial_mode = "insert",
|
||||||
|
selection_strategy = "reset",
|
||||||
|
sorting_strategy = "ascending",
|
||||||
|
layout_strategy = "horizontal",
|
||||||
|
layout_config = {
|
||||||
|
horizontal = {
|
||||||
|
prompt_position = "top",
|
||||||
|
preview_width = 0.60,
|
||||||
|
results_width = 0.8,
|
||||||
|
},
|
||||||
|
vertical = {
|
||||||
|
mirror = false,
|
||||||
|
},
|
||||||
|
width = 0.90,
|
||||||
|
height = 0.92,
|
||||||
|
preview_cutoff = 200,
|
||||||
|
},
|
||||||
|
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||||
|
file_ignore_patterns = { "node_modules" },
|
||||||
|
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||||
|
path_display = { "truncate" },
|
||||||
|
winblend = 0,
|
||||||
|
border = {},
|
||||||
|
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||||
|
color_devicons = true,
|
||||||
|
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
|
||||||
|
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||||
|
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||||
|
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||||
|
-- Developer configurations: Not meant for general override
|
||||||
|
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||||
|
mappings = {
|
||||||
|
n = { ["q"] = actions.close },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
buffers = {
|
||||||
|
show_all_buffers = true,
|
||||||
|
sort_lastused = true,
|
||||||
|
mappings = {
|
||||||
|
n = {
|
||||||
|
["d"] = "delete_buffer",
|
||||||
|
},
|
||||||
|
i = {
|
||||||
|
["<C-d>"] = "delete_buffer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
find_files = {
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
-- Fuzzy refine ("Freeze the current list and start a fuzzy search in the frozen list")
|
||||||
|
["<C-i>"] = actions.to_fuzzy_refine,
|
||||||
|
|
||||||
|
-- Send to qflist or loclist
|
||||||
|
["<C-l>"] = actions.smart_send_to_loclist,
|
||||||
|
["<C-Space>"] = actions.smart_send_to_qflist,
|
||||||
|
|
||||||
|
-- Multi selection open
|
||||||
|
["<CR>"] = custom_actions.multi_selection_open,
|
||||||
|
["<C-v>"] = custom_actions.multi_selection_vsplit,
|
||||||
|
["<C-X>"] = custom_actions.multi_selection_split,
|
||||||
|
["<C-T>"] = custom_actions.multi_selection_tab,
|
||||||
|
},
|
||||||
|
n = i,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
live_grep = {
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
-- Fuzzy refine ("Freeze the current list and start a fuzzy search in the frozen list")
|
||||||
|
["<C-i>"] = actions.to_fuzzy_refine,
|
||||||
|
|
||||||
|
-- Send to qflist or loclist
|
||||||
|
["<C-l>"] = actions.smart_send_to_loclist,
|
||||||
|
["<C-Space>"] = actions.smart_send_to_qflist,
|
||||||
|
|
||||||
|
-- To quote prompt -> Pass to live_grep_args
|
||||||
|
["<C-k>"] = custom_actions.to_live_grep_args,
|
||||||
|
|
||||||
|
-- Search for files/folder/extensions
|
||||||
|
["<C-f>"] = custom_actions.set_files,
|
||||||
|
["<C-g>"] = custom_actions.set_folders,
|
||||||
|
["<C-e>"] = custom_actions.set_extension,
|
||||||
|
},
|
||||||
|
n = i,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
extensions_list = { "themes", "terms", "fzf", "macrothis", "live_grep_args", "advanced_git_search" },
|
||||||
|
extensions = {
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true,
|
||||||
|
override_generic_sorter = true,
|
||||||
|
override_file_sorter = true,
|
||||||
|
case_mode = "smart_case",
|
||||||
|
},
|
||||||
|
live_grep_args = {
|
||||||
|
auto_quoting = true,
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
-- Fuzzy refine ("Freeze the current list and start a fuzzy search in the frozen list")
|
||||||
|
["<C-i>"] = actions.to_fuzzy_refine,
|
||||||
|
|
||||||
|
-- Send to qflist or loclist
|
||||||
|
["<C-l>"] = actions.smart_send_to_loclist,
|
||||||
|
["<C-Space>"] = actions.smart_send_to_qflist,
|
||||||
|
|
||||||
|
-- Quote prompt, for passing parameters to vimgrep
|
||||||
|
["<C-k>"] = lga_actions.quote_prompt(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
advanced_git_search = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
||||||
12
lua/configs/treesitter.lua
Normal file
12
lua/configs/treesitter.lua
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
local options = {
|
||||||
|
ensure_installed = { "lua", "vim", "vimdoc" },
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
use_languagetree = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
indent = { enable = true },
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
||||||
133
lua/configs/treesitter_textobjects.lua
Normal file
133
lua/configs/treesitter_textobjects.lua
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
-- Automatically jump forward to textobj, similar to targets.vim
|
||||||
|
lookahead = true,
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
-- You can use the capture groups defined in textobjects.scm
|
||||||
|
["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" },
|
||||||
|
["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" },
|
||||||
|
["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" },
|
||||||
|
["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" },
|
||||||
|
|
||||||
|
["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" },
|
||||||
|
["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" },
|
||||||
|
|
||||||
|
["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" },
|
||||||
|
["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" },
|
||||||
|
|
||||||
|
["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" },
|
||||||
|
["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" },
|
||||||
|
|
||||||
|
["af"] = { query = "@call.outer", desc = "Select outer part of a function call" },
|
||||||
|
["if"] = { query = "@call.inner", desc = "Select inner part of a function call" },
|
||||||
|
|
||||||
|
["am"] = { query = "@function.outer", desc = "Select outer part of a function def" },
|
||||||
|
["im"] = { query = "@function.inner", desc = "Select inner part of a function def" },
|
||||||
|
|
||||||
|
["ak"] = { query = "@class.outer", desc = "Select outer part of a class" },
|
||||||
|
["ik"] = { query = "@class.inner", desc = "Select inner part of a class" },
|
||||||
|
|
||||||
|
["ac"] = { query = "@comment.outer", desc = "Select outer part of a comment" },
|
||||||
|
["ic"] = { query = "@comment.inner", desc = "Select inner part of a comment" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
move = {
|
||||||
|
enable = true,
|
||||||
|
-- Whether to set jumps in the jumplist
|
||||||
|
set_jumps = true,
|
||||||
|
goto_next_start = {
|
||||||
|
["]a"] = { query = "@parameter.outer", desc = "Goto next start outer parameter" },
|
||||||
|
["]i"] = { query = "@conditional.outer", desc = "Goto next start outer conditional" },
|
||||||
|
["]l"] = { query = "@loop.outer", desc = "Goto next start outer loop" },
|
||||||
|
["]f"] = { query = "@call.outer", desc = "Goto next start outer call" },
|
||||||
|
["]m"] = { query = "@function.outer", desc = "Goto next start outer function" },
|
||||||
|
["]k"] = { query = "@class.outer", desc = "Goto next start outer class" },
|
||||||
|
["]c"] = { query = "@comment.outer", desc = "Goto next start outer comment" },
|
||||||
|
},
|
||||||
|
goto_next_end = {
|
||||||
|
["]A"] = { query = "@parameter.outer", desc = "Goto next end outer parameter" },
|
||||||
|
["]I"] = { query = "@conditional.outer", desc = "Goto next end outer conditional" },
|
||||||
|
["]L"] = { query = "@loop.outer", desc = "Goto next end outer loop" },
|
||||||
|
["]F"] = { query = "@call.outer", desc = "Goto next end outer call" },
|
||||||
|
["]M"] = { query = "@function.outer", desc = "Goto next end outer function" },
|
||||||
|
["]K"] = { query = "@class.outer", desc = "Goto next end outer class" },
|
||||||
|
["]C"] = { query = "@comment.outer", desc = "Goto next end outer comment" },
|
||||||
|
},
|
||||||
|
goto_previous_start = {
|
||||||
|
["[a"] = { query = "@parameter.outer", desc = "Goto previous start outer parameter" },
|
||||||
|
["[i"] = { query = "@conditional.outer", desc = "Goto previous start outer conditional" },
|
||||||
|
["[l"] = { query = "@loop.outer", desc = "Goto previous start outer loop" },
|
||||||
|
["[f"] = { query = "@call.outer", desc = "Goto previous start outer call" },
|
||||||
|
["[m"] = { query = "@function.outer", desc = "Goto previous start outer function" },
|
||||||
|
["[k"] = { query = "@class.outer", desc = "Goto previous start outer class" },
|
||||||
|
["[c"] = { query = "@comment.outer", desc = "Goto previous start outer comment" },
|
||||||
|
},
|
||||||
|
goto_previous_end = {
|
||||||
|
["[A"] = { query = "@parameter.outer", desc = "Goto previous end outer parameter" },
|
||||||
|
["[I"] = { query = "@conditional.outer", desc = "Goto previous end outer conditional" },
|
||||||
|
["[L"] = { query = "@loop.outer", desc = "Goto previous end outer loop" },
|
||||||
|
["[F"] = { query = "@call.outer", desc = "Goto previous end outer call" },
|
||||||
|
["[M"] = { query = "@function.outer", desc = "Goto previous end outer function" },
|
||||||
|
["[K"] = { query = "@class.outer", desc = "Goto previous end outer class" },
|
||||||
|
["[C"] = { query = "@comment.outer", desc = "Goto previous end outer comment" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
swap = {
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
swap_next = {
|
||||||
|
["<leader>na"] = { query = "@parameter.inner", desc = "Swap with next inner parameter" },
|
||||||
|
["<leader>ni"] = { query = "@conditional.outer", desc = "Swap with next outer conditional" },
|
||||||
|
["<leader>nl"] = { query = "@loop.outer", desc = "Swap with next outer loop" },
|
||||||
|
["<leader>nf"] = { query = "@call.outer", desc = "Swap with next outer call" },
|
||||||
|
["<leader>nm"] = { query = "@function.outer", desc = "Swap with next outer function" },
|
||||||
|
["<leader>nk"] = { query = "@class.outer", desc = "Swap with next outer class" },
|
||||||
|
["<leader>nc"] = { query = "@comment.outer", desc = "Swap with next outer comment" },
|
||||||
|
|
||||||
|
["<leader>nA"] = { query = "@parameter.outer", desc = "Swap with next outer parameter" },
|
||||||
|
["<leader>nI"] = { query = "@conditional.inner", desc = "Swap with next inner conditional" },
|
||||||
|
["<leader>nL"] = { query = "@loop.inner", desc = "Swap with next inner loop" },
|
||||||
|
["<leader>nF"] = { query = "@call.inner", desc = "Swap with next inner call" },
|
||||||
|
["<leader>nM"] = { query = "@function.inner", desc = "Swap with next inner function" },
|
||||||
|
["<leader>nK"] = { query = "@class.inner", desc = "Swap with next inner class" },
|
||||||
|
["<leader>nC"] = { query = "@comment.inner", desc = "Swap with next inner comment" },
|
||||||
|
},
|
||||||
|
swap_previous = {
|
||||||
|
["<leader>pa"] = { query = "@parameter.inner", desc = "Swap with previous inner parameter" },
|
||||||
|
["<leader>pi"] = { query = "@conditional.outer", desc = "Swap with previous outer conditional" },
|
||||||
|
["<leader>pl"] = { query = "@loop.outer", desc = "Swap with previous outer loop" },
|
||||||
|
["<leader>pf"] = { query = "@call.outer", desc = "Swap with previous outer call" },
|
||||||
|
["<leader>pm"] = { query = "@function.outer", desc = "Swap with previous outer function" },
|
||||||
|
["<leader>pk"] = { query = "@class.outer", desc = "Swap with previous outer class" },
|
||||||
|
["<leader>pc"] = { query = "@comment.outer", desc = "Swap with previous outer comment" },
|
||||||
|
|
||||||
|
["<leader>pA"] = { query = "@parameter.outer", desc = "Swap with previous outer parameter" },
|
||||||
|
["<leader>pI"] = { query = "@conditional.inner", desc = "Swap with previous inner conditional" },
|
||||||
|
["<leader>pL"] = { query = "@loop.inner", desc = "Swap with previous inner loop" },
|
||||||
|
["<leader>pF"] = { query = "@call.inner", desc = "Swap with previous inner call" },
|
||||||
|
["<leader>pM"] = { query = "@function.inner", desc = "Swap with previous inner function" },
|
||||||
|
["<leader>pK"] = { query = "@class.inner", desc = "Swap with previous inner class" },
|
||||||
|
["<leader>pC"] = { query = "@comment.inner", desc = "Swap with previous inner comment" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move"
|
||||||
|
|
||||||
|
-- Repeat movement with ; and ,
|
||||||
|
-- vim.keymap.set({"n", "x", "o"}, ",", ts_repeat_move.repeat_last_move_next)
|
||||||
|
-- vim.keymap.set({"n", "x", "o"}, ",", ts_repeat_move.repeat_last_move_previous)
|
||||||
|
|
||||||
|
-- Optionnally, make builtin f, F, t, T also repeatable with ; and ,
|
||||||
|
-- vim.keymap.set({"n", "x", "o"}, "f", ts_repeat_move.builtin_f)
|
||||||
|
-- vim.keymap.set({"n", "x", "o"}, "F", ts_repeat_move.builtin_F)
|
||||||
|
-- vim.keymap.set({"n", "x", "o"}, "t", ts_repeat_move.builtin_t)
|
||||||
|
-- vim.keymap.set({"n", "x", "o"}, "T", ts_repeat_move.builtin_T)
|
||||||
|
|
||||||
|
return M
|
||||||
477
lua/mappings.lua
Normal file
477
lua/mappings.lua
Normal file
@ -0,0 +1,477 @@
|
|||||||
|
local map = vim.keymap.set
|
||||||
|
|
||||||
|
map("n", ";", ":", { desc = "CMD enter command mode" })
|
||||||
|
map("i", "jk", "<ESC>")
|
||||||
|
|
||||||
|
map("n", "<A-f>", ":Telescope resume <CR>", { desc = "Telescope resume" })
|
||||||
|
map("n", "<A-k>", ":Telescope keymaps <CR>", { desc = "Show (and search) all [k]eymaps" })
|
||||||
|
|
||||||
|
map("n", "<C-g>", ":Telescope find_files <CR>", { desc = "Find files" })
|
||||||
|
map("n", "<C-x>", ":Telescope find_files follow=true no_ignore=true hidden=true <CR>", { desc = "Find all files" })
|
||||||
|
map("n", "<C-f>", ":Telescope live_grep <CR>", { desc = "Live grep" })
|
||||||
|
map("n", "<C-b>", ":Telescope buffers <CR>", { desc = "Find buffers" })
|
||||||
|
map("n", "<leader>/<CR>", ":Telescope search_history <CR>", { desc = "Search history" })
|
||||||
|
map("n", "<leader>//", ":noh<CR>", { desc = "Clear highlights" })
|
||||||
|
|
||||||
|
-- go to beginning and end
|
||||||
|
map("i", "<C-b>", "<ESC>^i", { desc = "Beginning of line" })
|
||||||
|
map("i", "<C-e>", "<End>", { desc = "End of line" })
|
||||||
|
|
||||||
|
-- navigate within insert mode
|
||||||
|
map("i", "<C-h>", "<Left>", { desc = "Move left" })
|
||||||
|
map("i", "<C-l>", "<Right>", { desc = "Move right" })
|
||||||
|
map("i", "<C-j>", "<Down>", { desc = "Move down" })
|
||||||
|
map("i", "<C-k>", "<Up>", { desc = "Move up" })
|
||||||
|
|
||||||
|
map("n", "<C-s>", "<cmd> w <CR>", { desc = "Save file" })
|
||||||
|
|
||||||
|
map("n", "<leader>rr", ":source $MYVIMRC<CR>", { desc = "Reload config file" })
|
||||||
|
map("n", "<Esc>", "<cmd> noh <CR>", { desc = "Clear highlights" })
|
||||||
|
-- switch between windows
|
||||||
|
map("n", "<C-h>", "<C-w>h", { desc = "Window left" })
|
||||||
|
map("n", "<C-l>", "<C-w>l", { desc = "Window right" })
|
||||||
|
map("n", "<C-j>", "<C-w>j", { desc = "Window down" })
|
||||||
|
map("n", "<C-k>", "<C-w>k", { desc = "Window up" })
|
||||||
|
|
||||||
|
-- ["<C-d>"] = { "<cmd> tab Git diff %<CR>", "Git diff this file" },
|
||||||
|
map("n", "<C-d>", "<cmd> DiffviewOpen -- %<CR>", { desc = "Git diff this file" })
|
||||||
|
map("n", "<C-o>", "<cmd> DiffviewFileHistory %<CR>", { desc = "Git history diff this file" })
|
||||||
|
map("n", "<C-a-d>", "<cmd> DiffviewClose<CR>", { desc = "Close git diff" })
|
||||||
|
-- ["<C-p>"] = { "<cmd> tab Git diff<CR>", "Git diff global" },
|
||||||
|
map("n", "<C-p>", "<cmd> DiffviewOpen<CR>", { desc = "Git diff global" })
|
||||||
|
map("n", "<a-p>", ":DiffviewOpen HEAD~", { desc = "Show last N commits" })
|
||||||
|
map("n", "<leader>gd", "<cmd> DiffviewClose<CR>", { desc = "Git diff close" })
|
||||||
|
|
||||||
|
-- save
|
||||||
|
map("n", "<C-s>", "<cmd> w <CR>", { desc = "Save file" })
|
||||||
|
-- Quit
|
||||||
|
map("n", "<C-q>", "<cmd> q! <CR>", { desc = "Force quit window" })
|
||||||
|
|
||||||
|
-- line numbers
|
||||||
|
-- map("n", "<leader>n", "<cmd> set nu! <CR>", { desc = "Toggle line number" })
|
||||||
|
-- map("n", "<leader>rn", "<cmd> set rnu! <CR>", { desc = "Toggle relative number" })
|
||||||
|
|
||||||
|
-- Movement
|
||||||
|
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
||||||
|
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||||
|
-- empty mode is same as using <cmd> :map
|
||||||
|
-- also don't use gmap("n", j|k,n in operator pending mode, {desc = so it doesn't alter d, y or c behaviou)
|
||||||
|
-- map("n", "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { desc = "Move down", opts = { expr = true } })
|
||||||
|
-- map("n", "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { desc = "Move up", opts = { expr = true } })
|
||||||
|
-- map("n", "<Up>", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { desc = "Move up", opts = { expr = true } })
|
||||||
|
-- map("n", "<Down>", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { desc = "Move down", opts = { expr = true } })
|
||||||
|
|
||||||
|
-- Copy/pasting into /tmp
|
||||||
|
-- map("n", "<leader>y", "<cmd> :w! /tmp/vimtmp<CR>", { desc = "Save into a global tmp file" })
|
||||||
|
-- map("n", "<leader>p", "<cmd> :r! cat /tmp/vimtmp<CR>", { desc = "Restore from the global tmp file" })
|
||||||
|
|
||||||
|
-- (Double) Trouble
|
||||||
|
map("n", "<leader>tx", ":Trouble diagnostics toggle<CR>", { desc = "[T]rouble diagnostics" })
|
||||||
|
map("n", "<leader>tX", ":Trouble diagnostics toggle filter.buf=0<CR>", { desc = "[T]rouble buffer diagnostics" })
|
||||||
|
map("n", "<leader>ts", ":Trouble symbols toggle focus=false<CR>", { desc = "[T]rouble [S]ymbols" })
|
||||||
|
map(
|
||||||
|
"n",
|
||||||
|
"<leader>tl",
|
||||||
|
":Trouble lsp toggle focus=false win.position=right<CR>",
|
||||||
|
{ desc = "[T]rouble [L]sp def / ref / ..." }
|
||||||
|
)
|
||||||
|
map("n", "<leader>tL", ":Trouble loclist toggle<CR>", { desc = "[T]rouble [L]oclist" })
|
||||||
|
map("n", "<leader>tQ", ":Trouble qflist toggle<CR>", { desc = "[T]rouble [Q]uickfix" })
|
||||||
|
|
||||||
|
-- DAP
|
||||||
|
map("n", "<leader>dgg", ":lua require('dap').continue() <CR>", { desc = "Continue debu[g]ging" })
|
||||||
|
map("n", "<leader>dg<CR>", ":lua require('dapui').toggle() <CR>", { desc = "Toggle DAP ui" })
|
||||||
|
map("n", "<leader>dgw", ":lua require('dapui').eval() <CR>", { desc = "Open floating windows about current [w]ord" })
|
||||||
|
map("n", "<leader>dgb", ":lua require('dap').toggle_breakpoint() <CR>", { desc = "Toggle [b]reakpoint" })
|
||||||
|
map("n", "<leader>dgf", ":lua require('dap-python').test_method() <CR>", { desc = "Debug [f]unction" })
|
||||||
|
map("n", "<leader>dgo", ":lua require('dap').step_over() <CR>", { desc = "DAP step [o]ver method" })
|
||||||
|
map("n", "<leader>dgt", ":lua require('dap').step_into() <CR>", { desc = "DAP step in[t]o method" })
|
||||||
|
map("n", "<leader>dgp", ":lua require('dap').step_back() <CR>", { desc = "DAP step back ([p]revious)" })
|
||||||
|
map("n", "<leader>dgs", function()
|
||||||
|
local widgets = require "dap.ui.widgets"
|
||||||
|
local sidebar = widgets.sidebar(widgets.scopes)
|
||||||
|
sidebar.open { widgth = "50%" }
|
||||||
|
end, { desc = "DAP Show debugged [s]copes" })
|
||||||
|
map("v", "<leader>dgd", ":lua require('dap-python').debug_selection()", { desc = "DAP debug selection" })
|
||||||
|
map("v", "<leader>dgw", ":lua require('dap-python').eval()", { desc = "DAP eval selection" })
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
map("n", "<leader>fm", function()
|
||||||
|
vim.lsp.buf.format { async = true }
|
||||||
|
end, { desc = "LSP formatting" })
|
||||||
|
|
||||||
|
map("t", "<C-x>", vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), { desc = "Escape terminal mode" })
|
||||||
|
|
||||||
|
-- Indentation
|
||||||
|
map("v", "<", "<gv", { desc = "Indent line" })
|
||||||
|
map("v", ">", ">gv", { desc = "Indent line" })
|
||||||
|
|
||||||
|
-- Don't copy the replaced text after pasting in visual mode
|
||||||
|
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#alternative_mapping_for_paste
|
||||||
|
map("x", "p", 'p:let @+=@0<CR>:let @"=@0<CR>', { desc = "Dont copy replaced text" })
|
||||||
|
|
||||||
|
map("n", "<Return>", "o<ESC>", { desc = "Insert new line below" })
|
||||||
|
map("n", "<BS>", "O<ESC>", { desc = "Insert new line above" })
|
||||||
|
|
||||||
|
-- Vim fugitive
|
||||||
|
map(
|
||||||
|
"n",
|
||||||
|
"<C-c>",
|
||||||
|
"<cmd> vertical topleft Git <bar> vertical resize 50<CR>",
|
||||||
|
{ desc = "Show Git status on a left pane" }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Fn shortcuts
|
||||||
|
map("n", "<F1>", "<cmd> tabprevious<CR>", { desc = "Previous tab" })
|
||||||
|
map("n", "<F2>", "<cmd> tabnext<CR>", { desc = "Next tab" })
|
||||||
|
map("n", "<F3>", "<cmd> Flog -all<CR>", { desc = "Show git tree" })
|
||||||
|
map("n", "<F4>", "<cmd> tab Git show -", { desc = "Git show N last commits" })
|
||||||
|
map("n", "<C-t>", "<cmd> TagbarToggle<CR>", { desc = "Show tagbar" })
|
||||||
|
map("n", "<leader>ra", "<cmd> call VrcQuery()<CR>", { desc = "Call REST endpoint" })
|
||||||
|
map("n", "<leader>dl", "0d$", { desc = "Delete line from start" })
|
||||||
|
|
||||||
|
-- Git stuffs
|
||||||
|
map("n", "<leader>gpu", "<cmd> Git pull<CR>", { desc = "Git pull" })
|
||||||
|
map("n", "<leader>gpf", ":Git push ", { desc = "Git push with option" })
|
||||||
|
map("n", "<leader>gmm", "<cmd> Git merge master<CR>", { desc = "Git merge master" })
|
||||||
|
map("n", "<leader>gmi", ":Git merge ", { desc = "Git merge ..." })
|
||||||
|
map(
|
||||||
|
"n",
|
||||||
|
"<leader>ga",
|
||||||
|
":Git commit -a --amend --no-edit --no-verify",
|
||||||
|
{ desc = "Git commit -a --amend --no-edit --no-verify" }
|
||||||
|
)
|
||||||
|
map("n", "<leader>gnb", ":Git checkout -b ", { desc = "Checkout to a new branch" })
|
||||||
|
map("n", "<leader>gri", ":Git rebase -i HEAD~", { desc = "Git rebase interactive from HEAD" })
|
||||||
|
map("n", "<leader>grm", ":Git rebase -i master", { desc = "Git rebase interactive from master" })
|
||||||
|
map("n", "<leader>grr", ":Git rebase -i ", { desc = "Git rebase interactive from <select>" })
|
||||||
|
|
||||||
|
-- Markdown
|
||||||
|
-- ["<leader>mkd"] = { "<cmd>lua vim.api.nvim_create_user_command('PeekOpen', require('peek').open, {})<CR>", "Open markdown preview" },
|
||||||
|
-- ["<leader>mkc"] = { "<cmd>lua vim.api.nvim_create_user_command('PeekClose', require('peek').close, {})<CR>", "Open markdown preview" },
|
||||||
|
|
||||||
|
-- Movement n + v
|
||||||
|
map("n", "n", "nzz", { desc = "Next + auto center" })
|
||||||
|
map("n", "N", "Nzz", { desc = "Previous + auto center" })
|
||||||
|
map("n", "(", "(zz", { desc = "Previous + auto center" })
|
||||||
|
map("n", ")", ")zz", { desc = "Previous + auto center" })
|
||||||
|
map("n", "{", "{zz", { desc = "Previous + auto center" })
|
||||||
|
map("n", "}", "}zz", { desc = "Previous + auto center" })
|
||||||
|
map("n", "[[", "[[zz", { desc = "Previous + auto center" })
|
||||||
|
map("n", "]]", "]]zz", { desc = "Previous + auto center" })
|
||||||
|
|
||||||
|
map("n", "<leader>ww", ":lua require('nvim-window').pick()<CR>", { desc = "Pick window to goto" })
|
||||||
|
map("n", "<leader>wm", ":WinShift<CR>", { desc = "Enter move window mode" })
|
||||||
|
map("n", "<leader>ws", ":WinShift swap<CR>", { desc = "Swap window, with selection" })
|
||||||
|
map("n", "<leader>gg", ":LazyGit<CR>", { desc = "Open lazygit" })
|
||||||
|
map("n", "gf", ":call search('[A-Z]', 'W')<CR>", { desc = "Go to next uppercase" })
|
||||||
|
map("n", "fg", ":call search('[A-Z]', 'bW')<CR>", { desc = "Go to last uppercase" })
|
||||||
|
map("n", "glb", ":lua require('gitlab').choose_merge_request()<CR>", { desc = "Gitlab: Choose merge request" })
|
||||||
|
map("n", "glr", ":lua require('gitlab').review()<CR>", { desc = "Gitlab: review" })
|
||||||
|
map("n", "gls", ":lua require('gitlab').summary()<CR>", { desc = "Gitlab: summary" })
|
||||||
|
map("n", "glo", ":lua require('gitlab').open_in_browser()<CR>", { desc = "Gitlab: open in browser" })
|
||||||
|
map("n", "glu", ":lua require('gitlab').copy_mr_url()<CR>", { desc = "Gitlab: open in browser" })
|
||||||
|
map("n", "glO", ":lua require('gitlab').create_mr()<CR>", { desc = "Gitlab: create MR" })
|
||||||
|
map("n", "glaa", ":lua require('gitlab').add_assignee()<CR>", { desc = "Gitlab: add_assignee" })
|
||||||
|
|
||||||
|
-- map("n", "glb", gitlab.choose_merge_request)
|
||||||
|
-- map("n", "glr", gitlab.review)
|
||||||
|
-- map("n", "gls", gitlab.summary)
|
||||||
|
-- map("n", "glA", gitlab.approve)
|
||||||
|
-- map("n", "glR", gitlab.revoke)
|
||||||
|
-- map("n", "glc", gitlab.create_comment)
|
||||||
|
-- map("v", "glc", gitlab.create_multiline_comment)
|
||||||
|
-- map("v", "glC", gitlab.create_comment_suggestion)
|
||||||
|
-- map("n", "glO", gitlab.create_mr)
|
||||||
|
-- map("n", "glm", gitlab.move_to_discussion_tree_from_diagnostic)
|
||||||
|
-- map("n", "gln", gitlab.create_note)
|
||||||
|
-- map("n", "gld", gitlab.toggle_discussions)
|
||||||
|
-- map("n", "glaa", gitlab.add_assignee)
|
||||||
|
-- map("n", "glad", gitlab.delete_assignee)
|
||||||
|
-- map("n", "glla", gitlab.add_label)
|
||||||
|
-- map("n", "glld", gitlab.delete_label)
|
||||||
|
-- map("n", "glra", gitlab.add_reviewer)
|
||||||
|
-- map("n", "glrd", gitlab.delete_reviewer)
|
||||||
|
-- map("n", "glp", gitlab.pipeline)
|
||||||
|
-- map("n", "glM", gitlab.merge)
|
||||||
|
-- map("n", "glu", gitlab.copy_mr_url)
|
||||||
|
-- map("n", "glP", gitlab.publish_all_drafts)
|
||||||
|
map(
|
||||||
|
"n",
|
||||||
|
"<leader>ct",
|
||||||
|
":call append(line('.') - 1, repeat(' ', indent('.')) . '# TODO: ' . input('Comment >'))<CR>",
|
||||||
|
{ desc = "Add TODO comment + add to qflist" }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Tabufline
|
||||||
|
-- cycle through buffers
|
||||||
|
map("n", "<tab>", function()
|
||||||
|
require("nvchad.tabufline").tabuflineNext()
|
||||||
|
end, { desc = "Goto next buffer" })
|
||||||
|
|
||||||
|
map("n", "<S-tab>", function()
|
||||||
|
require("nvchad.tabufline").tabuflinePrev()
|
||||||
|
end, { desc = "Goto prev buffer" })
|
||||||
|
|
||||||
|
-- close buffer + hide terminal buffer
|
||||||
|
-- map("n", "<leader>x", function()
|
||||||
|
-- require("nvchad.tabufline").close_buffer()
|
||||||
|
-- end, { desc = "Close buffer" })
|
||||||
|
|
||||||
|
-- Comment
|
||||||
|
map("n", "<leader>ci", function()
|
||||||
|
require("Comment.api").toggle.linewise.current()
|
||||||
|
end, { desc = "Toggle comment" })
|
||||||
|
|
||||||
|
map(
|
||||||
|
"v",
|
||||||
|
"<leader>ci",
|
||||||
|
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
|
||||||
|
{ desc = "Toggle comment" }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
map("n", "gD", vim.lsp.buf.declaration, { desc = "LSP declaration" })
|
||||||
|
map("n", "gd", vim.lsp.buf.definition, { desc = "LSP definition" })
|
||||||
|
map("n", "K", vim.lsp.buf.hover, { desc = "LSP hover" })
|
||||||
|
map("n", "gi", vim.lsp.buf.implementation, { desc = "LSP implementation" })
|
||||||
|
map("n", "<leader>ls", vim.lsp.buf.signature_help, { desc = "LSP signature help" })
|
||||||
|
map("n", "<leader>D", vim.lsp.buf.type_definition, { desc = "LSP definition type" })
|
||||||
|
--map("n", "<leader>ra", require("nvchad.renamer").open, { desc = "LSP rename" })
|
||||||
|
map("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "LSP code action" })
|
||||||
|
map("n", "gr", vim.lsp.buf.references, { desc = "LSP references" })
|
||||||
|
map("n", "<leader>lf", function()
|
||||||
|
vim.diagnostic.open_float { border = "rounded" }
|
||||||
|
end, { desc = "Floating diagnostic" })
|
||||||
|
|
||||||
|
map("n", "[d", function()
|
||||||
|
vim.diagnostic.goto_prev { float = { border = "rounded" } }
|
||||||
|
end, { desc = "Diagnostic previous" })
|
||||||
|
|
||||||
|
map("n", "]d", function()
|
||||||
|
vim.diagnostic.goto_next { float = { border = "rounded" } }
|
||||||
|
end, { desc = "Diagnostic previous" })
|
||||||
|
-- map("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Diagnostic set location list" })
|
||||||
|
|
||||||
|
-- LSP Workspace
|
||||||
|
map("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, { desc = "Add workspace folder" })
|
||||||
|
map("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, { desc = "Add workspace folder" })
|
||||||
|
map("n", "]d", function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, { desc = "List workspace folders" })
|
||||||
|
|
||||||
|
map("v", "<leader>ca", vim.lsp.buf.code_action, { desc = "LSP code action" })
|
||||||
|
|
||||||
|
-- Nvimtree toggle + focus
|
||||||
|
map("n", "<C-n>", "<cmd> NvimTreeToggle <CR>", { desc = "Toggle nvimtree" })
|
||||||
|
map("n", "<leader>e", "<cmd> NvimTreeFocus <CR>", { desc = "Focus nvimtree" })
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
map("n", "<A-f>", "<cmd> Telescope resume <CR>", { desc = "Resume" })
|
||||||
|
map("n", "<A-k>", "<cmd> Telescope keymaps <CR>", { desc = "Show (and search) all [k]eymaps" })
|
||||||
|
map("n", "<C-g>", "<cmd> Telescope find_files <CR>", { desc = "Find files" })
|
||||||
|
map("n", "<C-x>", "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", { desc = "Find all" })
|
||||||
|
map("n", "<C-f>", "<cmd> Telescope live_grep <CR>", { desc = "Live grep" })
|
||||||
|
map("n", "<C-b>", "<cmd> Telescope buffers <CR>", { desc = "Find buffers" })
|
||||||
|
|
||||||
|
map("n", "<leader>ff", function()
|
||||||
|
require("telescope.builtin").live_grep { default_text = "<<<<<<< HEAD" }
|
||||||
|
end, { desc = "Search for git conflicts" })
|
||||||
|
|
||||||
|
-- Live grep
|
||||||
|
map("n", "<leader>fg<CR>", function()
|
||||||
|
require("telescope.builtin").live_grep {}
|
||||||
|
end, { desc = "Live grep" })
|
||||||
|
|
||||||
|
map("n", "<leader>fg/", function()
|
||||||
|
require("telescope.builtin").live_grep { default_text = vim.fn.getreg "/" }
|
||||||
|
end, { desc = "Live grep with search term" })
|
||||||
|
|
||||||
|
map("n", "<leader>fgw", function()
|
||||||
|
require("telescope.builtin").live_grep { default_text = vim.fn.expand "<cword>" }
|
||||||
|
end, { desc = "Live grep with current word" })
|
||||||
|
|
||||||
|
-- Find files
|
||||||
|
map("n", "<leader>gf<CR>", function()
|
||||||
|
require("telescope.builtin").find_files {}
|
||||||
|
end, { desc = "Find files" })
|
||||||
|
|
||||||
|
map("n", "<leader>gf/", function()
|
||||||
|
require("telescope.builtin").find_files { default_text = vim.fn.getreg "/" }
|
||||||
|
end, { desc = "Find files with search term" })
|
||||||
|
|
||||||
|
map("n", "<leader>gfw", function()
|
||||||
|
require("telescope.builtin").find_files { default_text = vim.fn.expand "<cword>" }
|
||||||
|
end, { desc = "Find files with current word" })
|
||||||
|
|
||||||
|
-- Buffer replace
|
||||||
|
map("n", "<leader>br<CR>", function()
|
||||||
|
-- ":execute '%s/' . input('Search term >') . '/' . input('Replace by >', '') . '/g | update' <CR>",
|
||||||
|
end, { desc = "Replace pattern in current buffer" })
|
||||||
|
|
||||||
|
map("n", "<leader>br/", function()
|
||||||
|
-- ":execute '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >', '') . '/g | update' <CR>",
|
||||||
|
end, { desc = "Replace search term pattern in current buffer" })
|
||||||
|
|
||||||
|
map("n", "<leader>brw", function()
|
||||||
|
-- ":execute '%s/' . input('Search term >', expand('<cword>')) . '/' . input('Replace by >', '') . '/g | update' <CR>",
|
||||||
|
end, { desc = "Replace current word pattern in current buffer" })
|
||||||
|
|
||||||
|
-- Quickfix list
|
||||||
|
map("n", "<leader>ql", "<cmd> Telescope quickfix <CR>", { desc = "Show qflist" })
|
||||||
|
map("n", "<leader>qn", ":cnext<CR>", { desc = "Jump to next in qflist" })
|
||||||
|
map("n", "]q", ":cnext<CR>", { desc = "Jump to next in qflist" })
|
||||||
|
map("n", "<leader>qp", ":cprevious<CR>", { desc = "Jump to previous in qflist" })
|
||||||
|
map("n", "[q", ":cprevious<CR>", { desc = "Jump to previous in qflist" })
|
||||||
|
map("n", "<leader>qc", ":call setqflist([]) | cclose<CR>", { desc = "Clear qflist" })
|
||||||
|
|
||||||
|
-- Quickflix replace all
|
||||||
|
map("n", "<leader>qr<CR>", function()
|
||||||
|
-- ":execute 'cfdo' '%s/' . input('Search term >') . '/' . input('Replace by >') . '/gI | update' <CR>",
|
||||||
|
end, { desc = "Replace pattern in all qflist" })
|
||||||
|
map("n", "<leader>qr/", function()
|
||||||
|
-- ":execute 'cfdo' '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >') . '/gI | update' <CR>",
|
||||||
|
end, { desc = "Replace search term in all qflist" })
|
||||||
|
map("n", "<leader>qrw", function()
|
||||||
|
-- ":execute 'cfdo' '%s/' . input('Search term >', expand('<cword>')) . '/' . input('Replace by >') . '/gI | update' <CR>",
|
||||||
|
end, { desc = "Replace current work in all qflist" })
|
||||||
|
|
||||||
|
-- Quickfix "search"
|
||||||
|
map("n", "<leader>qs<CR>", function()
|
||||||
|
-- ":execute 'vimgrep' '/' . input('Pattern >') . '\\C/' '**/*' <CR>"
|
||||||
|
end, { desc = "Add <> files in qflist" })
|
||||||
|
|
||||||
|
map("n", "<leader>qs/", function()
|
||||||
|
-- ":execute 'vimgrep' '/' . input('Pattern >', getreg('/')) . '\\C/' '**/*' <CR>",
|
||||||
|
end, { desc = "Add search term files in qflist" })
|
||||||
|
|
||||||
|
map("n", "<leader>qsw", function()
|
||||||
|
-- ":execute 'vimgrep' '/' . input('Pattern >', expand('<cword>')) . '\\C/' '**/*' <CR>",
|
||||||
|
end, { desc = "Add current work files in qflist" })
|
||||||
|
|
||||||
|
-- Location list (loclist)
|
||||||
|
map("n", "<leader>ll", "<cmd> Telescope loclist <CR>", { desc = "Show loclist" })
|
||||||
|
map("n", "<leader>ln", ":lnext<CR>", { desc = "Jump to next in loclist" })
|
||||||
|
map("n", "]l", ":lnext<CR>", { desc = "Jump to next in loclist" })
|
||||||
|
map("n", "<leader>lp", ":lprevious<CR>", { desc = "Jump to previous in loclist" })
|
||||||
|
map("n", "[l", ":lprevious<CR>", { desc = "Jump to previous in loclist" })
|
||||||
|
map("n", "<leader>lc", ":call setloclist([]) | lclose<CR>", { desc = "Clear loclist" })
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
map("n", "<leader>fh", "<cmd> Telescope help_tags <CR>", { desc = "Help page" })
|
||||||
|
map("n", "<leader>fo", "<cmd> Telescope oldfiles <CR>", { desc = "Find oldfiles" })
|
||||||
|
map("n", "<leader>fx<CR>", function()
|
||||||
|
require("telescope.builtin").current_buffer_fuzzy_find {}
|
||||||
|
end, { desc = "Fuzzy find in current buffer" })
|
||||||
|
|
||||||
|
map("n", "<leader>fx/", function()
|
||||||
|
require("telescope.builtin").current_buffer_fuzzy_find { default_text = vim.fn.getreg "/" }
|
||||||
|
end, { desc = "Fuzzy find in current buffer with search term" })
|
||||||
|
|
||||||
|
map("n", "<leader>fxw", function()
|
||||||
|
require("telescope.builtin").current_buffer_fuzzy_find { default_text = vim.fn.expand "<cword>" }
|
||||||
|
end, { desc = "Fuzzy find in current buffer with current work" })
|
||||||
|
|
||||||
|
map("n", "<leader>wl", "<cmd> Telescope workspaces <CR>", { desc = "Find workspaces" })
|
||||||
|
map("n", "<leader>gm", function()
|
||||||
|
require("configs.telescope.custom").cpickers()
|
||||||
|
end, { desc = "Commonly used commands" })
|
||||||
|
|
||||||
|
-- Git
|
||||||
|
map("n", "<leader>gc", function()
|
||||||
|
require("configs.telescope.custom").my_git_commits()
|
||||||
|
end, { desc = "Custom Git commits" })
|
||||||
|
map("n", "<leader>gss", function()
|
||||||
|
require("configs.telescope.custom").my_git_status()
|
||||||
|
end, { desc = "Custom Git status" })
|
||||||
|
map("n", "<leader>gsh", "<cmd> Telescope git_stash <CR>", { desc = "Git stash" })
|
||||||
|
map("n", "<leader>gbb", "<cmd> Telescope git_branches <CR>", { desc = "Git branches" })
|
||||||
|
map("n", "<leader>gbc", function()
|
||||||
|
require("configs.telescope.custom").my_git_bcommits()
|
||||||
|
end, { desc = "Custom Git branchs commits" })
|
||||||
|
|
||||||
|
-- Telescope hidden term
|
||||||
|
map("n", "<leader>pt", "<cmd> Telescope terms <CR>", { desc = "Telescope pick hidden term" })
|
||||||
|
-- Marks
|
||||||
|
map("n", "<leader>ma", "<cmd> Telescope marks <CR>", { desc = "Telescope marks" })
|
||||||
|
|
||||||
|
-- Telescope history
|
||||||
|
map("n", "<leader>ch", "<cmd> Telescope command_history <CR>", { desc = "telescope commands history" })
|
||||||
|
map("n", "<leader>/", "<cmd> Telescope search_history <CR>", { desc = "telescope search history" })
|
||||||
|
|
||||||
|
-- Diaglist: LSP diagnostics in quick/loc list
|
||||||
|
map("n", "<leader>dw", function()
|
||||||
|
require("diaglist").open_all_diagnostics()
|
||||||
|
end, { desc = "Open all open buffers diagnostics in qflist" })
|
||||||
|
|
||||||
|
map("n", "<leader>d0", function()
|
||||||
|
require("diaglist").open_buffer_diagnostics()
|
||||||
|
end, { desc = "Open current buffer diagnostics in qflist" })
|
||||||
|
|
||||||
|
map("n", "<leader>;", "<cmd> Telescope <CR>", { desc = "Open Telescope" })
|
||||||
|
|
||||||
|
-- Terminal
|
||||||
|
map({ "n", "t" }, "<A-i>", function()
|
||||||
|
require("nvterm.terminal").toggle "float"
|
||||||
|
end, { desc = "Toggle floating term" })
|
||||||
|
|
||||||
|
map({ "n", "t" }, "<A-h>", function()
|
||||||
|
require("nvterm.terminal").toggle "horizontal"
|
||||||
|
end, { desc = "Toggle horizontal term" })
|
||||||
|
|
||||||
|
map({ "n", "t" }, "<A-v>", function()
|
||||||
|
require("nvterm.terminal").toggle "vertical"
|
||||||
|
end, { desc = "Toggle vertical term" })
|
||||||
|
|
||||||
|
map("n", "<leader>h", function()
|
||||||
|
require("nvterm.terminal").new "horizontal"
|
||||||
|
end, { desc = "New horizontal term" })
|
||||||
|
|
||||||
|
map("n", "<leader>v", function()
|
||||||
|
require("nvterm.terminal").new "vertical"
|
||||||
|
end, { desc = "New vertical term" })
|
||||||
|
|
||||||
|
-- WhichKey
|
||||||
|
map("n", "<leader>wK", function()
|
||||||
|
vim.cmd "WhichKey"
|
||||||
|
end, { desc = "Which-key all keymaps" })
|
||||||
|
|
||||||
|
map("n", "<leader>wk", function()
|
||||||
|
vim.cmd "WhichKey"
|
||||||
|
local input = vim.fn.input "WhichKey: "
|
||||||
|
vim.cmd("WhichKey " .. input)
|
||||||
|
end, { desc = "Which-key query lookup" })
|
||||||
|
|
||||||
|
-- Git hunk
|
||||||
|
map("n", "]c", function()
|
||||||
|
if vim.wo.diff then
|
||||||
|
return "]c"
|
||||||
|
end
|
||||||
|
vim.schedule(function()
|
||||||
|
require("gitsigns").next_hunk()
|
||||||
|
end)
|
||||||
|
return "<Ignore>"
|
||||||
|
end, { desc = "Jump to next hunk" })
|
||||||
|
|
||||||
|
map("n", "[c", function()
|
||||||
|
if vim.wo.diff then
|
||||||
|
return "[c"
|
||||||
|
end
|
||||||
|
vim.schedule(function()
|
||||||
|
require("gitsigns").prev_hunk()
|
||||||
|
end)
|
||||||
|
return "<Ignore>"
|
||||||
|
end, { desc = "Jump to prev hunk" })
|
||||||
|
|
||||||
|
map("n", "<leader>rh", require("gitsigns").reset_hunk, { desc = "Git Reset hunk" })
|
||||||
|
map("n", "<leader>ph", require("gitsigns").preview_hunk, { desc = "Git Preview hunk" })
|
||||||
|
map("n", "<leader>bb", require("gitsigns").blame_line, { desc = "Git Blame line" })
|
||||||
|
map("n", "<leader>bd", require("gitsigns").toggle_deleted, { desc = "Git Toggle deleted" })
|
||||||
|
|
||||||
|
-- Override all delete/yank/paste to use the registers M by default
|
||||||
|
map({ "n", "v" }, "y", '"my', { desc = "Yank", remap = false })
|
||||||
|
map({ "n", "v" }, "p", '"mp', { desc = "Paste", remap = false })
|
||||||
|
map({ "n", "v" }, "d", '"md', { desc = "Delete", remap = false })
|
||||||
|
|
||||||
|
map({ "n", "v" }, "<leader>y", '"+y', { desc = "Yank into system register", remap = false })
|
||||||
|
map({ "n", "v" }, "<leader>p", '"+p', { desc = "Paste into system register", remap = false })
|
||||||
76
lua/options.lua
Normal file
76
lua/options.lua
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
require "nvchad.options"
|
||||||
|
|
||||||
|
-- add yours here!
|
||||||
|
|
||||||
|
-- local o = vim.o
|
||||||
|
-- o.cursorlineopt ='both' -- to enable cursorline!
|
||||||
|
|
||||||
|
local opt = vim.opt
|
||||||
|
local g = vim.g
|
||||||
|
|
||||||
|
------------------------------------- options ------------------------------------------
|
||||||
|
opt.laststatus = 3 -- global statusline
|
||||||
|
opt.showmode = false
|
||||||
|
|
||||||
|
opt.clipboard = "unnamedplus"
|
||||||
|
opt.cursorline = true
|
||||||
|
|
||||||
|
-- Indenting
|
||||||
|
opt.expandtab = true
|
||||||
|
opt.shiftwidth = 4
|
||||||
|
opt.smartindent = true
|
||||||
|
opt.tabstop = 4
|
||||||
|
opt.softtabstop = 4
|
||||||
|
|
||||||
|
opt.fillchars = { eob = " " }
|
||||||
|
opt.ignorecase = true
|
||||||
|
opt.smartcase = true
|
||||||
|
opt.mouse = "a"
|
||||||
|
|
||||||
|
-- Numbers
|
||||||
|
opt.number = true
|
||||||
|
opt.numberwidth = 2
|
||||||
|
opt.ruler = false
|
||||||
|
opt.relativenumber = true
|
||||||
|
|
||||||
|
-- disable nvim intro
|
||||||
|
opt.shortmess:append "sI"
|
||||||
|
|
||||||
|
opt.signcolumn = "yes"
|
||||||
|
opt.splitbelow = true
|
||||||
|
opt.splitright = true
|
||||||
|
opt.termguicolors = true
|
||||||
|
opt.timeoutlen = 400
|
||||||
|
opt.undofile = true
|
||||||
|
opt.scrolloff = 15
|
||||||
|
|
||||||
|
opt.wildignore:append "tags,Session.vim"
|
||||||
|
|
||||||
|
-- interval for writing swap file to disk, also used by gitsigns
|
||||||
|
opt.updatetime = 250
|
||||||
|
|
||||||
|
-- go to previous/next line with h,l,left arrow and right arrow
|
||||||
|
-- when cursor reaches end/beginning of line
|
||||||
|
opt.whichwrap:append "<>[]hl"
|
||||||
|
|
||||||
|
g.mapleader = " "
|
||||||
|
|
||||||
|
-- disable some default providers
|
||||||
|
for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
|
||||||
|
vim.g["loaded_" .. provider .. "_provider"] = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
-- add binaries installed by mason.nvim to path
|
||||||
|
local is_windows = vim.fn.has "win32" ~= 0
|
||||||
|
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
|
||||||
|
|
||||||
|
-------------------------------------- autocmds ------------------------------------------
|
||||||
|
local autocmd = vim.api.nvim_create_autocmd
|
||||||
|
|
||||||
|
-- dont list quickfix buffers
|
||||||
|
autocmd("FileType", {
|
||||||
|
pattern = "qf",
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.buflisted = false
|
||||||
|
end,
|
||||||
|
})
|
||||||
560
lua/plugins/init.lua
Normal file
560
lua/plugins/init.lua
Normal file
@ -0,0 +1,560 @@
|
|||||||
|
return {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"rebelot/kanagawa.nvim",
|
||||||
|
{
|
||||||
|
"iamcco/markdown-preview.nvim",
|
||||||
|
run = "cd app && npm install",
|
||||||
|
lazy = false,
|
||||||
|
setup = function()
|
||||||
|
vim.g.mkdp_filetypes = { "markdown" }
|
||||||
|
end,
|
||||||
|
ft = { "markdown" },
|
||||||
|
},
|
||||||
|
{ "tpope/vim-fugitive", lazy = false },
|
||||||
|
{ "rbong/vim-flog", lazy = false },
|
||||||
|
{ "tpope/vim-surround", lazy = false },
|
||||||
|
{ "tpope/vim-obsession", lazy = false },
|
||||||
|
{ "preservim/tagbar", lazy = false },
|
||||||
|
{ "ludovicchabant/vim-gutentags", lazy = false },
|
||||||
|
{ "emaniacs/vim-rest-console", lazy = false },
|
||||||
|
{ "mfussenegger/nvim-dap", lazy = false },
|
||||||
|
{
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
dependencies = {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
"nvim-neotest/nvim-nio",
|
||||||
|
},
|
||||||
|
lazy = false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap-python",
|
||||||
|
dependencies = {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
},
|
||||||
|
lazy = false,
|
||||||
|
init = function()
|
||||||
|
require("dap-python").setup "python"
|
||||||
|
-- Setup nvim-dap-ui also
|
||||||
|
require("dapui").setup()
|
||||||
|
end,
|
||||||
|
config = function(_, _)
|
||||||
|
local dap = require "dap"
|
||||||
|
vim.api.nvim_set_hl(0, "dark-orange", { bg = "#402c16" })
|
||||||
|
vim.fn.sign_define("DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" })
|
||||||
|
vim.fn.sign_define("DapStopped", { text = "", texthl = "", linehl = "dark-orange", numhl = "" })
|
||||||
|
dap.defaults.fallback.terminal_win_cmd = "tabnew"
|
||||||
|
dap.defaults.fallback.focus_terminal = true
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Weissle/persistent-breakpoints.nvim",
|
||||||
|
lazy = false,
|
||||||
|
config = function(_, _)
|
||||||
|
require("persistent-breakpoints").setup {
|
||||||
|
load_breakpoints_event = { "BufReadPost" },
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{ "nvim-telescope/telescope-live-grep-args.nvim", lazy = false },
|
||||||
|
{ "nvim-telescope/telescope-dap.nvim", lazy = false },
|
||||||
|
-- {
|
||||||
|
-- "harrisoncramer/gitlab.nvim",
|
||||||
|
-- dependencies = {
|
||||||
|
-- "MunifTanjim/nui.nvim",
|
||||||
|
-- "nvim-lua/plenary.nvim",
|
||||||
|
-- "sindrets/diffview.nvim",
|
||||||
|
-- "stevearc/dressing.nvim", -- Recommended but not required. Better UI for pickers.
|
||||||
|
-- "nvim-tree/nvim-web-devicons", -- Recommended but not required. Icons in discussion tree.
|
||||||
|
-- },
|
||||||
|
-- enabled = true,
|
||||||
|
-- lazy = false,
|
||||||
|
-- build = function()
|
||||||
|
-- require("gitlab.server").build(true)
|
||||||
|
-- end, -- Builds the Go binary
|
||||||
|
-- opts = function()
|
||||||
|
-- return require "configs.gitlab"
|
||||||
|
-- end,
|
||||||
|
-- config = function(_, opts)
|
||||||
|
-- require("gitlab").setup(opts)
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
{
|
||||||
|
"sindrets/diffview.nvim",
|
||||||
|
lazy = false,
|
||||||
|
opts = function()
|
||||||
|
return require "configs.diffview"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"aaronhallaert/advanced-git-search.nvim",
|
||||||
|
cmd = { "AdvancedGitSearch" },
|
||||||
|
dependencies = {
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
-- to show diff splits and open commits in browser
|
||||||
|
"tpope/vim-fugitive",
|
||||||
|
-- to open commits in browser with fugitive
|
||||||
|
"tpope/vim-rhubarb",
|
||||||
|
-- optional: to replace the diff from fugitive with diffview.nvim
|
||||||
|
-- (fugitive is still needed to open in browser)
|
||||||
|
"sindrets/diffview.nvim",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||||
|
|
||||||
|
{
|
||||||
|
"stevearc/quicker.nvim",
|
||||||
|
opts = {},
|
||||||
|
init = function()
|
||||||
|
require("quicker").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"chentoast/marks.nvim",
|
||||||
|
lazy = false,
|
||||||
|
init = function()
|
||||||
|
require("marks").setup {
|
||||||
|
default_mappings = true,
|
||||||
|
signs = true,
|
||||||
|
mappings = {},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
opts = {},
|
||||||
|
init = function()
|
||||||
|
local conform = require "conform"
|
||||||
|
conform.setup {
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { "stylua" },
|
||||||
|
-- You can use a function here to determine the formatters dynamically
|
||||||
|
python = function(bufnr)
|
||||||
|
if conform.get_formatter_info("ruff_format", bufnr).available then
|
||||||
|
return { "isort", "black" }
|
||||||
|
-- return { "ruff_format" }
|
||||||
|
else
|
||||||
|
return { "isort", "black" }
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
},
|
||||||
|
options = {
|
||||||
|
lang_to_formatters = {
|
||||||
|
json = { "jq" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
format_on_save = {
|
||||||
|
timeout_ms = 1000,
|
||||||
|
lsp_format = "fallback",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
config = function(_, opts)
|
||||||
|
dofile(vim.g.base46_cache .. "devicons")
|
||||||
|
require("nvim-web-devicons").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
-- version = "2.20.7",
|
||||||
|
event = "User FilePost",
|
||||||
|
opts = function()
|
||||||
|
return require "configs.blankline"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
event = { "BufReadPost", "BufNewFile" },
|
||||||
|
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
|
||||||
|
build = ":TSUpdate",
|
||||||
|
opts = function()
|
||||||
|
return require "configs.treesitter"
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
dofile(vim.g.base46_cache .. "syntax")
|
||||||
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require("nvim-treesitter.configs").setup(require "configs.treesitter_textobjects")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- git stuff
|
||||||
|
{
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
event = "User FilePost",
|
||||||
|
opts = function()
|
||||||
|
return require "configs.gitsigns"
|
||||||
|
end,
|
||||||
|
-- config = function(_, opts)
|
||||||
|
-- dofile(vim.g.base46_cache .. "git")
|
||||||
|
-- require("gitsigns").setup(opts)
|
||||||
|
-- end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- lsp stuff
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" },
|
||||||
|
opts = function()
|
||||||
|
return require "configs.mason"
|
||||||
|
end,
|
||||||
|
-- config = function(_, opts)
|
||||||
|
-- dofile(vim.g.base46_cache .. "mason")
|
||||||
|
-- require("mason").setup(opts)
|
||||||
|
--
|
||||||
|
-- -- custom nvchad cmd to install all mason binaries listed
|
||||||
|
-- vim.api.nvim_create_user_command("MasonInstallAll", function()
|
||||||
|
-- if opts.ensure_installed and #opts.ensure_installed > 0 then
|
||||||
|
-- vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
|
||||||
|
-- end
|
||||||
|
-- end, {})
|
||||||
|
--
|
||||||
|
-- vim.g.mason_binaries_list = opts.ensure_installed
|
||||||
|
-- end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
event = "User FilePost",
|
||||||
|
config = function()
|
||||||
|
require "configs.lspconfig"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- load luasnips + cmp related in insert mode only
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
event = "InsertEnter",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
-- snippet plugin
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
dependencies = "rafamadriz/friendly-snippets",
|
||||||
|
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
|
||||||
|
config = function(_, opts)
|
||||||
|
require "configs.luasnip"(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- autopairing of (){}[] etc
|
||||||
|
{
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
opts = {
|
||||||
|
fast_wrap = {},
|
||||||
|
disable_filetype = { "TelescopePrompt", "vim" },
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("nvim-autopairs").setup(opts)
|
||||||
|
|
||||||
|
-- setup cmp for autopairs
|
||||||
|
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||||
|
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- cmp sources plugins
|
||||||
|
{
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"hrsh7th/cmp-nvim-lua",
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
return require "configs.cmp"
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
require("cmp").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"numToStr/Comment.nvim",
|
||||||
|
keys = {
|
||||||
|
{ "gcc", mode = "n", desc = "Comment toggle current line" },
|
||||||
|
{ "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" },
|
||||||
|
{ "gc", mode = "x", desc = "Comment toggle linewise (visual)" },
|
||||||
|
{ "gbc", mode = "n", desc = "Comment toggle current block" },
|
||||||
|
{ "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" },
|
||||||
|
{ "gb", mode = "x", desc = "Comment toggle blockwise (visual)" },
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("Comment").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Save and load macro / register
|
||||||
|
{
|
||||||
|
"desdic/macrothis.nvim",
|
||||||
|
opts = {},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<Leader>kkd",
|
||||||
|
function()
|
||||||
|
require("macrothis").delete()
|
||||||
|
end,
|
||||||
|
desc = "[D]elete",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>kke",
|
||||||
|
function()
|
||||||
|
require("macrothis").edit()
|
||||||
|
end,
|
||||||
|
desc = "[E]dit",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>kkl",
|
||||||
|
function()
|
||||||
|
require("macrothis").load()
|
||||||
|
end,
|
||||||
|
desc = "[L]oad",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>kkn",
|
||||||
|
function()
|
||||||
|
require("macrothis").rename()
|
||||||
|
end,
|
||||||
|
desc = "Re[n]ame",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>kkq",
|
||||||
|
function()
|
||||||
|
require("macrothis").quickfix()
|
||||||
|
end,
|
||||||
|
desc = "Run macro on all files in [q]uickfix",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>kkr",
|
||||||
|
function()
|
||||||
|
require("macrothis").run()
|
||||||
|
end,
|
||||||
|
desc = "[R]un macro",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>kks",
|
||||||
|
function()
|
||||||
|
require("macrothis").save()
|
||||||
|
end,
|
||||||
|
desc = "[S]ave",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>kkx",
|
||||||
|
function()
|
||||||
|
require("macrothis").register()
|
||||||
|
end,
|
||||||
|
desc = "Edit register",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>kkp",
|
||||||
|
function()
|
||||||
|
require("macrothis").copy_register_printable()
|
||||||
|
end,
|
||||||
|
desc = "Co[p]y register as printable",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<Leader>kkm",
|
||||||
|
function()
|
||||||
|
require("macrothis").copy_macro_printable()
|
||||||
|
end,
|
||||||
|
desc = "Copy [m]acro as printable",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"onsails/diaglist.nvim",
|
||||||
|
lazy = false,
|
||||||
|
debug = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"anuvyklack/hydra.nvim",
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require "configs.hydra"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"gioele/vim-autoswap",
|
||||||
|
lazy = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"natecraddock/workspaces.nvim",
|
||||||
|
lazy = false,
|
||||||
|
|
||||||
|
config = function()
|
||||||
|
require("workspaces").setup {
|
||||||
|
hooks = {
|
||||||
|
open = { "Telescope find_files" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"mangelozzi/rgflow.nvim",
|
||||||
|
lazy = false,
|
||||||
|
|
||||||
|
config = function()
|
||||||
|
require("rgflow").setup {
|
||||||
|
-- Set the default rip grep flags and options for when running a search via
|
||||||
|
-- RgFlow. Once changed via the UI, the previous search flags are used for
|
||||||
|
-- each subsequent search (until Neovim restarts).
|
||||||
|
cmd_flags = "--smart-case --fixed-strings --ignore --max-columns 200",
|
||||||
|
|
||||||
|
-- Mappings to trigger RgFlow functions
|
||||||
|
default_trigger_mappings = true,
|
||||||
|
-- These mappings are only active when the RgFlow UI (panel) is open
|
||||||
|
default_ui_mappings = true,
|
||||||
|
-- QuickFix window only mapping
|
||||||
|
default_quickfix_mappings = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"yorickpeterse/nvim-window",
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require("nvim-window").setup {
|
||||||
|
normal_hl = "Normal",
|
||||||
|
hint_hl = "Bold",
|
||||||
|
border = "single",
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"sindrets/winshift.nvim",
|
||||||
|
lazy = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"kdheepak/lazygit.nvim",
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require("lazy").setup {
|
||||||
|
{
|
||||||
|
"kdheepak/lazygit.nvim",
|
||||||
|
-- optional for floating window border decoration
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- file managing , picker etc
|
||||||
|
{
|
||||||
|
"nvim-tree/nvim-tree.lua",
|
||||||
|
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
|
||||||
|
opts = function()
|
||||||
|
return require "configs.nvimtree"
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
dofile(vim.g.base46_cache .. "nvimtree")
|
||||||
|
require("nvim-tree").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||||
|
cmd = "Telescope",
|
||||||
|
opts = function()
|
||||||
|
return require "configs.telescope"
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
-- dofile(vim.g.base46_cache .. "telescope")
|
||||||
|
local telescope = require "telescope"
|
||||||
|
telescope.setup(opts)
|
||||||
|
|
||||||
|
-- load extensions
|
||||||
|
for _, ext in ipairs(opts.extensions_list) do
|
||||||
|
telescope.load_extension(ext)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Only load whichkey after all the gui
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
lazy = false,
|
||||||
|
keys = { "<leader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
|
||||||
|
cmd = "WhichKey",
|
||||||
|
config = function(_, opts)
|
||||||
|
dofile(vim.g.base46_cache .. "whichkey")
|
||||||
|
require("which-key").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ThePrimeagen/harpoon",
|
||||||
|
branch = "harpoon2",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/noice.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = function()
|
||||||
|
return require "configs.noice"
|
||||||
|
end,
|
||||||
|
init = function()
|
||||||
|
require("noice").setup {
|
||||||
|
routes = {
|
||||||
|
{
|
||||||
|
view = "notify",
|
||||||
|
filter = { event = "msg_showmode" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lsp = {
|
||||||
|
signature = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
-- require("notify").setup({
|
||||||
|
-- background_colour = "#000000"
|
||||||
|
-- })
|
||||||
|
end,
|
||||||
|
dependencies = {
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
-- "rcarriga/nvim-notify",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
lazy = false,
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
lazy = false,
|
||||||
|
cmd = "Trouble",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user