diff --git a/init.lua b/init.lua index c1c7c12..4389b24 100644 --- a/init.lua +++ b/init.lua @@ -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', '', ':!feh --geometry 640x480+1200+50 ', { desc = 'Show image under cursor with feh' }) -vim.keymap.set('i', '', '[s1z=ea', { desc = 'Correct previous misspelt word with the first spell suggestion' }) +vim.keymap.set('i', '', '[s1z=$a', { desc = 'Correct previous misspelt word with the first spell suggestion' }) vim.keymap.set('n', '', '[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', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + -- vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sh', ':Telescope heading', { desc = '[S]earch [H]eading in Markdown' }) vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) vim.keymap.set('n', 'sb', ':Telescope neoclip', { desc = '[S]earch [B]uffers' }) vim.keymap.set('n', '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' diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua index 13277ad..ddc97f3 100644 --- a/lua/custom/plugins/noice.lua +++ b/lua/custom/plugins/noice.lua @@ -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, }, } diff --git a/lua/custom/plugins/rose-pine.lua b/lua/custom/plugins/rose-pine.lua new file mode 100644 index 0000000..210acc7 --- /dev/null +++ b/lua/custom/plugins/rose-pine.lua @@ -0,0 +1,12 @@ +return { + 'rose-pine/neovim', + config = function() + require('rose-pine').setup { + styles = { + italic = false, + bold = true, + -- transparency = true, + }, + } + end, +} diff --git a/lua/custom/plugins/surround.lua b/lua/custom/plugins/surround.lua index e32286c..9ae2b94 100644 --- a/lua/custom/plugins/surround.lua +++ b/lua/custom/plugins/surround.lua @@ -5,6 +5,12 @@ return { config = function() require('nvim-surround').setup { -- Configuration here, or leave empty to use defaults + surrounds = { + ['('] = false, + }, + aliases = { + ['('] = ')', + }, } end, } diff --git a/lua/custom/plugins/telescope-heading.lua b/lua/custom/plugins/telescope-heading.lua new file mode 100644 index 0000000..280cfdd --- /dev/null +++ b/lua/custom/plugins/telescope-heading.lua @@ -0,0 +1,6 @@ +return { + 'crispgm/telescope-heading.nvim', + config = function() + require('telescope').load_extension 'heading' + end, +} diff --git a/lua/custom/plugins/wrapping.lua b/lua/custom/plugins/wrapping.lua index e1e1dbe..459d477 100644 --- a/lua/custom/plugins/wrapping.lua +++ b/lua/custom/plugins/wrapping.lua @@ -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, } diff --git a/lua/snippets.lua b/lua/snippets.lua index 19645d0..564441c 100644 --- a/lua/snippets.lua +++ b/lua/snippets.lua @@ -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), + }), }, })