configure folding

This commit is contained in:
2024-11-14 15:58:58 +02:00
parent 231db82c0f
commit c49b758e86
11 changed files with 166 additions and 14 deletions

View File

@@ -9,12 +9,16 @@ return {
}
})
vim.cmd("colorscheme gruvbox")
vim.api.nvim_set_hl(0, "FoldColumn", { bg = "#282828", fg = "#808080" })
vim.api.nvim_set_hl(0, 'SignColumn', { link = 'FoldColumn' })
end
},
{
"norcalli/nvim-colorizer.lua",
config = function ()
config = function()
require('colorizer').setup({ '*' })
end
}
}

View File

@@ -1,6 +1,6 @@
return {
'neovim/nvim-lspconfig',
tag = "v1.0.0",
tag = 'v1.0.0',
dependencies = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
@@ -41,6 +41,7 @@ return {
'ansiblels',
'terraformls',
'helm_ls',
'marksman',
},
handlers = {
function(server_name)

View File

@@ -0,0 +1,62 @@
return {
'epwalsh/obsidian.nvim',
version = '*', -- recommended, use latest release instead of latest commit
-- lazy = true,
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
-- event = {
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
-- -- E.g. 'BufReadPre ' .. vim.fn.expand '~' .. '/my-vault/*.md'
-- -- refer to `:h file-pattern` for more examples
-- 'BufReadPre /Users/rtim/Documents/Notes/tech-work-hobby/*.md',
-- 'BufNewFile /Users/rtim/Documents/Notes/tech-work-hobby/*.md',
-- },
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 = '%d-%b-%y (%A)',
default_tags = { 'daily' },
template = 'Daily.md',
},
templates = {
folder = 'Templates',
}
},
}

View File

@@ -10,6 +10,9 @@ return {
},
keymaps = {
['<C-h>'] = false,
['<C-j>'] = false,
['<C-k>'] = false,
['<C-l>'] = false,
}
})
end

View File

@@ -1,5 +1,5 @@
return {
"nvim-treesitter/nvim-treesitter",
'nvim-treesitter/nvim-treesitter',
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
@@ -28,3 +28,4 @@ return {
})
end
}

43
lua/crentist/lazy/ufo.lua Normal file
View 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 = 2 }, click = 'v:lua.ScFa', },
{ text = { '%s' }, click = 'v:lua.ScSa', },
{ 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
}

View File

@@ -11,7 +11,9 @@ vim.keymap.set({ "i", "s" }, "<C-l>", function()
end
end, { desc = "Snippet next argument", silent = true })
-- nvim config
--------------------
-- Snippets for LUA
--------------------
ls.add_snippets('lua', {
s({ name = 'LuaSnip Snippet', trig = 'snipf' },
fmt([[
@@ -44,7 +46,9 @@ ls.add_snippets('lua', {
),
})
-- Comment block
--------------------
-- Generic snippets
--------------------
local function com_string(_, snip, to_multiply)
local comment_string = vim.bo.commentstring
local repeats = snip.captures[1]
@@ -78,3 +82,29 @@ ls.add_snippets('all', {
),
})
--------------------
-- 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 = '<>' }
)
),
})

View File

@@ -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