-
Notifications
You must be signed in to change notification settings - Fork 6
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
adapt educate to &spelllang #2
Comments
The defaults could be set from &spelllang, but we'd need a good mapping of possible &spelllang values to the corresponding quotes for each language. Here is one reference, but I can't vouch for its accuracy: http://en.wikipedia.org/wiki/International_variation_in_quotation_marks For example, on that page under "Spanish" guillemets are the primary, but an Argentinian friend said they aren't that common. Without a verified mapping, I'm hesitant to force arbitrary defaults on users. |
Ok, So something that would not enforce anything but would still be helpful is a global Then your educate function, as well as i/aq would look up the quotes |
And how do you propose we would make such list? (BTW, as a native Czech, I can confirm that the Wikipedia page is correct for Czech, except the alternative quotes (»«) are really archaic, and I saw them used like twice in my life in old books. |
As another temporary option you can define a command that'll change a number of settings, as shown in my Lexical plugin... https://github.com/reedes/vim-lexical/blob/master/README.markdown#define-your-own-commands |
Also, what kind of event one should use when the function! TextObjSettings()
if &spelllang == 'cs'
call textobj#quote#init({ 'double':'„“', 'single':'‚‘' })
elseif &spelllang == 'en'
call textobj#quote#init({ 'double':'“”', 'single':'‘’' })
endif
endfunction
autocmd FileType markdown, rst :au InsertEnter :call TextObjSettings()<CR> (this particularly doesn't work; why?) |
That's the new |
Note, that autocmd OptionSet spelllang call TextObjSettings()
autocmd BufEnter *.rst call TextObjSettings() |
I believe this information be derived from Unicode CLDR data, but it will take bit of fiddling. Unless we want to add a Lua dependency (e.g. I could add this data to cldr-lua) the thing to do is probably have an update script that fetches and parses the data and stores it in something cheap to process from viml. If somebody wants to work on making this configurable so that instead of using a value it calls a function for the desired language, uses the function return value if present, or falls back to a default — then I would help with getting the lang → quotation character map imported. |
A feature request: If Educate is set, it changes quotes according to the current &spelllang. That is, if for example &spelllang = "de", the setting
let g:textobj#quote#doubleDefault = '„“' " „doppel“
let g:textobj#quote#singleDefault = '‚‘' " ‚einzel‘
is used.
The text was updated successfully, but these errors were encountered: