27 Commits

Author SHA1 Message Date
96004f4ce3 add nixd config, remove unwanted servers 2024-10-27 21:31:17 +02:00
231db82c0f add nix ft 2024-10-20 01:09:43 +03:00
7dcd4ec2f7 add luasnip snippets 2024-10-14 17:04:25 +03:00
b1a0742ffa rename tsserver to ts_ls 2024-10-09 22:23:24 +03:00
b10e7d85eb remove vim-be-good 2024-10-09 22:18:38 +03:00
e3c38b2da9 upgrade packages, add oil blank remap 2024-10-09 22:18:07 +03:00
3b65386a9f Upgrade 2024-10-08 00:00:44 +03:00
24b4c23635 update lazy 2024-10-07 20:30:45 +03:00
2338b310f2 add tmux-sessionizer keymap 2024-10-03 17:59:14 +03:00
758322bd93 formatting 2024-10-03 17:59:08 +03:00
1a2df25f5e add nvim-navic 2024-09-26 10:43:39 +03:00
aac1e91dcb ignore w391 for python 2024-09-10 17:42:00 +03:00
6d91d0c963 fix ts_ls thing, update lualine path 2024-09-07 11:30:51 +03:00
a33c92ce5b lsp: configure filetypes for tfls 2024-08-15 14:22:47 +03:00
4053addac9 add terraform ftplugin, add C-d and C-u remaps 2024-08-14 13:37:48 +03:00
751829deb0 harpoon: switch back to harpoon list 2024-08-06 13:50:42 +03:00
c0adfd43a1 configure harpoon to use telescope 2024-07-30 14:49:49 +03:00
69067d5410 add helm-ls 2024-07-30 14:49:43 +03:00
d91c167d6e oil: enable show_hidden by default 2024-07-25 13:03:33 +03:00
6a8be9a1e3 autocmd refactor 2024-07-25 12:58:37 +03:00
b685e528af add neovim config to lua-lsp 2024-07-25 12:56:11 +03:00
7200602b10 add autocmd file, add newline and whitespace trim commands 2024-07-25 12:55:52 +03:00
56316c6986 lsp: update CR mapping function 2024-07-24 11:43:30 +03:00
4ccc8ae093 add sops, change lsp select 2024-07-24 11:29:22 +03:00
8e153ee524 fix oil map, add ansible filetype 2024-07-02 14:00:16 +03:00
153f3d36c0 ignore node_modules, disable italic for strings 2024-06-22 22:48:31 +03:00
b71f7c2cce add more plugins, change some keybinds 2024-06-16 18:55:56 +03:00
22 changed files with 513 additions and 106 deletions

4
after/ftplugin/nix.lua Normal file
View File

@@ -0,0 +1,4 @@
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.expandtab = true

View File

@@ -0,0 +1 @@
vim.opt.colorcolumn = "95"

View 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'

View File

@@ -1 +1,2 @@
require("crentist")

View File

@@ -1,34 +1,41 @@
{
"LuaSnip": { "branch": "master", "commit": "2b6860d15aaab01d3fb90859c0ba97f20ad7bc5f" },
"LuaSnip": { "branch": "master", "commit": "787dee55ca364cc9119787165418fe93b74c1842" },
"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" },
"dressing.nvim": { "branch": "master", "commit": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2" },
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"git-blame.nvim": { "branch": "master", "commit": "2883a7460f611c2705b23f12d58d398d5ce6ec00" },
"gruvbox.nvim": { "branch": "main", "commit": "49d9c0b150ba70efcd831ec7b3cb8ee740067045" },
"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" },
"icon-picker.nvim": { "branch": "master", "commit": "3ee9a0ea9feeef08ae35e40c8be6a2fa2c20f2d3" },
"indent-blankline.nvim": { "branch": "master", "commit": "e7a4442e055ec953311e77791546238d1eaae507" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "7446f47b3dfb7df801f31a6f6783c2ad119a6935" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
"nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
"nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" },
"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": "056f569f71e4b726323b799b9cfacc53653bceb3" },
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
"nvim-sops": { "branch": "main", "commit": "cb2209562d00ef8c6c88bdec836d9edb8fbb96ef" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
"nvim-treesitter": { "branch": "master", "commit": "00d219068385a4aa80859d4606ad6e03af6faa83" },
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
"oil.nvim": { "branch": "master", "commit": "cca1631d5ea450c09ba72f3951a9e28105a3632c" },
"plenary": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"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" }
}
"telescope.nvim": { "branch": "master", "commit": "37dc9233a473dd6c3f54456ef9994d8f77c80211" },
"trouble.nvim": { "branch": "main", "commit": "2f3b537f2207ce32f4459f9d56746ee013b5e01b" },
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
"vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" },
"vim-gitgutter": { "branch": "main", "commit": "7b0b5098e3e57be86bb96cfbf2b8902381eef57c" },
"vim-helm": { "branch": "master", "commit": "ae1ebc160d2b9b90108477ab10df7a4fc501e358" }
}

49
lua/crentist/autocmd.lua Normal file
View File

@@ -0,0 +1,49 @@
local autocmd = vim.api.nvim_create_autocmd
local augroup = vim.api.nvim_create_augroup
local CrentistGroup = augroup('Crentist', {})
local OnSaveGroup = augroup('CrentistOnSave', {})
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
})
-- 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,
})

20
lua/crentist/filetype.lua Normal file
View 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',
}
})

View File

@@ -1,25 +1,7 @@
require("crentist.remap")
require("crentist.set")
require("crentist.autocmd")
require("crentist.lazy_init")
require("crentist.filetype")
require("crentist.luasnip")
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
})

View File

@@ -3,7 +3,11 @@ return {
"ellisonleao/gruvbox.nvim",
priority = 1000,
config = function()
require("gruvbox").setup({})
require("gruvbox").setup({
italic = {
strings = false,
}
})
vim.cmd("colorscheme gruvbox")
end
},

View File

@@ -0,0 +1,4 @@
return {
'stevearc/dressing.nvim',
opts = {},
}

View File

@@ -7,8 +7,28 @@ return {
harpoon:setup()
-- 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
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)
@@ -16,3 +36,4 @@ return {
vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end)
end
}

View File

@@ -0,0 +1,13 @@
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
}

View File

@@ -1,32 +1,46 @@
return {
"neovim/nvim-lspconfig",
'neovim/nvim-lspconfig',
tag = "v1.0.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',
'hrsh7th/nvim-cmp',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'SergioRibera/cmp-dotenv',
'hrsh7th/cmp-cmdline',
'saadparwaiz1/cmp_luasnip',
'L3MON4D3/LuaSnip',
'j-hui/fidget.nvim',
'rafamadriz/friendly-snippets',
{ 'towolf/vim-helm', ft = 'helm' },
},
config = function()
local cmp = require('cmp')
local luasnip = require("luasnip")
local lspconfig = require('lspconfig')
require("fidget").setup({})
local cmp = require('cmp')
local luasnip = require('luasnip')
-- load snippets from friendly-snippets
require('luasnip.loaders.from_vscode').lazy_load()
require('fidget').setup({})
require('mason').setup({})
require('mason-lspconfig').setup({
-- Replace the language servers listed here
-- with the ones you want to install
ensure_installed = { 'tsserver', 'lua_ls', 'gopls', 'pylsp', 'gitlab_ci_ls', 'yamlls' },
ensure_installed = {
'lua_ls',
'yamlls',
},
handlers = {
function(server_name)
require('lspconfig')[server_name].setup({})
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig')[server_name].setup({
capabilities = capabilities
})
end,
}
})
@@ -34,27 +48,23 @@ return {
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()
['<CR>'] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })
else
cmp.confirm({
select = true,
})
fallback()
end
else
fallback()
end
end),
["<Tab>"] = cmp.mapping(function(fallback)
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
@@ -62,9 +72,9 @@ return {
else
fallback()
end
end, { "i", "s" }),
end, { 'i', 's' }),
["<S-Tab>"] = cmp.mapping(function(fallback)
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
@@ -72,7 +82,7 @@ return {
else
fallback()
end
end, { "i", "s" }),
end, { 'i', 's' }),
-- Ctrl+Space to trigger completion menu
['<C-Space>'] = cmp.mapping.complete(),
@@ -88,5 +98,93 @@ return {
},
})
local pythonLineLength = 95
lspconfig.pylsp.setup {
settings = {
pylsp = {
plugins = {
pycodestyle = {
ignore = { 'W391' },
maxLineLength = pythonLineLength
}
}
}
}
}
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
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'] = {
yamlls = {
path = 'yaml-language-server',
}
}
}
}
lspconfig.terraformls.setup {
filetypes = { 'terraform', 'terraform-vars', 'tf' }
}
-- Add additional capabilities supported by nvim-cmp
-- nvim hasn't added foldingRange to default capabilities, users must add it manually
local capabilities = require("cmp_nvim_lsp").default_capabilities()
capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
lspconfig.nixd.setup({
capabilities = capabilities,
settings = {
nixd = {
nixpkgs = {
expr = "import <nixpkgs> { }",
},
formatting = {
command = { "alejandra" },
},
options = {
home_manager = {
expr = '(builtins.getFlake "~/.dotfiles/home-manager/").homeConfigurations.rtim.options',
},
},
}
},
})
end
}

View File

@@ -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 = 4,
},
{
'navic',
},
}
}
})
end
}

View File

@@ -0,0 +1,15 @@
return {
'SmiteshP/nvim-navic',
dependencies = {
'neovim/nvim-lspconfig'
},
config = function ()
local navic = require('nvim-navic')
navic.setup({
lsp = {
auto_attach = true
}
})
end
}

17
lua/crentist/lazy/oil.lua Normal file
View File

@@ -0,0 +1,17 @@
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,
}
})
end
}

View File

@@ -0,0 +1,13 @@
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
},
keys = {
{ '<leader>ef', vim.cmd.SopsEncrypt, desc = '[E]ncrypt [F]ile' },
{ '<leader>df', vim.cmd.SopsDecrypt, desc = '[D]ecrypt [F]ile' },
},
}

View File

@@ -1,14 +1,33 @@
return {
"FabianWirth/search.nvim",
'FabianWirth/search.nvim',
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope.nvim',
},
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',
}
},
pickers = {
find_files = {
find_command = { 'rg', '--files', '--hidden', '--glob', '!**/.git/*' },
}
}
})
local search = require('search')
local builtin = require('telescope.builtin')
@@ -17,9 +36,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 +53,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
}

View 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)",
},
},
}

View File

@@ -1,3 +0,0 @@
return {
'ThePrimeagen/vim-be-good'
}

80
lua/crentist/luasnip.lua Normal file
View File

@@ -0,0 +1,80 @@
-- 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 })
-- nvim config
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 = '<>' }
)
),
})
-- Comment block
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')
}
)
),
})

View File

@@ -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,6 @@ 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", "<C-s>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")