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

changing wiki file extension #28

Closed
slonik-az opened this issue Mar 30, 2019 · 5 comments
Closed

changing wiki file extension #28

slonik-az opened this issue Mar 30, 2019 · 5 comments

Comments

@slonik-az
Copy link

Thank you for creating wiki.vim -- viable and clean alternative to vimwiki! In my setup .wiki
file extension is reserved for vimwiki with its traditional file-type and syntax.

How can I reconfigure wiki.vim to use a file extension other than .wiki?

To make this task harder, .wiki file extension is hard-coded in quite a few places throughout the code base - see files link.vim, page.vim, template.vim.

Thanks,
--Leo

@lervag
Copy link
Owner

lervag commented Apr 1, 2019

Hi! Thanks for raising the issue! The idea is actually that this should already be supported, see :help g:wiki_filetypes and g:wiki_link_extension. The first defines which filetypes will activate the "wiki layer". The second allows to make explicit which file extensions to use for wiki links. You can also make links without extensions, in which case the current file extension is assumed when resolving the link.

However, you are right that there are some hard coded .wiki extensions. I'll fix that asap.

@lervag
Copy link
Owner

lervag commented Apr 1, 2019

I think my latest commit solves the hard coded extensions. Let me know if I should have missed something or if I accidentally broke something.

@lervag lervag closed this as completed Apr 1, 2019
@slonik-az
Copy link
Author

WoW! That was quick. I will try the changes when I am back in town and will report the results.

@slonik-az
Copy link
Author

Took it for a spin based on the latest commit in master (commit:8f4c7a80) using .wmd extension instead of .wiki. MacVim (vim-8.1.950) on MacOSX-10.12.6 (Sierra).

In my .vim/vimrc:

let g:wiki_filetypes = ['wiki']
let g:wiki_link_extension = '.wmd'
let g:wiki_mappings_use_defaults = 1

I also used wiki-ft.vim plugin where I temporarily replaced .wiki extension with .wmd.

Opening a file gvim index.wmd brings up a new file with filetype set to wiki. Highlighting of headers and links seems to be working. Concealing of brackets around links seems to be working too. But there are problems:

What does not work:

  • wiki-link-open does not work. Pressing <CR> over [[my-wiki-page]] has no effect (moves cursor to the next line, that's it).
  • <leader>ww tries to open /index.wiki instead of /index.wmd.
  • <TAB> has no effect (it is supposed to move cursor to the next wikilink).

@lervag
Copy link
Owner

lervag commented Apr 14, 2019

Sorry about the slow reply! So:

ww tries to open /index.wiki instead of /index.wmd.

Yes, the extension used for WikiIndex is the first entry in g:wiki_filetypes. So, if you use wmd as an extension for files that has the filetype .wiki, then you should use `let g:wiki_filetypes = ['wmd'].

I can understand that this might be somewhat misleading. The g:wiki_link_extension option is only used to set which extension is used when creating links.

I believe that things should work for you if you update the settings as mentioned above.

Note: You do not have to set the g:wiki_mappings_use_defaults when you use the default value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants