current nvim settings (obsidian frontmatter snippet, telescope heading, wrapping with yow, rose-pine theme, auto insert bullets)

This commit is contained in:
Joost Agterhoek 2024-11-18 15:53:17 +01:00
parent 927c5023eb
commit 9c9c0d0c8c
7 changed files with 86 additions and 7 deletions

View File

@ -4,7 +4,7 @@ vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
vim.g.vim_markdown_auto_insert_bullets = 0
-- vim.g.vim_markdown_auto_insert_bullets = 0
-- To make sure image.nvim works with luarocks
package.path = package.path .. ';' .. vim.fn.expand '$HOME' .. '/.luarocks/share/lua/5.1/?/init.lua;'
@ -16,7 +16,7 @@ vim.opt.spelllang = { 'en_us', 'nl' }
vim.opt.spell = true
vim.keymap.set('n', '<C-s>', ':!feh --geometry 640x480+1200+50 <cfile><CR>', { desc = 'Show image under cursor with feh' })
vim.keymap.set('i', '<M-a>', '<Esc>[s1z=ea', { desc = 'Correct previous misspelt word with the first spell suggestion' })
vim.keymap.set('i', '<M-a>', '<Esc>[s1z=$a', { desc = 'Correct previous misspelt word with the first spell suggestion' })
vim.keymap.set('n', '<M-a>', '[s1z=$', { desc = 'Correct previous misspelt word with the first spell suggestion' })
require 'keymaps'
@ -25,6 +25,8 @@ vim.opt.foldmethod = syntax
vim.opt.foldlevel = 99
vim.g.autoread = true
vim.g.dictionary = true
vim.opt.complete:append { 'k' }
@ -393,6 +395,12 @@ require('lazy').setup({
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
-- used to have sorted Markdown headings
heading = {
picker_opts = {
sorting_strategy = 'ascending', -- 'descending' by default
},
},
},
}
@ -402,7 +410,8 @@ require('lazy').setup({
-- See `:help telescope.builtin`
local builtin = require 'telescope.builtin'
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
-- vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sh', ':Telescope heading<CR>', { desc = '[S]earch [H]eading in Markdown' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sb', ':Telescope neoclip<CR>', { desc = '[S]earch [B]uffers' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
@ -856,15 +865,15 @@ require('lazy').setup({
-- change the command in the config to whatever the name of that colorscheme is.
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
-- 'folke/tokyonight.nvim',
'catppuccin/nvim',
'folke/tokyonight.nvim',
-- { 'rose-pine/neovim', name = 'rose-pine' },
priority = 1000, -- Make sure to load this before all the other start plugins.
init = function()
-- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
-- vim.cmd.colorscheme 'tokyonight-night'
vim.cmd.colorscheme 'catppuccin-macchiato'
vim.cmd.colorscheme 'rose-pine-moon'
-- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none'

View File

@ -13,5 +13,25 @@ return {
-- If not available, we use `mini` as the fallback
-- 'rcarriga/nvim-notify',
},
config = function()
require('noice').setup {
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
}
end,
},
}

View File

@ -0,0 +1,12 @@
return {
'rose-pine/neovim',
config = function()
require('rose-pine').setup {
styles = {
italic = false,
bold = true,
-- transparency = true,
},
}
end,
}

View File

@ -5,6 +5,12 @@ return {
config = function()
require('nvim-surround').setup {
-- Configuration here, or leave empty to use defaults
surrounds = {
['('] = false,
},
aliases = {
['('] = ')',
},
}
end,
}

View File

@ -0,0 +1,6 @@
return {
'crispgm/telescope-heading.nvim',
config = function()
require('telescope').load_extension 'heading'
end,
}

View File

@ -1,6 +1,14 @@
local opts = {
set_nvim_opt_defaults = false,
}
return {
'andrewferrier/wrapping.nvim',
config = function()
require('wrapping').setup()
require('wrapping').setup {
-- set_nvim_opt_defaults = false,
softener = { markdown = true },
}
end,
}

View File

@ -12,6 +12,10 @@ local date = function()
return { os.date '%Y-%m-%d' }
end
local filename = function()
return { vim.fn.expand '%:r:t' }
end
ls.add_snippets(nil, {
markdown = {
snip({
@ -34,5 +38,19 @@ ls.add_snippets(nil, {
text { '', '+++', '', '' },
insert(0),
}),
snip({
trig = 'frontmatter',
namr = 'Obsidian frontmatter',
dscr = 'Frontmatter metadata for generic Obsidian note',
}, {
text { '---', 'title: ' },
func(filename, {}),
text { '', 'aliases: []' },
text { '', "tags: ['" },
insert(1, ''),
text { "']" },
text { '', '---', '' },
insert(0),
}),
},
})