Skip to content

Cyrillic links don't work (they won't open) after 197282b commit #395

@artkpv

Description

@artkpv

Description

This commit breaks my links :(, this means when I open a link it doesn't open a link, it opens an empty buffer, a new file while actually the file exists. I have links in Cyrillic. And I think wiki#url#utils#url_encode_specific(a:url, '()') replaces Cyrillic chars with URL entities, which is not the chars in the filesnames on my disk.

When I revert this commit, 197282b, i.e. I checkout the commit just before it, my links work.

Minimal working example

Example:

- [Информатика](02 Информатика, Computer Science.md)

Steps:

  1. Place your cursor at this link and press Enter

Result: New buffer opens '02 Информатика, Computer Science.md'. Message: "wiki: Opened a new page "02 Информатика, Computer Science.md"".
Expected result: It opens my file

My config:

  {
    'lervag/wiki.vim',
    lazy = false, -- we don't want to lazy load VimTeX
    config = function()
      vim.g.wiki_root = '/home/art/mydir/notes/'

      vim.g.wiki_select_method = {
        pages = require('wiki.telescope').pages,
        tags = require('wiki.telescope').tags,
        toc = require('wiki.telescope').toc,
        links = require('wiki.telescope').links,
      }
      vim.g.wiki_filetypes = { 'md' }

      vim.g.wiki_link_creation = {
        md = {
          link_type = 'md',
          url_extension = '.md',
        },
        _ = {
          link_type = 'md',
          url_extension = '.md',
        },
      }

      vim.g.wiki_month_names = {
        '01.Январь',
        '02.Февраль',
        '03.Март',
        '04.Апрель',
        '05.Май',
        '06.Июнь',
        '07.Июль',
        '08.Август',
        '09.Сентябрь',
        '10.Октябрь',
        '11.Ноябрь',
        '12.Декабрь',
      }
      vim.g.wiki_toc_title = 'Содержание'
      vim.g.wiki_journal = {
        -- index_use_journal_scheme = false,
        name = '2024',
        frequency = 'daily',
        date_format = {
          daily = '%Y-%m-%d',
        },
        root = '~/mydir/notes/2024',
      }

      vim.g.init_my_wiki_config = function()
        vim.opt.number = false
        vim.opt.relativenumber = false
        vim.opt.cursorline = false
        vim.opt.cursorcolumn = false
        vim.opt.foldcolumn = '0'
        vim.opt.list = false
        vim.opt.foldlevel = 1
        vim.diagnostic.enable(false)
        vim.cmd.colorscheme 'neobones'
        vim.o.laststatus = 1
        vim.o.ruler = false
        vim.cmd 'Copilot disable'
        vim.cmd 'LspStop'

        -- au! BufWritePost ~/mydir/notes/* !git add "%";git commit -m "Auto commit of %:t." "%"

        vim.api.nvim_create_autocmd('BufWritePost', {
          desc = 'Commit wiki changes',
          group = vim.api.nvim_create_augroup('wiki-commit-hook', { clear = true }),
          pattern = { '*.md' },
          callback = function()
            vim.cmd '!git add "%";git commit -m "Auto commit of %:t." "%"'
          end,
        })
      end
      vim.keymap.set('n', '<leader>wq', vim.g.init_my_wiki_config, { desc = 'Wiki [Q]uite mode on' })

      local function wiki_page_rename()
        local current_file = vim.fn.expand '%'
        local current_name = vim.fn.expand '%:t'
        local name = vim.fn.input('Enter new name (' .. current_name .. '): ')

        if name ~= '' then
          vim.fn.termopen { './ren.sh', current_file, name }
        end
      end

      vim.keymap.set('n', '<leader>wpr', wiki_page_rename, { desc = 'Rename wiki page' })
    end,
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions