Skip to content

Commit

Permalink
cmp colouring, ripgrep and some minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
atropos112 committed Feb 15, 2025
1 parent 25f253d commit 465d6eb
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
"rabbit.nvim": { "branch": "master", "commit": "40eb33ac42f0e756099ffe45caeaa6dc59547c10" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "cf0da2516b0684596b09c51dbc93c609cdc2f455" },
"rustaceanvim": { "branch": "master", "commit": "f03035fa03ccb36cd26d0792c946fbacba1d1a39" },
"rustowl": { "branch": "main", "commit": "1885c5c6f3ff817b9a2d239c146313e5141186dc" },
"schemastore.nvim": { "branch": "main", "commit": "118e563101169e8c5096023bc45c460e4c4fb77c" },
"select-undo.nvim": { "branch": "main", "commit": "d5aa1f0dbef93b7ed4219ef8c7bfae9691264ef7" },
"smear-cursor.nvim": { "branch": "main", "commit": "110f7d8771fff9dde6b2aa7e20c29bae8bb4d834" },
"sniprun": { "branch": "master", "commit": "67ac2d84d03f3b857d59571ff5fefb6080dffa2d" },
"sqlite.lua": { "branch": "master", "commit": "b487fcc8937b683942a1f7d9662fcf50ca5acd58" },
Expand Down
2 changes: 1 addition & 1 deletion lua/atro/globals/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ return {
return {
"-formatter",
-- WARN: This is a custom configuration for yamlfmt. Main concern was it mushing multiline strings into one line. It doesn't do that AS long as there is at MOST one comment line in the multi string. A compromise for sure.
"scan_folded_as_literal=true,retain_line_breaks=true,include_document_start=true",
"scan_folded_as_literal=true,retain_line_breaks=true,include_document_start=true,drop_merge_tag=true",
}
end,
},
Expand Down
2 changes: 1 addition & 1 deletion lua/atro/plugins/bottom_bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ return {
end

local sign = "" -- nf-fa-gear \uf013
local lsp_clients = vim.lsp.get_active_clients()
local lsp_clients = vim.lsp.get_clients()
local messages_map = {}
for _, climsg in ipairs(client_messages) do
messages_map[climsg.name] = climsg.body
Expand Down
27 changes: 25 additions & 2 deletions lua/atro/plugins/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ return {
"folke/lazydev.nvim",
"rcarriga/cmp-dap",
"xzbdmw/colorful-menu.nvim",
"mikavilpas/blink-ripgrep.nvim",
},
version = "*",
config = function()
local is_dap_buffer = require("cmp_dap").is_dap_buffer
---@module 'blink.cmp'
---@type blink.cmp.Config
require("blink.cmp").setup({

enabled = function()
return vim.bo.buftype ~= "prompt" or is_dap_buffer()
end,
Expand Down Expand Up @@ -98,13 +98,30 @@ return {
if sql_filetypes[vim.bo.filetype] ~= nil then
return { "dadbod", "snippets", "buffer" }
elseif is_dap_buffer() then
return { "dap", "snippets", "buffer" }
return { "dap", "snippets", "buffer", "ripgrep" }
elseif require("atro.utils").is_git_dir() then
-- ripgrep slows stuff down if the project is big, limiting to git repos only.
return { "lsp", "path", "snippets", "buffer", "ripgrep" }
else
return { "lsp", "path", "snippets", "buffer" }
end
end,

providers = {
ripgrep = {
module = "blink-ripgrep",
name = "Ripgrep",
---@module "blink-ripgrep"
---@type blink-ripgrep.Options
opts = {
-- The number of lines to show around each match in the preview (documentation) window. For example, 5 means to show 5 lines before, then the match, and another 5 lines after the match.
context_size = 50,

-- The maximum file size that ripgrep should include in its search. Examples: "1024" (bytes by default), "200K", "1M", "1G"
max_filesize = "1M",
},
score_offset = 50,
},
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
Expand All @@ -122,6 +139,12 @@ return {
score_offset = 100,
opts = {},
},
lsp = {
name = "LSP",
module = "blink.cmp.sources.lsp",
score_offset = 200,
opts = {},
},
},
},
})
Expand Down
9 changes: 9 additions & 0 deletions lua/atro/plugins/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ return {
},
opts = {},
},
{
"SunnyTamang/select-undo.nvim",
config = function()
require("select-undo").setup({
line_mapping = "gU", -- Change line undo mapping
partial_mapping = "gCp", -- Change partial undo mapping
})
end,
},
-- {
-- "smoka7/multicursors.nvim",
-- event = "VeryLazy",
Expand Down
8 changes: 7 additions & 1 deletion lua/atro/plugins/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ return {
{
"RRethy/vim-illuminate",
event = "LspAttach",
opt = {},
config = function()
require("illuminate").configure({
providers = {
"lsp",
},
})
end,
},
{
"hiphish/rainbow-delimiters.nvim",
Expand Down
16 changes: 16 additions & 0 deletions lua/atro/utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ M.lst_to_str = function(lst)
return str:sub(1, -3)
end

-- Chceks if a root dir is a git directory
--- @return boolean
M.is_git_dir = function()
local path = vim.fn.getcwd()
while path do
if vim.fn.isdirectory(path .. "/.git") == 1 then
return true
end
path = vim.fn.fnamemodify(path, ":h")
if path == "/" or path == "" then
break
end
end
return false
end

--- @param tbl table<any, string>
--- @return string[]
M.tbl_to_lst = function(tbl, key)
Expand Down

0 comments on commit 465d6eb

Please sign in to comment.