Skip to content

Instantly share code, notes, and snippets.

@jcdiv47
Last active June 17, 2024 03:03
Show Gist options
  • Save jcdiv47/8c411af511b7df025adbb0625be3e9ec to your computer and use it in GitHub Desktop.
Save jcdiv47/8c411af511b7df025adbb0625be3e9ec to your computer and use it in GitHub Desktop.
Neovim autocmd snippets

File Editing

Obsidian callout in markdown files

> [!INFO] foo bar
> 
vim.api.nvim_create_autocmd('FileType', {
  pattern = 'markdown',
  callback = function()
    vim.opt_local.formatoptions:append 'r' -- `<CR>` in insert mode
    vim.opt_local.formatoptions:append 'o' -- `o` in normal mode
    vim.opt_local.comments = {
      'b:>',
    }
  end,
})

Highlights

Selection highlights match currently used color scheme

-- init.lua
-- Set highlight for Visual mode
-- check out https://chat.jiaqicai.com/share/60b4d07a-b46c-431b-9d56-28ea82b67384
vim.cmd('hi! Visual cterm=reverse gui=reverse')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment