Compare commits
47 Commits
v1.0.0
...
aede270a03
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
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
|
||||
|
||||
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,43 +1,43 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" },
|
||||
"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" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "c5775a888adbc50652cb370073fcfec963eca93e" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
|
||||
"git-blame.nvim": { "branch": "master", "commit": "50543e3993f4b996eea01ff5ccc8fe2a354c5388" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "7a1b23e4edf73a39642e77508ee6b9cbb8c60f9e" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
|
||||
"hererocks": { "branch": "master", "commit": "8bd2fcfdd65cfa7535ce39ea372a63b0bdb8e528" },
|
||||
"icon-picker.nvim": { "branch": "master", "commit": "3ee9a0ea9feeef08ae35e40c8be6a2fa2c20f2d3" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "fd2badc24e675f947162a16c124d395bde80dbd6" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"blink-ripgrep.nvim": { "branch": "main", "commit": "12fb7348cf9d32a0ed2e3ab4960d561632e57ba4" },
|
||||
"blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"fzf-lua": { "branch": "main", "commit": "c53ba4f40f0514a5038646fb1e9ce05872b18eb1" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "88205953bd748322b49b26e1dfb0389932520dc9" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "00e38a379bab3389e187b3953566d67d494dfddd" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
|
||||
"hererocks": { "branch": "master", "commit": "4ce92131e9858950440ab99a25db9a9b43db8cd4" },
|
||||
"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": "f54e3c11fc9ebfcfc27e696182b0295b071d0811" },
|
||||
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
||||
"mini.pairs": { "branch": "main", "commit": "42407ccb80ec59c84e7c91d815f42ed90a8cc093" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "db2a48b79cfcdab8baa5d3f37f21c78b6705c62e" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "bdbc65aadc708ce528efb22bca5f82a7cca6b54d" },
|
||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "056f569f71e4b726323b799b9cfacc53653bceb3" },
|
||||
"nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" },
|
||||
"nvim-sops": { "branch": "main", "commit": "cb2209562d00ef8c6c88bdec836d9edb8fbb96ef" },
|
||||
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "00f128dd73086aa578dc3d9142de06c633b7c685" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "9793801f974bba70e4ac5d7eae6c4f5659993d8e" },
|
||||
"oil.nvim": { "branch": "master", "commit": "1fe476daf0b3c108cb8ee1fc1226cc282fa2c9c1" },
|
||||
"plenary": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
|
||||
"nvim-surround": { "branch": "main", "commit": "8dd9150ca7eae5683660ea20cec86edcd5ca4046" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "80fe8215ba566df2fbf3bf4d25f59ff8f41bc0e1" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
||||
"obsidian.nvim": { "branch": "main", "commit": "2f0222b3eb20382cadf3e1d91f368318b768771c" },
|
||||
"oil.nvim": { "branch": "master", "commit": "08c2bce8b00fd780fb7999dbffdf7cd174e896fb" },
|
||||
"parrot.nvim": { "branch": "main", "commit": "0477748832812707e53db078d0180299a0c15d6c" },
|
||||
"plenary": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
||||
"search.nvim": { "branch": "main", "commit": "7b8f2315d031be73e14bc2d82386dfac15952614" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
|
||||
"undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" },
|
||||
"vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" },
|
||||
"vim-gitgutter": { "branch": "main", "commit": "7b0b5098e3e57be86bb96cfbf2b8902381eef57c" },
|
||||
"vim-helm": { "branch": "master", "commit": "ae1ebc160d2b9b90108477ab10df7a4fc501e358" }
|
||||
"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": "b951b87b46c34356d44aa71886aecf9dd7f5788a" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
|
||||
"vim-helm": { "branch": "master", "commit": "cc5ac22444332381f38084a6c7f023c25eef6201" }
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ 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)
|
||||
@@ -13,17 +15,17 @@ autocmd('LspAttach', {
|
||||
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>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>", "<cmd>lua vim.lsp.buf.format()<CR>")
|
||||
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" }, {
|
||||
autocmd({ 'BufWritePre' }, {
|
||||
group = OnSaveGroup,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
@@ -37,7 +39,7 @@ autocmd({ "BufWritePre" }, {
|
||||
})
|
||||
|
||||
-- Remove trailing spaces
|
||||
autocmd({ "BufWritePre" }, {
|
||||
autocmd({ 'BufWritePre' }, {
|
||||
group = OnSaveGroup,
|
||||
pattern = { "*" },
|
||||
callback = function()
|
||||
@@ -47,3 +49,11 @@ autocmd({ "BufWritePre" }, {
|
||||
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
|
||||
})
|
||||
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
["tf"] = "terraform",
|
||||
['tf'] = 'terraform',
|
||||
},
|
||||
pattern = {
|
||||
[".*/playbooks/.*%.ya?ml"] = "yaml.ansible",
|
||||
[".*/roles/.*%.ya?ml"] = "yaml.ansible",
|
||||
[".*/tasks/.*%.ya?ml"] = "yaml.ansible",
|
||||
[".*/plays/.*%.ya?ml"] = "yaml.ansible",
|
||||
['.*/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,6 +1,8 @@
|
||||
require("crentist.remap")
|
||||
require("crentist.set")
|
||||
require("crentist.autocmd")
|
||||
require("crentist.lazy_init")
|
||||
require("crentist.autocmd")
|
||||
require("crentist.filetype")
|
||||
require("crentist.luasnip")
|
||||
require("crentist.null-ls")
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = "InsertEnter",
|
||||
config = true
|
||||
}
|
||||
@@ -1,20 +1,40 @@
|
||||
return {
|
||||
{
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("gruvbox").setup({
|
||||
local gruvbox = require('gruvbox')
|
||||
|
||||
gruvbox.setup({
|
||||
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 = '' },
|
||||
}
|
||||
})
|
||||
vim.cmd("colorscheme gruvbox")
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
85
lua/crentist/lazy/completion.lua
Normal file
85
lua/crentist/lazy/completion.lua
Normal file
@@ -0,0 +1,85 @@
|
||||
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.4.*',
|
||||
|
||||
opts = {
|
||||
fuzzy = { implementation = 'prefer_rust_with_warning' },
|
||||
|
||||
snippets = {
|
||||
preset = 'luasnip',
|
||||
},
|
||||
|
||||
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 = -2,
|
||||
-- the options below are optional, some default values are shown
|
||||
---@module 'blink-ripgrep'
|
||||
---@type blink-ripgrep.Options
|
||||
opts = {
|
||||
max_filesize = '1M',
|
||||
project_root_marker = '.git',
|
||||
project_root_fallback = true,
|
||||
search_casing = '--ignore-case',
|
||||
additional_rg_options = {},
|
||||
fallback_to_regex_highlighting = true,
|
||||
ignore_paths = {},
|
||||
additional_paths = {},
|
||||
future_features = {
|
||||
backend = {
|
||||
use = 'ripgrep',
|
||||
},
|
||||
},
|
||||
debug = false,
|
||||
},
|
||||
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 }
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ return {
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
|
||||
require("telescope.pickers").new({}, {
|
||||
require('telescope.pickers').new({}, {
|
||||
prompt_title = "Harpoon",
|
||||
finder = require("telescope.finders").new_table({
|
||||
results = file_paths,
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
return {
|
||||
"ziontee113/icon-picker.nvim",
|
||||
config = function()
|
||||
require("icon-picker").setup({ disable_legacy_commands = true })
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
vim.keymap.set("n", "<Leader><Leader>i", "<cmd>IconPickerNormal<cr>", opts)
|
||||
vim.keymap.set("n", "<Leader><Leader>y", "<cmd>IconPickerYank<cr>", opts) --> Yank the selected icon into register
|
||||
vim.keymap.set("i", "<C-i>", "<cmd>IconPickerInsert<cr>", opts)
|
||||
end
|
||||
}
|
||||
@@ -1,26 +1,31 @@
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
tag = 'v1.0.0',
|
||||
dependencies = {
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'hrsh7th/nvim-cmp',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'SergioRibera/cmp-dotenv',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'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 lspconfig = require('lspconfig')
|
||||
vim.diagnostic.config({ virtual_text = false })
|
||||
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
-- load snippets from friendly-snippets
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
@@ -28,10 +33,11 @@ return {
|
||||
require('fidget').setup({})
|
||||
require('mason').setup({})
|
||||
require('mason-lspconfig').setup({
|
||||
automatic_installation = false,
|
||||
-- Replace the language servers listed here
|
||||
-- with the ones you want to install
|
||||
ensure_installed = {
|
||||
'tsserver',
|
||||
'ts_ls',
|
||||
'lua_ls',
|
||||
'gopls',
|
||||
'pylsp',
|
||||
@@ -39,80 +45,30 @@ return {
|
||||
'yamlls',
|
||||
'ansiblels',
|
||||
'terraformls',
|
||||
'helm_ls'
|
||||
'helm_ls',
|
||||
'marksman',
|
||||
},
|
||||
handlers = {
|
||||
function(server_name)
|
||||
if server_name == 'tsserver' then
|
||||
server_name = 'ts_ls'
|
||||
end
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
require('lspconfig')[server_name].setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
end,
|
||||
}
|
||||
})
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip', keyword_length = 2 },
|
||||
{ name = 'buffer', keyword_length = 3 },
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- `Enter` key to confirm completion
|
||||
['<CR>'] = cmp.mapping({
|
||||
i = function(fallback)
|
||||
if cmp.visible() and cmp.get_active_entry() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
s = cmp.mapping.confirm({ select = true }),
|
||||
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||
}),
|
||||
['<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,
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
local pythonLineLength = 95
|
||||
lspconfig.pylsp.setup {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
autopep8 = {
|
||||
enabled = false,
|
||||
},
|
||||
yapf = {
|
||||
enabled = true,
|
||||
},
|
||||
pycodestyle = {
|
||||
ignore = { 'W391' },
|
||||
maxLineLength = pythonLineLength
|
||||
@@ -123,37 +79,8 @@ return {
|
||||
}
|
||||
lspconfig.ansiblels.setup {}
|
||||
|
||||
lspconfig.lua_ls.setup {
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if vim.loop.fs_stat(path .. '/.luarc.json') or vim.loop.fs_stat(path .. '/.luarc.jsonc') then
|
||||
return
|
||||
end
|
||||
lspconfig.lua_ls.setup {}
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
-- Depending on the usage, you might want to add additional paths here.
|
||||
-- '${3rd}/luv/library'
|
||||
-- '${3rd}/busted/library',
|
||||
}
|
||||
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
||||
-- library = vim.api.nvim_get_runtime_file('', true)
|
||||
}
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {}
|
||||
}
|
||||
}
|
||||
lspconfig.helm_ls.setup {
|
||||
settings = {
|
||||
['helm-ls'] = {
|
||||
@@ -163,6 +90,19 @@ return {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lspconfig.yamlls.setup {}
|
||||
lspconfig.helm_ls.setup {
|
||||
settings = {
|
||||
['helm-ls'] = {
|
||||
yamlls = {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
lspconfig.terraformls.setup {
|
||||
filetypes = { 'terraform', 'terraform-vars', 'tf' }
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ return {
|
||||
lualine_c = {
|
||||
{
|
||||
'filename',
|
||||
path = 4,
|
||||
path = 1,
|
||||
},
|
||||
{
|
||||
'navic',
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ return {
|
||||
},
|
||||
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
return {
|
||||
'lucidph3nx/nvim-sops',
|
||||
event = { 'BufEnter' },
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,14 @@ return {
|
||||
'FabianWirth/search.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = {
|
||||
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
version = '0.1.6',
|
||||
|
||||
config = function()
|
||||
local telescope = require('telescope')
|
||||
local telescopeConfig = require('telescope.config')
|
||||
@@ -21,15 +24,16 @@ return {
|
||||
vimgrep_arguments = vimgrep_arguments,
|
||||
file_ignore_patterns = {
|
||||
'node_modules',
|
||||
'.git/'
|
||||
}
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
find_command = { 'rg', '--files', '--hidden', '--glob', '!**/.git/*' },
|
||||
}
|
||||
extensions = {
|
||||
fzf = {}
|
||||
}
|
||||
})
|
||||
|
||||
telescope.load_extension('fzf')
|
||||
|
||||
local search = require('search')
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
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 })
|
||||
|
||||
3
lua/crentist/null-ls.lua
Normal file
3
lua/crentist/null-ls.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
-- https://www.youtube.com/watch?v=q-oBU2fO1H4&t=189s
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.keymap.set("n", "<leader>pv", ":Oil .<CR>")
|
||||
vim.keymap.set("n", "<leader>Pv", ":Oil .<CR>")
|
||||
vim.keymap.set("n", "<leader>pv", ":Oil<CR>")
|
||||
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
@@ -30,3 +31,10 @@ vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<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