Compare commits
73 Commits
feature/te
...
17abcf48ae
| Author | SHA1 | Date | |
|---|---|---|---|
| 17abcf48ae | |||
| 552536e87b | |||
| 4baef6ee61 | |||
| c8e33adba0 | |||
| 28fb8bea85 | |||
| bd09133cf6 | |||
| 8650bc76a5 | |||
| aede270a03 | |||
| ae6d8b81e3 | |||
| 72e01ce321 | |||
| 08583ff839 | |||
| 09a7cda545 | |||
| 4f00972dec | |||
| 7e3b1dd83e | |||
| 9951270d0b | |||
| f19091b3ec | |||
| 350beee4f1 | |||
| a2c7c46185 | |||
| c0545fd267 | |||
| cfec54bead | |||
| 952d016f70 | |||
| 53339e0d19 | |||
| 8b114f4da0 | |||
| 66fd13ec25 | |||
| f7ff3f6f4f | |||
| 78d14b79a7 | |||
| 0f0dafb773 | |||
| b6471168fb | |||
| 8bf693ba29 | |||
| b1ecff2e08 | |||
| 8894b0ccdb | |||
| 132e1aa78a | |||
| b92b8ed602 | |||
| a947bcda9b | |||
| 0325d883bc | |||
| 67c2b52e4d | |||
| 23cf6254ec | |||
| f53b5f6905 | |||
| cb80bb1750 | |||
| 68ea39094c | |||
| 0334178b6e | |||
| 4a596c757b | |||
| a6bf1207d7 | |||
| a93c15e29e | |||
| bcc806d349 | |||
| 6871470b6c | |||
| c49b758e86 | |||
| 231db82c0f | |||
| 7dcd4ec2f7 | |||
| b1a0742ffa | |||
| b10e7d85eb | |||
| e3c38b2da9 | |||
| 3b65386a9f | |||
| 24b4c23635 | |||
| 2338b310f2 | |||
| 758322bd93 | |||
| 1a2df25f5e | |||
| aac1e91dcb | |||
| 6d91d0c963 | |||
| a33c92ce5b | |||
| 4053addac9 | |||
| 751829deb0 | |||
| c0adfd43a1 | |||
| 69067d5410 | |||
| d91c167d6e | |||
| 6a8be9a1e3 | |||
| b685e528af | |||
| 7200602b10 | |||
| 56316c6986 | |||
| 4ccc8ae093 | |||
| 8e153ee524 | |||
| 153f3d36c0 | |||
| b71f7c2cce |
7
.luarc.json
Normal file
7
.luarc.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"diagnostics.disable": [
|
||||
"undefined-global",
|
||||
"unused-local"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# My nvim configuration
|
||||
|
||||
This mostly copies ThePrimeagen configs with some changes because I don't use dvorak
|
||||
|
||||
|
||||
5
after/ftplugin/helm.lua
Normal file
5
after/ftplugin/helm.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
vim.opt_local.expandtab = true
|
||||
|
||||
12
after/ftplugin/make.lua
Normal file
12
after/ftplugin/make.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.softtabstop = 4
|
||||
vim.opt_local.expandtab = false
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "make",
|
||||
callback = function()
|
||||
print("Makefile detected and ftplugin loaded!")
|
||||
end,
|
||||
})
|
||||
|
||||
2
after/ftplugin/markdown.lua
Normal file
2
after/ftplugin/markdown.lua
Normal file
@@ -0,0 +1,2 @@
|
||||
vim.opt_local.conceallevel = 2
|
||||
|
||||
4
after/ftplugin/nix.lua
Normal file
4
after/ftplugin/nix.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.expandtab = true
|
||||
|
||||
1
after/ftplugin/python.lua
Normal file
1
after/ftplugin/python.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.opt.colorcolumn = "95"
|
||||
6
after/ftplugin/terraform.lua
Normal file
6
after/ftplugin/terraform.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
vim.opt.colorcolumn = "95"
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.bo.commentstring = '# %s'
|
||||
|
||||
5
after/ftplugin/yaml.lua
Normal file
5
after/ftplugin/yaml.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
vim.opt_local.expandtab = true
|
||||
|
||||
@@ -1,34 +1,44 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "2b6860d15aaab01d3fb90859c0ba97f20ad7bc5f" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-dotenv": { "branch": "main", "commit": "4dd53aab60982f1f75848aec5e6214986263325e" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" },
|
||||
"git-blame.nvim": { "branch": "master", "commit": "408d5487d908dfe5d48e5645d8b27ddcc16b11e0" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "d4cde3853a172485961b515c36d51d757728d6e6" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "70f2c090d3ffb14f8702d468e05beb240b768881" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "a4caa0d083aab56f6cd5acf2d42331b74614a585" },
|
||||
"mason.nvim": { "branch": "main", "commit": "0950b15060067f752fde13a779a994f59516ce3d" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "02893eeb9d6e8503817bd52385e111cba9a90500" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" },
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"blink-ripgrep.nvim": { "branch": "main", "commit": "65a3c6974fe310ee457f79b81ec72b64d0ec02f1" },
|
||||
"blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "4ec7bed6c86b671ddde03ca1b227343cfa3e65fa" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"fzf-lua": { "branch": "main", "commit": "5c40d45bb37ad6355b1e028daa127dfe22be6857" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "8270378ab83540b03d09c0194ba3e208f9d0cb72" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "58a2cda2e953a99e2f87c12b7fb4602da4e0709c" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
|
||||
"hererocks": { "branch": "master", "commit": "f4cc0b16619b9d9d59c92636c5b5e7c06dc7c082" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "844d247d998c2f9a6a3baad8bb9748edc55ce69f" },
|
||||
"mason.nvim": { "branch": "main", "commit": "9e25c98d4826998460926f8c5c2284848d80ae89" },
|
||||
"mini.pairs": { "branch": "main", "commit": "1e1ca3f60f58d4050bf814902b472eec9963a5dd" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "46f2713c88a0b4e4bf134b59577659851ddd31cf" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "92166b89ab4b3d60f24e58170cac53b7141fd032" },
|
||||
"nvim-surround": { "branch": "main", "commit": "f1f0699a1d49f28e607ffa4361f1bbe757ac5ebc" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "3a74b5831058d0daf8952a5b8c556c61b30a3f46" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" },
|
||||
"plenary": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "77d3fdfb3554632c7a3b101ded643d422de7626f" },
|
||||
"nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" },
|
||||
"nvim-sops": { "branch": "main", "commit": "cb2209562d00ef8c6c88bdec836d9edb8fbb96ef" },
|
||||
"nvim-surround": { "branch": "main", "commit": "7a7a78a52219a3312c1fcabf880cea07a7956a5f" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "80fe8215ba566df2fbf3bf4d25f59ff8f41bc0e1" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "3362099de3368aa620a8105b19ed04c2053e38c0" },
|
||||
"obsidian.nvim": { "branch": "main", "commit": "705cc9b4f66eca1e54040ac819102e80a32896d3" },
|
||||
"oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" },
|
||||
"parrot.nvim": { "branch": "main", "commit": "0477748832812707e53db078d0180299a0c15d6c" },
|
||||
"plenary": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "5df2eab599e06c48d04ea7e89cbaa3cdb4e09538" },
|
||||
"search.nvim": { "branch": "main", "commit": "7b8f2315d031be73e14bc2d82386dfac15952614" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
|
||||
"undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" },
|
||||
"vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "4f59455d2388e113bd510e85b310d15b9228ca0d" },
|
||||
"vim-gitgutter": { "branch": "main", "commit": "e801371917e52805a4ceb1e93f55ed1fba712f82" }
|
||||
}
|
||||
"statuscol.nvim": { "branch": "main", "commit": "c46172d0911aa5d49ba5f39f4351d1bb7aa289cc" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||
"undotree": { "branch": "master", "commit": "28f2f54a34baff90ea6f4a735ef1813ad875c743" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
|
||||
"vim-helm": { "branch": "master", "commit": "cc5ac22444332381f38084a6c7f023c25eef6201" }
|
||||
}
|
||||
|
||||
59
lua/crentist/autocmd.lua
Normal file
59
lua/crentist/autocmd.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
|
||||
local CrentistGroup = augroup('Crentist', {})
|
||||
local OnSaveGroup = augroup('CrentistOnSave', {})
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
autocmd('LspAttach', {
|
||||
group = CrentistGroup,
|
||||
callback = function(e)
|
||||
local opts = { buffer = e.buf }
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
|
||||
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", function() builtin.lsp_references() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
||||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
||||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
||||
vim.keymap.set("n", "<M-F>", function() vim.lsp.buf.format() end, opts)
|
||||
end
|
||||
})
|
||||
|
||||
-- Add new line to the end of the file
|
||||
autocmd({ 'BufWritePre' }, {
|
||||
group = OnSaveGroup,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
local n_lines = vim.api.nvim_buf_line_count(0)
|
||||
local last_nonblank = vim.fn.prevnonblank(n_lines)
|
||||
if last_nonblank <= n_lines then
|
||||
vim.api.nvim_buf_set_lines(0,
|
||||
last_nonblank, n_lines, true, { '' })
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Remove trailing spaces
|
||||
autocmd({ 'BufWritePre' }, {
|
||||
group = OnSaveGroup,
|
||||
pattern = { "*" },
|
||||
callback = function()
|
||||
local save_cursor = vim.fn.winsaveview()
|
||||
pcall(function() vim.cmd [[%s/\s\+$//e]] end)
|
||||
vim.fn.winrestview(save_cursor)
|
||||
end,
|
||||
})
|
||||
|
||||
autocmd({'FileType'}, {
|
||||
group = CrentistGroup,
|
||||
pattern = { 'json' },
|
||||
callback = function (e)
|
||||
vim.keymap.set("n", "<M-F>", function() vim.cmd('silent %!jq .') end, {buffer = e.buf})
|
||||
end
|
||||
})
|
||||
|
||||
20
lua/crentist/filetype.lua
Normal file
20
lua/crentist/filetype.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
['tf'] = 'terraform',
|
||||
},
|
||||
pattern = {
|
||||
['.*/playbooks/.*%.ya?ml'] = 'yaml.ansible',
|
||||
['.*/roles/.*%.ya?ml'] = 'yaml.ansible',
|
||||
['.*/tasks/.*%.ya?ml'] = 'yaml.ansible',
|
||||
['.*/plays/.*%.ya?ml'] = 'yaml.ansible',
|
||||
},
|
||||
})
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
j2 = 'jinja',
|
||||
jinja = 'jinja',
|
||||
jinja2 = 'jinja',
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,25 +1,8 @@
|
||||
require("crentist.remap")
|
||||
require("crentist.set")
|
||||
require("crentist.lazy_init")
|
||||
require("crentist.autocmd")
|
||||
require("crentist.filetype")
|
||||
require("crentist.luasnip")
|
||||
require("crentist.null-ls")
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local CrentistGroup = augroup('Crentist', {})
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
autocmd('LspAttach', {
|
||||
group = CrentistGroup,
|
||||
callback = function(e)
|
||||
local opts = { buffer = e.buf }
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
|
||||
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
||||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
||||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
||||
vim.keymap.set("n", "<M-F>", "<cmd>lua vim.lsp.buf.format()<CR>")
|
||||
end
|
||||
})
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = "InsertEnter",
|
||||
config = true
|
||||
}
|
||||
@@ -1,16 +1,44 @@
|
||||
return {
|
||||
{
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("gruvbox").setup({})
|
||||
vim.cmd("colorscheme gruvbox")
|
||||
local gruvbox = require('gruvbox')
|
||||
|
||||
---@module 'gruvbox'
|
||||
---@type GruvboxConfig
|
||||
local gruvbox_settings = {
|
||||
transparent_mode = false,
|
||||
italic = {
|
||||
strings = false,
|
||||
emphasis = true,
|
||||
comments = true,
|
||||
operators = false,
|
||||
folds = true,
|
||||
},
|
||||
overrides = {
|
||||
FoldColumn = { bg = '#282828', fg = '#808080' },
|
||||
GruvboxRedSign = { bg = '' },
|
||||
GruvboxGreenSign = { bg = '' },
|
||||
GruvboxYellowSign = { bg = '' },
|
||||
GruvboxBlueSign = { bg = '' },
|
||||
GruvboxPurpleSign = { bg = '' },
|
||||
GruvboxAquaSign = { bg = '' },
|
||||
GruvboxOrangeSign = { bg = '' },
|
||||
}
|
||||
}
|
||||
|
||||
gruvbox.setup(gruvbox_settings)
|
||||
vim.cmd('colorscheme gruvbox')
|
||||
|
||||
vim.api.nvim_set_hl(0, 'SignColumn', { link = 'FoldColumn' })
|
||||
end
|
||||
},
|
||||
{
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
config = function ()
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
config = function()
|
||||
require('colorizer').setup({ '*' })
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
97
lua/crentist/lazy/completion.lua
Normal file
97
lua/crentist/lazy/completion.lua
Normal file
@@ -0,0 +1,97 @@
|
||||
return {
|
||||
'saghen/blink.cmp',
|
||||
-- optional: provides snippets for the snippet source
|
||||
dependencies = {
|
||||
'mikavilpas/blink-ripgrep.nvim',
|
||||
'rafamadriz/friendly-snippets',
|
||||
{ 'L3MON4D3/LuaSnip', version = 'v2.*' }
|
||||
},
|
||||
-- use a release tag to download pre-built binaries
|
||||
version = 'v1.6.*',
|
||||
|
||||
---@module 'blink-cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
fuzzy = { implementation = 'prefer_rust_with_warning' },
|
||||
|
||||
snippets = {
|
||||
preset = 'luasnip',
|
||||
active = function(filter)
|
||||
local snippet = require('luasnip')
|
||||
local blink = require('blink.cmp')
|
||||
if snippet.in_snippet() and not blink.is_visible() then
|
||||
return true
|
||||
else
|
||||
if not snippet.in_snippet() and vim.fn.mode() == 'n' then snippet.unlink_current() end
|
||||
return false
|
||||
end
|
||||
end
|
||||
},
|
||||
|
||||
cmdline = {
|
||||
keymap = { preset = 'cmdline' },
|
||||
completion = {
|
||||
list = { selection = { preselect = false, auto_insert = true } }
|
||||
}
|
||||
},
|
||||
completion = { list = { selection = { preselect = false, auto_insert = true } } },
|
||||
keymap = {
|
||||
preset = 'enter',
|
||||
['<Tab>'] = { 'select_next', 'snippet_forward', 'fallback' },
|
||||
['<S-Tab>'] = { 'select_prev', 'snippet_backward', 'fallback' },
|
||||
},
|
||||
|
||||
appearance = {
|
||||
use_nvim_cmp_as_default = true,
|
||||
nerd_font_variant = 'mono'
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = { 'lazydev', 'lsp', 'snippets', 'ripgrep', 'path', 'buffer' },
|
||||
providers = {
|
||||
lazydev = {
|
||||
name = 'LazyDev',
|
||||
module = 'lazydev.integrations.blink',
|
||||
-- make lazydev completions top priority (see `:h blink.cmp`)
|
||||
score_offset = 100,
|
||||
},
|
||||
ripgrep = {
|
||||
module = 'blink-ripgrep',
|
||||
name = 'Ripgrep',
|
||||
score_offset = -5,
|
||||
-- the options below are optional, some default values are shown
|
||||
---@module 'blink-ripgrep'
|
||||
---@type blink-ripgrep.Options
|
||||
opts = {
|
||||
backend = {
|
||||
use = 'ripgrep',
|
||||
},
|
||||
ripgrep = {
|
||||
ignore_paths = {},
|
||||
additional_paths = {},
|
||||
additional_rg_options = {},
|
||||
max_filesize = '1M',
|
||||
project_root_fallback = true,
|
||||
search_casing = '--ignore-case',
|
||||
},
|
||||
project_root_marker = '.git',
|
||||
fallback_to_regex_highlighting = true,
|
||||
toggles = { debug = nil, },
|
||||
},
|
||||
transform_items = function(_, items)
|
||||
for _, item in ipairs(items) do
|
||||
-- example: append a description to easily distinguish rg results
|
||||
item.labelDetails = {
|
||||
description = '(rg)',
|
||||
}
|
||||
end
|
||||
return items
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
signature = { enabled = true }
|
||||
},
|
||||
}
|
||||
|
||||
7
lua/crentist/lazy/dressing.lua
Normal file
7
lua/crentist/lazy/dressing.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
'stevearc/dressing.nvim',
|
||||
---@module 'dressing'
|
||||
---@type dressing.InputConfig
|
||||
opts = {},
|
||||
}
|
||||
|
||||
@@ -1,34 +1,35 @@
|
||||
return {
|
||||
"tpope/vim-fugitive",
|
||||
config = function()
|
||||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
|
||||
'tpope/vim-fugitive',
|
||||
config = function()
|
||||
vim.keymap.set('n', "<leader>gs", vim.cmd.Git)
|
||||
|
||||
local Crentist_Fugitive = vim.api.nvim_create_augroup("Crentist_Fugitive", {})
|
||||
local Crentist_Fugitive = vim.api.nvim_create_augroup('Crentist_Fugitive', {})
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd("BufWinEnter", {
|
||||
autocmd('BufWinEnter', {
|
||||
group = Crentist_Fugitive,
|
||||
pattern = "*",
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
if vim.bo.ft ~= "fugitive" then
|
||||
if vim.bo.ft ~= 'fugitive' then
|
||||
return
|
||||
end
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local opts = {buffer = bufnr, remap = false}
|
||||
vim.keymap.set("n", "<leader>p", function()
|
||||
vim.keymap.set('n', "<leader>p", function()
|
||||
vim.cmd.Git('push')
|
||||
end, opts)
|
||||
|
||||
-- rebase always
|
||||
vim.keymap.set("n", "<leader>P", function()
|
||||
vim.keymap.set('n', "<leader>P", function()
|
||||
vim.cmd.Git({'pull', '--rebase'})
|
||||
end, opts)
|
||||
|
||||
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
|
||||
-- needed if i did not set the branch up correctly
|
||||
vim.keymap.set("n", "<leader>t", ":Git push -u origin ", opts);
|
||||
vim.keymap.set('n', "<leader>t", ":Git push -u origin ", opts);
|
||||
end,
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
return {
|
||||
'f-person/git-blame.nvim',
|
||||
config = function()
|
||||
local gitblame = require('gitblame')
|
||||
gitblame.setup({
|
||||
enabled = true,
|
||||
date_format = '%r'
|
||||
})
|
||||
vim.keymap.set("n", "<leader>gbt", function()
|
||||
gitblame.toggle()
|
||||
end)
|
||||
|
||||
local CrentistGitBlame = vim.api.nvim_create_augroup("CrentistGitBlame", {})
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
group = CrentistGitBlame,
|
||||
pattern = "netrw",
|
||||
callback = function()
|
||||
gitblame.disable()
|
||||
end,
|
||||
})
|
||||
end
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
return {
|
||||
"airblade/vim-gitgutter",
|
||||
}
|
||||
11
lua/crentist/lazy/gitsigns.lua
Normal file
11
lua/crentist/lazy/gitsigns.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
current_line_blame = true,
|
||||
attach_to_untracked = true,
|
||||
current_line_blame_opts = {
|
||||
delay = 500,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,39 @@
|
||||
return {
|
||||
"theprimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
'theprimeagen/harpoon',
|
||||
branch = 'harpoon2',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
local harpoon = require("harpoon")
|
||||
local harpoon = require('harpoon')
|
||||
|
||||
harpoon:setup()
|
||||
|
||||
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
|
||||
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
-- basic telescope configuration
|
||||
local conf = require('telescope.config').values
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
|
||||
vim.keymap.set("n", "<C-j>", function() harpoon:list():select(2) end)
|
||||
vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end)
|
||||
vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end)
|
||||
require('telescope.pickers').new({}, {
|
||||
prompt_title = 'Harpoon',
|
||||
finder = require('telescope.finders').new_table({
|
||||
results = file_paths,
|
||||
}),
|
||||
previewer = conf.file_previewer({}),
|
||||
sorter = conf.generic_sorter({}),
|
||||
}):find()
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>a', function() harpoon:list():add() end)
|
||||
vim.keymap.set('n', '<C-e>', function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
vim.keymap.set('n', '<leader><C-e>', function() toggle_telescope(harpoon:list()) end,
|
||||
{ desc = 'Open harpoon window' })
|
||||
|
||||
vim.keymap.set('n', '<C-h>', function() harpoon:list():select(1) end)
|
||||
vim.keymap.set('n', '<C-j>', function() harpoon:list():select(2) end)
|
||||
vim.keymap.set('n', '<C-k>', function() harpoon:list():select(3) end)
|
||||
vim.keymap.set('n', '<C-l>', function() harpoon:list():select(4) end)
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
return { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }
|
||||
return { 'lukas-reineke/indent-blankline.nvim', main = 'ibl', opts = {} }
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
return {
|
||||
{
|
||||
"nvim-lua/plenary.nvim",
|
||||
name = "plenary"
|
||||
'nvim-lua/plenary.nvim',
|
||||
name = 'plenary'
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -1,92 +1,108 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
'neovim/nvim-lspconfig',
|
||||
version = '^2.3.0',
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"SergioRibera/cmp-dotenv",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"j-hui/fidget.nvim",
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'saghen/blink.cmp',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'j-hui/fidget.nvim',
|
||||
'rafamadriz/friendly-snippets',
|
||||
{ 'towolf/vim-helm', ft = 'helm' },
|
||||
{
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua', -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
-- See the configuration section for more details
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require("luasnip")
|
||||
vim.diagnostic.config({ virtual_text = false })
|
||||
|
||||
require("fidget").setup({})
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
-- load snippets from friendly-snippets
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
|
||||
require('fidget').setup({})
|
||||
require('mason').setup({})
|
||||
---@module 'mason-lspconfig'
|
||||
---@type MasonLspconfigSettings
|
||||
require('mason-lspconfig').setup({
|
||||
automatic_enable = true,
|
||||
-- Replace the language servers listed here
|
||||
-- with the ones you want to install
|
||||
ensure_installed = { 'tsserver', 'lua_ls', 'gopls', 'pylsp', 'gitlab_ci_ls', 'yamlls' },
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup({})
|
||||
end,
|
||||
ensure_installed = {
|
||||
'ts_ls',
|
||||
'lua_ls',
|
||||
'gopls',
|
||||
'pylsp',
|
||||
'gitlab_ci_ls',
|
||||
'yamlls',
|
||||
'ansiblels',
|
||||
'terraformls',
|
||||
'helm_ls',
|
||||
'marksman',
|
||||
},
|
||||
})
|
||||
|
||||
local lazydev = require('lazydev')
|
||||
lazydev.setup()
|
||||
vim.lsp.config('lua_ls', {
|
||||
root_dir = function(bufnr, on_dir) on_dir(lazydev.find_workspace(bufnr)) end
|
||||
})
|
||||
|
||||
---@type lspconfig.Config
|
||||
vim.lsp.config('pylsp', {
|
||||
settings = {
|
||||
['pylsp'] = {
|
||||
plugins = {
|
||||
autopep8 = {
|
||||
enabled = false,
|
||||
},
|
||||
yapf = {
|
||||
enabled = true,
|
||||
},
|
||||
pycodestyle = {
|
||||
ignore = { 'W391' },
|
||||
maxLineLength = 95,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'dotenv' },
|
||||
{ name = 'luasnip', keyword_length = 2 },
|
||||
{ name = 'buffer', keyword_length = 3 },
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- `Enter` key to confirm completion
|
||||
['<CR>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
else
|
||||
cmp.confirm({
|
||||
select = true,
|
||||
})
|
||||
end
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
-- Ctrl+Space to trigger completion menu
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
|
||||
-- Scroll up and down in the completion documentation
|
||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- leave it until it works with lsp.config
|
||||
lspconfig.helm_ls.setup {
|
||||
settings = {
|
||||
['helm-ls'] = {
|
||||
yamlls = {
|
||||
enabled = false,
|
||||
path = "yaml-language-server",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-- vim.lsp.config('helm-ls', {
|
||||
-- settings = {
|
||||
-- ['helm-ls'] = {
|
||||
-- yamlls = {
|
||||
-- path = "yaml-language-server",
|
||||
-- enabled = false,
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
-- })
|
||||
|
||||
vim.lsp.config('terraformls', {
|
||||
filetypes = { 'terraform', 'terraform-vars', 'tf' }
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons', branch = 'master' },
|
||||
dependencies = {
|
||||
{ 'nvim-tree/nvim-web-devicons', branch = 'master', },
|
||||
'SmiteshP/nvim-navic',
|
||||
},
|
||||
config = function()
|
||||
local colors = {
|
||||
black = '#282828',
|
||||
@@ -51,16 +54,16 @@ return {
|
||||
},
|
||||
sections = {
|
||||
lualine_c = {
|
||||
'filename',
|
||||
function()
|
||||
return require("nvim-treesitter").statusline({
|
||||
indicator_size = 70,
|
||||
type_patterns = { "class", "function", "method" },
|
||||
separator = " -> ",
|
||||
})
|
||||
end,
|
||||
{
|
||||
'filename',
|
||||
path = 1,
|
||||
},
|
||||
{
|
||||
'navic',
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
12
lua/crentist/lazy/markdown.lua
Normal file
12
lua/crentist/lazy/markdown.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
'MeanderingProgrammer/render-markdown.nvim',
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
|
||||
---@module 'render-markdown'
|
||||
---@type render.md.UserConfig
|
||||
opts = {
|
||||
completions = {
|
||||
blink = { enabled = true }
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
16
lua/crentist/lazy/navic.lua
Normal file
16
lua/crentist/lazy/navic.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
'SmiteshP/nvim-navic',
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig'
|
||||
},
|
||||
config = function ()
|
||||
local navic = require('nvim-navic')
|
||||
navic.setup({
|
||||
lsp = {
|
||||
auto_attach = true,
|
||||
preference = { 'helm_ls', 'yamlls' }
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
return {
|
||||
{ "folke/neodev.nvim", opts = {} }
|
||||
}
|
||||
11
lua/crentist/lazy/none-ls.lua
Normal file
11
lua/crentist/lazy/none-ls.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
'nvimtools/none-ls.nvim',
|
||||
-- Optional dependencies
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
opts = {},
|
||||
config = function()
|
||||
local null_ls = require('null-ls')
|
||||
null_ls.setup({})
|
||||
end
|
||||
}
|
||||
|
||||
57
lua/crentist/lazy/obsidian.lua
Normal file
57
lua/crentist/lazy/obsidian.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
return {
|
||||
'obsidian-nvim/obsidian.nvim',
|
||||
version = '*', -- recommended, use latest release instead of latest commit
|
||||
dependencies = {
|
||||
-- Required.
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
keys = {
|
||||
{ '<leader>ot', '<cmd>ObsidianToday<CR>', desc = "Open today's daily note" },
|
||||
{ '<leader>os', '<cmd>ObsidianQuickSwitch<CR>', desc = 'Search notes in my vault and switch to selected' },
|
||||
},
|
||||
mappings = {
|
||||
-- Overrides the 'gf' mapping to work on markdown/wiki links within your vault.
|
||||
["gf"] = {
|
||||
action = function()
|
||||
return require("obsidian").util.gf_passthrough()
|
||||
end,
|
||||
opts = { noremap = false, expr = true, buffer = true },
|
||||
},
|
||||
-- Toggle check-boxes.
|
||||
["<leader>ch"] = {
|
||||
action = function()
|
||||
return require("obsidian").util.toggle_checkbox()
|
||||
end,
|
||||
opts = { buffer = true },
|
||||
},
|
||||
-- Smart action depending on context, either follow link or toggle checkbox.
|
||||
["<cr>"] = {
|
||||
action = function()
|
||||
return require("obsidian").util.smart_action()
|
||||
end,
|
||||
opts = { buffer = true, expr = true },
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
workspaces = {
|
||||
{
|
||||
name = 'tech-work-hobby',
|
||||
path = '/Users/rtim/Documents/Notes/tech-work-hobby/',
|
||||
},
|
||||
},
|
||||
daily_notes = {
|
||||
folder = 'Daily',
|
||||
date_format = '%Y-%m-%d (%A)',
|
||||
default_tags = { 'daily' },
|
||||
template = 'Daily.md',
|
||||
},
|
||||
templates = {
|
||||
folder = 'Templates',
|
||||
},
|
||||
completion = {
|
||||
blink = true,
|
||||
nvim_cmp = false,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
20
lua/crentist/lazy/oil.lua
Normal file
20
lua/crentist/lazy/oil.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
return {
|
||||
'stevearc/oil.nvim',
|
||||
-- Optional dependencies
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
opts = {},
|
||||
config = function()
|
||||
require('oil').setup({
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
},
|
||||
keymaps = {
|
||||
['<C-h>'] = false,
|
||||
['<C-j>'] = false,
|
||||
['<C-k>'] = false,
|
||||
['<C-l>'] = false,
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
56
lua/crentist/lazy/pairs.lua
Normal file
56
lua/crentist/lazy/pairs.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
return {
|
||||
'echasnovski/mini.pairs',
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
modes = { insert = true, command = true, terminal = false },
|
||||
-- skip autopair when next character is one of these
|
||||
skip_next = [=[[%w%%%'%[%"%.%`%$]]=],
|
||||
-- skip autopair when the cursor is inside these treesitter nodes
|
||||
skip_ts = { "string" },
|
||||
-- skip autopair when next character is closing pair
|
||||
-- and there are more closing pairs than opening pairs
|
||||
skip_unbalanced = true,
|
||||
-- better deal with markdown code blocks
|
||||
markdown = true,
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
local pairs = require("mini.pairs")
|
||||
pairs.setup(opts)
|
||||
local open = pairs.open
|
||||
pairs.open = function(pair, neigh_pattern)
|
||||
if vim.fn.getcmdline() ~= "" then
|
||||
return open(pair, neigh_pattern)
|
||||
end
|
||||
local o, c = pair:sub(1, 1), pair:sub(2, 2)
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local next = line:sub(cursor[2] + 1, cursor[2] + 1)
|
||||
local before = line:sub(1, cursor[2])
|
||||
if opts.markdown and o == "`" and vim.bo.filetype == "markdown" and before:match("^%s*``") then
|
||||
return "`\n```" .. vim.api.nvim_replace_termcodes("<up>", true, true, true)
|
||||
end
|
||||
if opts.skip_next and next ~= "" and next:match(opts.skip_next) then
|
||||
return o
|
||||
end
|
||||
if opts.skip_ts and #opts.skip_ts > 0 then
|
||||
local ok, captures = pcall(vim.treesitter.get_captures_at_pos, 0, cursor[1] - 1,
|
||||
math.max(cursor[2] - 1, 0))
|
||||
for _, capture in ipairs(ok and captures or {}) do
|
||||
if vim.tbl_contains(opts.skip_ts, capture.capture) then
|
||||
return o
|
||||
end
|
||||
end
|
||||
end
|
||||
if opts.skip_unbalanced and next == c and c ~= o then
|
||||
local _, count_open = line:gsub(vim.pesc(pair:sub(1, 1)), "")
|
||||
local _, count_close = line:gsub(vim.pesc(pair:sub(2, 2)), "")
|
||||
if count_close > count_open then
|
||||
return o
|
||||
end
|
||||
end
|
||||
return open(pair, neigh_pattern)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
45
lua/crentist/lazy/parrot.lua
Normal file
45
lua/crentist/lazy/parrot.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
return {
|
||||
'frankroeder/parrot.nvim',
|
||||
version = "2.1.0",
|
||||
dependencies = { 'ibhagwan/fzf-lua', 'nvim-lua/plenary.nvim' },
|
||||
opts = {
|
||||
providers = {
|
||||
anthropic = {
|
||||
name = "anthropic",
|
||||
endpoint = "https://api.anthropic.com/v1/messages",
|
||||
model_endpoint = "https://api.anthropic.com/v1/models",
|
||||
api_key = { "/usr/local/bin/sops", "--config", "/dev/null", "-d", vim.fn.expand("$HOME") .. "/.claude-api" },
|
||||
headers = function(self)
|
||||
return {
|
||||
["Content-Type"] = "application/json",
|
||||
["x-api-key"] = self.api_key,
|
||||
["anthropic-version"] = "2023-06-01",
|
||||
}
|
||||
end,
|
||||
params = {
|
||||
chat = { max_tokens = 4096 },
|
||||
command = { max_tokens = 4096 },
|
||||
},
|
||||
models = {
|
||||
"claude-sonnet-4-20250514",
|
||||
"claude-3-7-sonnet-20250219",
|
||||
"claude-3-5-sonnet-20241022",
|
||||
"claude-3-5-haiku-20241022",
|
||||
},
|
||||
preprocess_payload = function(payload)
|
||||
for _, message in ipairs(payload.messages) do
|
||||
message.content = message.content:gsub("^%s*(.-)%s*$", "%1")
|
||||
end
|
||||
if payload.messages[1] and payload.messages[1].role == "system" then
|
||||
-- remove the first message that serves as the system prompt as anthropic
|
||||
-- expects the system prompt to be part of the API call body and not the messages
|
||||
payload.system = payload.messages[1].content
|
||||
table.remove(payload.messages, 1)
|
||||
end
|
||||
return payload
|
||||
end,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
lua/crentist/lazy/sops.lua
Normal file
10
lua/crentist/lazy/sops.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
'lucidph3nx/nvim-sops',
|
||||
event = { 'BufEnter' },
|
||||
opts = { },
|
||||
keys = {
|
||||
{ '<leader>ef', vim.cmd.SopsEncrypt, desc = '[E]ncrypt [F]ile' },
|
||||
{ '<leader>df', vim.cmd.SopsDecrypt, desc = '[D]ecrypt [F]ile' },
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@ return {
|
||||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-surround").setup({
|
||||
-- Configuration here, or leave empty to use defaults
|
||||
})
|
||||
require("nvim-surround").setup({})
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,39 @@
|
||||
return {
|
||||
"FabianWirth/search.nvim",
|
||||
'FabianWirth/search.nvim',
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
'nvim-lua/plenary.nvim',
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = {
|
||||
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
version = "0.1.6",
|
||||
|
||||
config = function()
|
||||
require('telescope').setup({})
|
||||
local telescope = require('telescope')
|
||||
local telescopeConfig = require('telescope.config')
|
||||
|
||||
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
|
||||
table.insert(vimgrep_arguments, '--hidden')
|
||||
table.insert(vimgrep_arguments, '--glob')
|
||||
table.insert(vimgrep_arguments, '!**/.git/*')
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
vimgrep_arguments = vimgrep_arguments,
|
||||
file_ignore_patterns = {
|
||||
'node_modules',
|
||||
'.git/'
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
fzf = {}
|
||||
}
|
||||
})
|
||||
|
||||
telescope.load_extension('fzf')
|
||||
|
||||
local search = require('search')
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
@@ -17,9 +42,14 @@ return {
|
||||
next = '<Tab>',
|
||||
prev = '<S-Tab>'
|
||||
},
|
||||
tabs = {
|
||||
{ name = 'Files', tele_func = builtin.find_files, tele_opts = { no_ignore = true, hidden = true } },
|
||||
{ name = 'Grep', tele_func = builtin.live_grep },
|
||||
{ name = 'Buffers', tele_func = builtin.buffers },
|
||||
},
|
||||
append_tabs = { -- append_tabs will add the provided tabs to the default ones
|
||||
{
|
||||
'Commits', -- or name = "Commits"
|
||||
'Commits', -- or name = 'Commits'
|
||||
builtin.git_commits, -- or tele_func = require('telescope.builtin').git_commits
|
||||
available = function() -- optional
|
||||
return vim.fn.isdirectory('.git') == 1
|
||||
@@ -29,17 +59,21 @@ return {
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<leader>pf', search.open, {})
|
||||
vim.keymap.set('n', '<leader>pb', function()
|
||||
search.open({ tab_name = 'Buffers' })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>pws', function()
|
||||
local word = vim.fn.expand("<cword>")
|
||||
local word = vim.fn.expand('<cword>')
|
||||
builtin.grep_string({ search = word })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>pWs', function()
|
||||
local word = vim.fn.expand("<cWORD>")
|
||||
local word = vim.fn.expand('<cWORD>')
|
||||
builtin.grep_string({ search = word })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||
builtin.grep_string({ search = vim.fn.input('Grep > ') })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
branch='master',
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
@@ -28,3 +29,4 @@ return {
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
37
lua/crentist/lazy/trouble.lua
Normal file
37
lua/crentist/lazy/trouble.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
return {
|
||||
"folke/trouble.nvim",
|
||||
opts = {}, -- for default options, refer to the configuration section for custom setup.
|
||||
cmd = "Trouble",
|
||||
keys = {
|
||||
{
|
||||
"<leader>tt",
|
||||
"<cmd>Trouble diagnostics toggle<cr>",
|
||||
desc = "Diagnostics (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>tT",
|
||||
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
|
||||
desc = "Buffer Diagnostics (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>ts",
|
||||
"<cmd>Trouble symbols toggle focus=false<cr>",
|
||||
desc = "Symbols (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>tl",
|
||||
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
|
||||
desc = "LSP Definitions / references / ... (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>tL",
|
||||
"<cmd>Trouble loclist toggle<cr>",
|
||||
desc = "Location List (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>tQ",
|
||||
"<cmd>Trouble qflist toggle<cr>",
|
||||
desc = "Quickfix List (Trouble)",
|
||||
},
|
||||
},
|
||||
}
|
||||
43
lua/crentist/lazy/ufo.lua
Normal file
43
lua/crentist/lazy/ufo.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
return {
|
||||
'kevinhwang91/nvim-ufo',
|
||||
event = 'BufReadPost',
|
||||
dependencies = {
|
||||
'kevinhwang91/promise-async',
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
{
|
||||
'luukvbaal/statuscol.nvim',
|
||||
config = function()
|
||||
local builtin = require('statuscol.builtin')
|
||||
require('statuscol').setup({
|
||||
relculright = true,
|
||||
segments = {
|
||||
{ text = { builtin.foldfunc }, sign = { colwidth = 1 }, click = 'v:lua.ScFa', },
|
||||
{ text = { '%s' }, sign = { colwidth = 1 }, click = 'v:lua.ScSa', hl = 'FoldColumn' },
|
||||
{ text = { builtin.lnumfunc, ' ' }, click = 'v:lua.ScLa', hl = 'FoldColumn' },
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
||||
},
|
||||
init = function()
|
||||
vim.opt.foldenable = true
|
||||
vim.opt.foldcolumn = '1'
|
||||
vim.opt.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.opt.foldlevelstart = 99
|
||||
vim.opt.fillchars = 'eob: ,fold: ,foldopen:,foldsep: ,foldclose:'
|
||||
vim.opt.foldtext = ''
|
||||
end,
|
||||
opts = {
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
return { 'treesitter', 'indent' }
|
||||
end
|
||||
},
|
||||
config = function()
|
||||
require('ufo').setup({
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
return { 'treesitter', 'indent' }
|
||||
end
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
return {
|
||||
'ThePrimeagen/vim-be-good'
|
||||
}
|
||||
128
lua/crentist/luasnip.lua
Normal file
128
lua/crentist/luasnip.lua
Normal file
@@ -0,0 +1,128 @@
|
||||
-- luasnip.lua
|
||||
local ls = require('luasnip')
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
vim.keymap.set({ "i", "s" }, "<C-l>", function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end, { desc = "Snippet next argument", silent = true })
|
||||
|
||||
--------------------
|
||||
-- Snippets for LUA
|
||||
--------------------
|
||||
ls.add_snippets('lua', {
|
||||
s({ name = 'LuaSnip Snippet', trig = 'snipf' },
|
||||
fmt([[
|
||||
s({ name='<name>', trig='<trig>'},
|
||||
fmt(<template>,
|
||||
{ <inputs> },
|
||||
{ <opts> }
|
||||
)
|
||||
),
|
||||
]], {
|
||||
name = i(1, 'name'),
|
||||
trig = i(2, 'trig'),
|
||||
template = i(3, '[[]]'),
|
||||
inputs = i(4, 'nodes'),
|
||||
opts = i(5,
|
||||
'opts')
|
||||
},
|
||||
{ delimiters = '<>' }
|
||||
)
|
||||
),
|
||||
s({ name = 'Add snippets block', trig = 'add_snip' },
|
||||
fmt([[
|
||||
ls.add_snippets('<filetype>', {
|
||||
<snippets>
|
||||
})
|
||||
]],
|
||||
{ filetype = i(1, 'Filetype'), snippets = i(2, 'Snippets') },
|
||||
{ delimiters = '<>' }
|
||||
)
|
||||
),
|
||||
})
|
||||
|
||||
--------------------
|
||||
-- Generic snippets
|
||||
--------------------
|
||||
local function com_string(_, snip, to_multiply)
|
||||
local comment_string = vim.bo.commentstring
|
||||
local repeats = snip.captures[1]
|
||||
local result = comment_string:gsub("%%s", ""):gsub(" ", "")
|
||||
|
||||
if to_multiply then
|
||||
return string.sub(
|
||||
string.rep(result, repeats),
|
||||
0,
|
||||
repeats
|
||||
)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
ls.add_snippets('all', {
|
||||
s({ name = 'Comment block', trig = '#com(%d+)', regTrig = true },
|
||||
fmt([[
|
||||
{comment_block}
|
||||
{comment} {comment_text}
|
||||
{comment_block}
|
||||
]],
|
||||
{
|
||||
comment_block = f(com_string, {}, { user_args = { true } }),
|
||||
comment = f(com_string, {}, { user_args = { false } }),
|
||||
comment_text = i(1,
|
||||
'Comment')
|
||||
}
|
||||
)
|
||||
),
|
||||
})
|
||||
|
||||
--------------------
|
||||
-- Terraform
|
||||
--------------------
|
||||
ls.add_snippets('terraform', {
|
||||
s({ name = 'data_assume', trig = 'tf_assume' },
|
||||
fmt([[
|
||||
data "aws_iam_policy_document" "<name>" {
|
||||
statement {
|
||||
actions = ["sts:AssumeRole"]
|
||||
|
||||
principals {
|
||||
type = "Service"
|
||||
identifiers = ["<service>.amazonaws.com"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]],
|
||||
{
|
||||
name = i(1, 'assume'),
|
||||
service = i(2, 'service')
|
||||
},
|
||||
{ delimiters = '<>' }
|
||||
)
|
||||
),
|
||||
})
|
||||
|
||||
------------------------------
|
||||
-- YAML
|
||||
------------------------------
|
||||
local yaml_schema_snippet = s(
|
||||
{ name = 'yaml_schema', trig = 'yaml_schema' },
|
||||
fmt([[
|
||||
{comment} yaml-language-server: $schema={path}
|
||||
]],
|
||||
{
|
||||
path = i(1, 'path'),
|
||||
comment = f(com_string, {}, { user_args = { false } }),
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
ls.add_snippets('yaml', { yaml_schema_snippet })
|
||||
ls.add_snippets('helm', { yaml_schema_snippet })
|
||||
|
||||
56
lua/crentist/null-ls.lua
Normal file
56
lua/crentist/null-ls.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
local null_ls = require('null-ls')
|
||||
local plenary = require('plenary')
|
||||
|
||||
local kustomize_condition = function(node, params)
|
||||
if node == nil then return false end
|
||||
|
||||
if vim.treesitter.get_node_text(node, params['bufnr']) ~= 'resources' then return false end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---@module 'null-ls'
|
||||
---@type
|
||||
local kustomize_action = {
|
||||
method = null_ls.methods.CODE_ACTION,
|
||||
filetypes = { 'yaml' },
|
||||
generator = {
|
||||
fn = function(params)
|
||||
local out = {}
|
||||
local node = vim.treesitter.get_node()
|
||||
if kustomize_condition(node, params) then
|
||||
table.insert(out, {
|
||||
title = '📁 Create resources',
|
||||
action = function()
|
||||
local node_below = vim.treesitter.get_node({ bufnr = 0, pos = { params['row'] + 1, 0 } })
|
||||
|
||||
if node_below == nil or node_below:type() ~= 'block_sequence' then
|
||||
vim.api.nvim_echo({ { '❌Failed to get list items.', 'Normal' } }, false, {})
|
||||
return
|
||||
end
|
||||
|
||||
local checked_files = ''
|
||||
for list_item, _ in node_below:iter_children() do
|
||||
if list_item ~= nil then
|
||||
local item_value_node = list_item:child(1) -- 0 is `-`, 1 is the actual value
|
||||
if item_value_node ~= nil then
|
||||
local file_name = vim.treesitter.get_node_text(item_value_node, params['bufnr'])
|
||||
local file_name_path = plenary.path.new(file_name)
|
||||
local current_file = plenary.path.new(vim.fn.expand('%'))
|
||||
local parent = plenary.path.new(current_file:parents()[1])
|
||||
local new_file = parent / file_name
|
||||
new_file:touch({mode=644})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
return out
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
-- null_ls.deregister(kustomize_action)
|
||||
null_ls.register(kustomize_action)
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
vim.keymap.set("n", "<leader>Pv", ":Oil .<CR>")
|
||||
vim.keymap.set("n", "<leader>pv", ":Oil<CR>")
|
||||
|
||||
-- move selected blocks
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
|
||||
-- move selected blocks
|
||||
vim.keymap.set("v", "<S-J>", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "<S-K>", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- keep cursor on J
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
-- keep search in the middle
|
||||
-- keep search in the middle
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
-- greatest remap ever
|
||||
-- save register on pasting
|
||||
-- save register on pasting
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]])
|
||||
|
||||
-- next greatest remap ever : asbjornHaland
|
||||
@@ -24,3 +28,14 @@ vim.keymap.set({"n", "v"}, "<leader>d", [["_d]])
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
|
||||
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
vim.keymap.set("n", "<leader>S", [[:%s/\<<C-r><C-a>\>/<C-r><C-a>/gI<Left><Left><Left>]])
|
||||
|
||||
vim.keymap.set("n", "<C-s>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
|
||||
|
||||
vim.keymap.set("n", "<leader><leader>x", "<cmd>source %<CR>")
|
||||
vim.keymap.set("n", "<leader>x", ":.lua<CR>")
|
||||
vim.keymap.set("v", "<leader>x", ":lua<CR>")
|
||||
|
||||
vim.keymap.set("n", "<C-M-j>", "<cmd>cnext<CR>")
|
||||
vim.keymap.set("n", "<C-M-k>", "<cmd>cprev<CR>")
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ vim.opt.incsearch = true
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.signcolumn = "yes:1"
|
||||
vim.opt.isfname:append("@-@")
|
||||
|
||||
vim.opt.updatetime = 50
|
||||
|
||||
Reference in New Issue
Block a user