feat(nvim): completion sources
This commit is contained in:
parent
b133b675f0
commit
e9aeacd1e6
9 changed files with 219 additions and 103 deletions
|
|
@ -1,29 +1,31 @@
|
|||
{
|
||||
"blink-cmp-env": { "branch": "main", "commit": "99af62c1f9aa46005e8f50ad4ccee581946546ca" },
|
||||
"blink-cmp-git": { "branch": "master", "commit": "e3ad0ffaaa3b3b7e2158cc72cd6dad2d19842c46" },
|
||||
"blink-cmp-sshconfig": { "branch": "main", "commit": "91bf9bd80d53d2b6521cffb01da138ef6403d625" },
|
||||
"blink-cmp-tmux": { "branch": "main", "commit": "1ef35d8e388475ab8eaeecfc12e196c78bd5de04" },
|
||||
"blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" },
|
||||
"cp.nvim": { "branch": "main", "commit": "04d0c124cfbe9a63c7e49bb6b38f179a80a4e061" },
|
||||
"dial.nvim": { "branch": "master", "commit": "f2634758455cfa52a8acea6f142dcd6271a1bf57" },
|
||||
"fzf-lua": { "branch": "main", "commit": "fb8c50ba62a0daa433b7ac2b78834f318322b879" },
|
||||
"fzf-lua": { "branch": "main", "commit": "b2c0603216adb92c6bba81053bc996d7ae95b77a" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519" },
|
||||
"guard.nvim": { "branch": "main", "commit": "addb8d2f40662b8b62d60dd7d18f503beb2332e7" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
|
||||
"live-rename.nvim": { "branch": "main", "commit": "3a3cddf23b89a17992f9ca67afc5858077769462" },
|
||||
"mini.ai": { "branch": "main", "commit": "9eae720f2b20f6ad28cbfa0ddc524e10dc2c3201" },
|
||||
"mini.ai": { "branch": "main", "commit": "b0247752cf629ce7c6bd0a1efd82fb58ff60f9d6" },
|
||||
"mini.bufremove": { "branch": "main", "commit": "10857aa39160c127694151828914df3131ba83b6" },
|
||||
"mini.misc": { "branch": "main", "commit": "b647b64321c34d4868d158282bb89e49f0d6838b" },
|
||||
"mini.misc": { "branch": "main", "commit": "8d4796cc703173b26ce122a999d28036b16b3190" },
|
||||
"mini.pairs": { "branch": "main", "commit": "4089aa6ea6423e02e1a8326a7a7a00159f6f5e04" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "338409dd8a6ed74767bad3eb5269f1b903ffb3cf" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "f4e9d367d4e067d7a5fabc9fd3f1349b291eb718" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" },
|
||||
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "9f2dad22ef8bb14fd1e0a3aa8859cdc88170668b" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "ecdae44baefeffceade8b0c752d80ececad28e76" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "a0e182ae21fda68c59d1f36c9ed45600aef50311" },
|
||||
"nvim-vtsls": { "branch": "main", "commit": "0b5f73c9e50ce95842ea07bb3f05c7d66d87d14a" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
|
||||
"oil.nvim": { "branch": "master", "commit": "f55b25e493a7df76371cfadd0ded5004cb9cd48a" },
|
||||
"overseer.nvim": { "branch": "master", "commit": "392093e610333c0aea89bf43de7362e25783eada" },
|
||||
"treesj": { "branch": "main", "commit": "186084dee5e9c8eec40f6e39481c723dd567cb05" },
|
||||
"vim-abolish": { "branch": "master", "commit": "dcbfe065297d31823561ba787f51056c147aa682" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||
"vimtex": { "branch": "master", "commit": "f707368022cdb851716be0d2970b90599c84a6a6" }
|
||||
"vimtex": { "branch": "master", "commit": "95b93a24740f7b89dd8331326b41bdd1337d79f6" }
|
||||
}
|
||||
|
|
|
|||
82
config/nvim/lua/config/cmp_cc.lua
Normal file
82
config/nvim/lua/config/cmp_cc.lua
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
local types = {
|
||||
{ 'feat', 'A new feature (MINOR in semver)' },
|
||||
{ 'fix', 'A bug fix (PATCH in semver)' },
|
||||
{ 'docs', 'Documentation only' },
|
||||
{ 'style', 'Formatting, whitespace — no behavioral change' },
|
||||
{ 'refactor', 'Restructures code without changing behavior' },
|
||||
{ 'perf', 'Performance improvement' },
|
||||
{ 'test', 'Add or correct tests' },
|
||||
{ 'build', 'Build system or external dependencies' },
|
||||
{ 'ci', 'CI/CD configuration and scripts' },
|
||||
{ 'chore', 'Routine tasks outside src and test' },
|
||||
{ 'revert', 'Reverts a previous commit' },
|
||||
}
|
||||
|
||||
local source = {}
|
||||
|
||||
function source.new()
|
||||
local self = setmetatable({}, { __index = source })
|
||||
self.Kind = require('blink.cmp.types').CompletionItemKind
|
||||
self.items = {}
|
||||
for _, t in ipairs(types) do
|
||||
self.items[#self.items + 1] = {
|
||||
label = t[1],
|
||||
kind = self.Kind.Keyword,
|
||||
documentation = {
|
||||
kind = 'markdown',
|
||||
value = t[2]
|
||||
},
|
||||
}
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
function source:enabled()
|
||||
return vim.tbl_contains({ 'gitcommit', 'octo', 'markdown' }, vim.bo.filetype)
|
||||
end
|
||||
|
||||
function source:get_completions(ctx, callback)
|
||||
local row, col = unpack(ctx.cursor)
|
||||
local before = ctx.line:sub(1, col)
|
||||
|
||||
if not before:find('%s') then
|
||||
if row > 1 then
|
||||
local item = {
|
||||
label = 'BREAKING CHANGE',
|
||||
kind = self.Kind.Keyword,
|
||||
documentation = {
|
||||
kind = 'markdown',
|
||||
value = 'Adds a `BREAKING CHANGE` footer and marks the commit header with `!`.',
|
||||
},
|
||||
}
|
||||
local first = vim.api.nvim_buf_get_lines(0, 0, 1, false)[1]
|
||||
if not first:match('!:') then
|
||||
local colon = first:find(':')
|
||||
if colon then
|
||||
item.additionalTextEdits = {
|
||||
{
|
||||
range = {
|
||||
start = { line = 0, character = colon - 1 },
|
||||
['end'] = { line = 0, character = colon - 1 },
|
||||
},
|
||||
newText = '!',
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
callback({ items = { item } })
|
||||
return
|
||||
elseif not before:find('[():]') then
|
||||
callback({
|
||||
is_incomplete_forward = false,
|
||||
is_incomplete_backward = false,
|
||||
items = vim.deepcopy(self.items),
|
||||
})
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
callback({ items = {} })
|
||||
end
|
||||
|
||||
return source
|
||||
100
config/nvim/lua/plugins/blink.lua
Normal file
100
config/nvim/lua/plugins/blink.lua
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
return {
|
||||
'saghen/blink.cmp',
|
||||
version = '1.*',
|
||||
dependencies = {
|
||||
'Kaiser-Yang/blink-cmp-git',
|
||||
'folke/lazydev.nvim',
|
||||
'bydlw98/blink-cmp-env',
|
||||
{ 'bydlw98/blink-cmp-sshconfig', build = 'make' },
|
||||
},
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
event = { 'InsertEnter', 'LspAttach' },
|
||||
config = function(_, opts)
|
||||
vim.o.pumheight = 15
|
||||
opts.completion.menu.max_height = vim.o.pumheight
|
||||
|
||||
require('blink.cmp').setup(opts)
|
||||
end,
|
||||
opts = {
|
||||
keymap = {
|
||||
['<c-p>'] = { 'select_prev' },
|
||||
['<c-n>'] = { 'show', 'select_next' },
|
||||
['<c-space>'] = {},
|
||||
['<c-y>'] = {
|
||||
function(cmp)
|
||||
return cmp.snippet_active() and cmp.accept()
|
||||
or cmp.select_and_accept()
|
||||
end,
|
||||
'snippet_forward',
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
accept = {
|
||||
auto_brackets = { enabled = false },
|
||||
},
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
window = {
|
||||
border = 'single',
|
||||
scrollbar = false,
|
||||
},
|
||||
},
|
||||
menu = {
|
||||
auto_show = false,
|
||||
border = 'single',
|
||||
scrollbar = false,
|
||||
draw = {
|
||||
treesitter = { 'lsp', 'snippets', 'buffer' },
|
||||
columns = {
|
||||
{ 'kind_icon' },
|
||||
{ 'label', 'label_description', gap = 1 },
|
||||
},
|
||||
},
|
||||
},
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
show_with_selection = true,
|
||||
show_without_selection = false,
|
||||
show_without_menu = false,
|
||||
},
|
||||
},
|
||||
sources = {
|
||||
default = {
|
||||
'git',
|
||||
'conventional_commits',
|
||||
'lsp',
|
||||
'path',
|
||||
'buffer',
|
||||
'env',
|
||||
'snippets',
|
||||
-- 'sshconfig',
|
||||
},
|
||||
providers = {
|
||||
git = {
|
||||
module = 'blink-cmp-git',
|
||||
name = 'Git',
|
||||
},
|
||||
conventional_commits = {
|
||||
name = 'Conventional Commits',
|
||||
module = 'config.cmp_cc',
|
||||
},
|
||||
lazydev = {
|
||||
name = 'LazyDev',
|
||||
module = 'lazydev.integrations.blink',
|
||||
score_offset = 100,
|
||||
},
|
||||
env = {
|
||||
name = 'Env',
|
||||
module = 'blink-cmp-env',
|
||||
},
|
||||
-- sshconfig = {
|
||||
-- name = 'SshConfig',
|
||||
-- module = 'blink-cmp-sshconfig',
|
||||
-- },
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = { { '<c-n>', mode = 'i' } },
|
||||
opts_extend = { 'sources.default' },
|
||||
}
|
||||
|
|
@ -1,6 +1,12 @@
|
|||
return {
|
||||
'ibhagwan/fzf-lua',
|
||||
config = function(_, opts)
|
||||
local has_devicons = pcall(require, 'nvim-web-devicons')
|
||||
opts.files = opts.files or {}
|
||||
opts.files.file_icons = has_devicons
|
||||
opts.grep = opts.grep or {}
|
||||
opts.grep.file_icons = has_devicons
|
||||
|
||||
require('fzf-lua').setup(opts)
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
|
|
@ -77,7 +83,6 @@ return {
|
|||
file_icon_padding = ' ',
|
||||
files = {
|
||||
cmd = vim.env.FZF_CTRL_T_COMMAND,
|
||||
file_icons = true,
|
||||
no_header_i = true,
|
||||
},
|
||||
fzf_args = (vim.env.FZF_DEFAULT_OPTS or ''):gsub(
|
||||
|
|
@ -85,7 +90,6 @@ return {
|
|||
''
|
||||
),
|
||||
grep = {
|
||||
file_icons = true,
|
||||
no_header_i = true,
|
||||
RIPGREP_CONFIG_PATH = vim.env.RIPGREP_CONFIG_PATH,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,78 +9,6 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'saghen/blink.cmp',
|
||||
version = '1.*',
|
||||
dependencies = 'folke/lazydev.nvim',
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
event = { 'InsertEnter', 'LspAttach' },
|
||||
config = function(_, opts)
|
||||
vim.o.pumheight = 15
|
||||
opts.completion.menu.max_height = vim.o.pumheight
|
||||
|
||||
require('blink.cmp').setup(opts)
|
||||
end,
|
||||
opts = {
|
||||
keymap = {
|
||||
['<c-p>'] = { 'select_prev' },
|
||||
['<c-n>'] = { 'show', 'select_next' },
|
||||
['<c-space>'] = {},
|
||||
['<c-y>'] = {
|
||||
function(cmp)
|
||||
return cmp.snippet_active() and cmp.accept()
|
||||
or cmp.select_and_accept()
|
||||
end,
|
||||
'snippet_forward',
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
menu = {
|
||||
auto_show = false,
|
||||
scrollbar = false,
|
||||
draw = {
|
||||
columns = function(ctx)
|
||||
if ctx.mode == 'cmdline' then
|
||||
return {
|
||||
{ 'label', 'label_description', gap = 1 },
|
||||
}
|
||||
else
|
||||
return {
|
||||
{ 'label', 'label_description' },
|
||||
{ 'kind' },
|
||||
}
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
cmdline = {
|
||||
enabled = false,
|
||||
-- completion = {
|
||||
-- menu = {
|
||||
-- auto_show = true,
|
||||
-- },
|
||||
-- },
|
||||
-- keymap = {
|
||||
-- ['<left>'] = false,
|
||||
-- ['<right>'] = false,
|
||||
-- },
|
||||
},
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
providers = {
|
||||
lazydev = {
|
||||
name = 'LazyDev',
|
||||
module = 'lazydev.integrations.blink',
|
||||
score_offset = 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = { { '<c-n>', mode = 'i' } },
|
||||
opts_extend = { 'sources.default' },
|
||||
},
|
||||
{
|
||||
'saecki/live-rename.nvim',
|
||||
event = 'LspAttach',
|
||||
|
|
|
|||
|
|
@ -38,16 +38,17 @@ return {
|
|||
{
|
||||
'barrettruth/midnight.nvim',
|
||||
dir = '~/dev/midnight.nvim',
|
||||
enabled = true,
|
||||
config = function()
|
||||
vim.cmd.colorscheme('midnight')
|
||||
end,
|
||||
},
|
||||
{
|
||||
'barrettruth/nonicons.nvim',
|
||||
enabled = false,
|
||||
lazy = false,
|
||||
dir = '~/dev/nonicons.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
dependencies = {
|
||||
{ 'nvim-tree/nvim-web-devicons', enabled = false, },
|
||||
},
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.pairs',
|
||||
|
|
@ -163,7 +164,7 @@ return {
|
|||
},
|
||||
{
|
||||
'lervag/vimtex',
|
||||
lazy = false,
|
||||
ft = { 'latex' },
|
||||
init = function()
|
||||
vim.g.vimtex_view_method = 'sioyek'
|
||||
vim.g.vimtex_quickfix_mode = 0
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ return {
|
|||
'nvim-treesitter/nvim-treesitter',
|
||||
branch = 'main',
|
||||
build = ':TSUpdate all',
|
||||
lazy = false,
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = '*',
|
||||
|
|
|
|||
30
flake.lock
generated
30
flake.lock
generated
|
|
@ -5,11 +5,11 @@
|
|||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1771355895,
|
||||
"narHash": "sha256-sopgRZY3c/8LCMKk/r97qFR4qrRq7PQqCLjnhiTJKdg=",
|
||||
"lastModified": 1771452337,
|
||||
"narHash": "sha256-+rhNFXNvS2eRBdnDY5yaX4dUcXTyhU889tFIIQo3/3M=",
|
||||
"owner": "ryoppippi",
|
||||
"repo": "claude-code-overlay",
|
||||
"rev": "c731854774677b1aa8ec11c30f8e4ebd912789c0",
|
||||
"rev": "6f2d936ed22d0170220fc570a3350b23b02b40a5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -25,11 +25,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1771269455,
|
||||
"narHash": "sha256-BZ31eN5F99YH6vkc4AhzKGE+tJgJ52kl8f01K7wCs8w=",
|
||||
"lastModified": 1771471179,
|
||||
"narHash": "sha256-XuP8HPzvt4+m9aKVeL9GdGNlTeyeDn3zEeUuorvrw88=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "5f1d42a97b19803041434f66681d5c44c9ae62e3",
|
||||
"rev": "2dedeb55b2c140d9a123ae931588e8903fe202ef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -61,11 +61,11 @@
|
|||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1771257191,
|
||||
"narHash": "sha256-H1l+zHq+ZinWH7F1IidpJ2farmbfHXjaxAm1RKWE1KI=",
|
||||
"lastModified": 1771423359,
|
||||
"narHash": "sha256-yRKJ7gpVmXbX2ZcA8nFi6CMPkJXZGjie2unsiMzj3Ig=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "66e1a090ded57a0f88e2b381a7d4daf4a5722c3f",
|
||||
"rev": "740a22363033e9f1bb6270fbfb5a9574067af15b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -92,11 +92,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1771177547,
|
||||
"narHash": "sha256-trTtk3WTOHz7hSw89xIIvahkgoFJYQ0G43IlqprFoMA=",
|
||||
"lastModified": 1771207753,
|
||||
"narHash": "sha256-b9uG8yN50DRQ6A7JdZBfzq718ryYrlmGgqkRm9OOwCE=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ac055f38c798b0d87695240c7b761b82fc7e5bc2",
|
||||
"rev": "d1c15b7d5806069da59e819999d70e1cec0760bf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -137,11 +137,11 @@
|
|||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1771381854,
|
||||
"narHash": "sha256-6uEDuQYEGuyuFnvOdSx+fW75tRbNiLswAl6+4qyTdJ4=",
|
||||
"lastModified": 1771437627,
|
||||
"narHash": "sha256-mGav6dRJOzHXQzrVAanJXQeGIG7LZr9fB2s024BBggU=",
|
||||
"owner": "0xc000022070",
|
||||
"repo": "zen-browser-flake",
|
||||
"rev": "0fa995bec0e391b45b032fbd9d6e03609a30c115",
|
||||
"rev": "b04b9a92e4ca216bf39de96ad1cdc6af343ce472",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ in
|
|||
tesseract
|
||||
gnumake
|
||||
gcc
|
||||
pacman
|
||||
file
|
||||
ffmpeg
|
||||
poppler-utils
|
||||
|
|
@ -46,6 +45,7 @@ in
|
|||
]
|
||||
++ lib.optionals hostConfig.isLinux [ xclip ]
|
||||
++ lib.optionals rust [ rustup ]
|
||||
++ lib.optionals python [ uv ]
|
||||
++ lib.optionals claude [ claude-code ];
|
||||
|
||||
home.sessionVariables = lib.mkMerge [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue