Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion on accented letters #719

Open
aleprovencio opened this issue Sep 20, 2024 · 0 comments
Open

Completion on accented letters #719

aleprovencio opened this issue Sep 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@aleprovencio
Copy link

🐛 Describe the bug

Hello,
There is an issue when there are accented characters on the same sentence where the completion is being triggered.
Take for instance the following example (in Portuguese):

[[#Referências]]

Aqui não vai [[[#Referências]]
Aqui também não [[[[#Referências]]
Aqui então, também não [[#[[#Referências]]

## Referências
1.

Notice the first completion worked fine, because there are no accented characters on the same sentence.

The following ones, depending on the number of accented characters, it will put the same number of undesired characters upon completion.

Config


  { -- obsidian.nvim
    'epwalsh/obsidian.nvim',
    --[[ version = '*', -- recommended, use latest release instead of latest commit ]]
    dependencies = {
      'nvim-lua/plenary.nvim',
    },
    ft = 'markdown',
    keys = {
      { '<leader>oa', '<cmd>:ObsidianOpen<cr>', desc = 'Open in Obsidian app' },
      { '<leader>on', '<cmd>:ObsidianNewFromTemplate<cr>', desc = 'New note' },
      { '<leader>ob', '<cmd>:ObsidianBacklinks<cr>', desc = 'Backlinks' },
      { '<leader>ot', '<cmd>:ObsidianTags<cr>', desc = 'Tags' },
      { '<leader>oT', '<cmd>:ObsidianTemplate<cr>', desc = 'Templates' },
      { '<leader>ol', '<cmd>:ObsidianLinks<cr>', desc = 'Links' },
      { '<leader>ow', '<cmd>:ObsidianWorkspace<cr>', desc = 'Woskspaces' },
      { '<leader>or', '<cmd>:ObsidianRename<cr>', desc = 'Rename note' },
      { '<leader>op', '<cmd>:ObsidianPasteImg<cr>', desc = 'Paste Image' },
      { '<leader>odt', '<cmd>:ObsidianToday<cr>', desc = 'Today' },
      { '<leader>odT', '<cmd>:ObsidianTomorrow<cr>', desc = 'Tomorrow' },
      { '<leader>ody', '<cmd>:ObsidianYesterday<cr>', desc = 'Yesterday' },
      { '<leader>odd', '<cmd>:ObsidianDailies<cr>', desc = 'Daily notes' },
      { '<leader>ofv', '<cmd>:ObsidianFollowLink vsplit<cr>', desc = 'Vertical' },
      { '<leader>ofh', '<cmd>:ObsidianFollowLink hsplit<cr>', desc = 'Horizontal' },

    },

    opts = {
      workspaces = {
        {
          name = 'second-brain',
          path = vim.fn.expand '~/.local/share/code/second-brain/content',
          overrides = {
            attachments = { img_folder = 'Assets/Images/' },
            daily_notes = {
              folder = '2-Areas/Reflections/Daily/',
              template = 'Daily.md',
            },
            templates = { folder = 'Assets/Templates/' },
            --[[ disable_frontmatter = true, ]]
            notes_subdir = '0-Inbox/',
            new_notes_location = 'notes_subdir',
          },
        },
        {
          name = 'no-vault',
          path = function()
            return assert(vim.fs.dirname(vim.api.nvim_buf_get_name(0)))
          end,
          overrides = {
            notes_subdir = vim.NIL,
            new_notes_location = 'current_dir',
            templates = {
              folder = vim.NIL,
            },
            disable_frontmatter = true,
          },
        },
      },

      -- only one I found compatible with obsidian
      wiki_link_func = 'use_alias_only',

      open_notes_in = 'vsplit',

      -- Linux uses xdg-open
      ---@param url string
      follow_url_func = function(url)
        vim.fn.jobstart { 'xdg-open', url }
      end,

      -- Treat titles as filenames
      ---@param spec { id: string, dir: obsidian.Path, title: string|? }
      ---@return string|obsidian.Path The full path to the new note.
      note_path_func = function(spec)
        local path = spec.dir / tostring(spec.title)
        return path:with_suffix '.md'
      end,

      -- For now only title and tags are useful on frontmatter
      ---@return table
      note_frontmatter_func = function(note)
        local out = { title = note.title, tags = note.tags }

        -- `note.metadata` contains any manually added fields in the frontmatter.
        -- So here we just make sure those fields are kept in the frontmatter.
        if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then
          for k, v in pairs(note.metadata) do
            out[k] = v
          end
        end

        return out
      end,

      ui = {
        checkboxes = {
          [' '] = { char = '󰄱 ', hl_group = 'ObsidianTodo' },
          ['x'] = { char = ' ', hl_group = 'ObsidianDone' },
          -- NOTE: Removing unused
          -- [">"] = { char = "", hl_group = "ObsidianRightArrow" },
          -- ["~"] = { char = "󰰱", hl_group = "ObsidianTilde" },
          -- ["!"] = { char = "", hl_group = "ObsidianImportant" },
        },
      },
      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 },
        },
        -- NOTE: Disable this mapping because <cr> is more useful
        --[[ ["<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 },
        },
      },
    },
  },

Environment

❯ nvim --version
NVIM v0.10.1
Build type: RelWithDebInfo
LuaJIT 2.1.1725453128
Run "nvim -V1 -v" for more info

~ 
❯ nvim --headless -c 'lua require("obsidian").info()' -c q

Obsidian.nvim v3.9.0 (14e0427bef6c55da0d63f9a313fd9941be3a2479)
Status:
  • buffer directory: nil
  • working directory: /home/aleprovencio
Workspaces:
  ✓ active workspace: Workspace(name='no-vault', path='/home/aleprovencio', root=
'/ho
me/aleprovencio')
  ✗ inactive workspace: Workspace(name='second-brain', path='/home/aleprovencio/.
loca
l/share/code/second-brain/content', root='/home/aleprovencio/.local/share/code/se
cond
-brain/content')
Dependencies:
  ✓ plenary.nvim: 2d9b06177a975543726ce5c73fca176cedbffe9d
  ✓ nvim-cmp: ae644feb7b67bf1ce4260c231d1d4300b19c6f30
Integrations:
  ✓ picker: TelescopePicker()
  ✓ completion: enabled (nvim-cmp) ✗ refs, ✗ tags, ✗ new
    all sources:
      • nvim_lsp
      • path
      • emoji
      • buffer
      • luasnip
Tools:
  ✓ rg: ripgrep 14.1.1
Environment:
  • operating system: Linux
Config:
  • notes_subdir: nil⏎                                                           
  
@aleprovencio aleprovencio added the bug Something isn't working label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant