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

Remove dynamic iskeyword #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HakimCassimallyBBC
Copy link

(Not sure if you'll approve this PR, as it reverts a chunk of behaviour, but as I found this useful, thought I'd ping just on the off-chance you did too :-) Thanks for submitting the original plugin in the first place!)

Set iskeyword locally to buffer in filetype. This allows us to remove
the over-complicated and fragile dynamic rules for adding or removing
"-" from keyword depending on context.

This removes the original author's desire to be able to use w
navigation to parts of words. To reinstate that, simply install
the plugin at https://github.com/bkad/CamelCaseMotion/ and use
<Leader>w etc. instead.

Set iskeyword locally to buffer in filetype.  This allows us to remove
the over-complicated and fragile dynamic rules for adding or removing
"-" from keyword depending on context.

This removes the original author's desire to be able to use `w`
navigation to parts of words.  To reinstate that, simply install
the plugin at https://github.com/bkad/CamelCaseMotion/ and use
`<Leader>w` etc. instead.
@dlam26
Copy link
Owner

dlam26 commented Nov 6, 2015

haha heya Hakim!

I got an idea.... instead of nuking all my iskeyword+=- hacks 😆 , how about making it an option or something? like use an if/else that controls the behavior something like

if g:xqueryvimDisableHackary
     setlocal iskeyword+=-
else
    "   all my stuff
    ...

i dont really do xquery no more (I do Python/Django!) nor write Vim plugins etc etc

@HakimCassimallyBBC
Copy link
Author

Hi David,

Thanks for that! I did consider a switch – but I think it makes sense to go along the grain of what Vim offers, and the workaround (e.g. using vim's own motion commands via CamelCaseVim as suggested in a comment) works fine for navigating dashes in symbol names.

That said, are there use-cases that I'm missing? In any case, it's no biggie if you'd prefer not to apply the PR for back-compat reasons :-)

Hope you're enjoying Python + Django by the way - I did that for a couple of years recently, found myself admiring Django more than loving it, but it's certainly very capable.

All the best,
Hakim

From: David Lam <[email protected]mailto:[email protected]>
Reply-To: dlam26/xqueryvim <[email protected]mailto:[email protected]>
Date: Friday, 6 November 2015 23:02
To: dlam26/xqueryvim <[email protected]mailto:[email protected]>
Cc: Hakim Cassimally <[email protected]mailto:[email protected]>
Subject: Re: [xqueryvim] Remove dynamic iskeyword (#3)

haha heya Hakim!

I got an idea.... instead of nuking all my iskeyword+=- hacks [:laughing:] , how about making it an option or something? like use an if/else that controls the behavior something like

if g:xqueryvimDisableHackary
setlocal iskeyword+=-
else
" all my stuff
...

i dont really do xquery no more (I do Python/Django!) nor write Vim plugins etc etc


Reply to this email directly or view it on GitHubhttps://github.com//pull/3#issuecomment-154570275.


http://www.bbc.co.uk
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.


@dlam26
Copy link
Owner

dlam26 commented Nov 10, 2015

yeah not really back-compat reasons, its really nostalgia so I can leave all my hackary vimscript in there 😄

yes that is probably a bad reason hahaha

But maybe a more coherent reason if I was a plugin author is to be able to offer the functionality out of the box. And not have to install another plugin e.g. CamelCaseVim. Be it documented or not.

For example, Vim can indent an XML file. By default, it calls this vimscript XmlIndentGet thingy: https://github.com/vim/vim/blob/master/runtime/indent/xml.vim#L79

But a far superior method is to filter it through this xmllint program a la http://vim.wikia.com/wiki/Format_your_xml_document_using_xmllint

@HakimCassimallyBBC
Copy link
Author

Good point about external dependencies, totally agreed. But of course these days where installing a vim plugin is as simple as typing "Plugin 'foo/bar'" in your .vimrc, it's simple to just copy 2 lines instead of 1, if the installation docs tell you to.

Another option might be to fork a version of CamelCaseVim (that only matches dashes, perhaps) and bundle that. I started down that road, and then realised the module did everything I wanted already, so left it.

By the way, this is the use-case that led me to refactor in the first case:

Plugin 'ack.vim'
noremap <LocalLeader># "ayiw:Ack <C-r>a<CR>

as the iw motion isn't overridden, you end up ack'ing the wrong token. (I suspect it'd be possible to override motions in the same way you were doing, but it seems like a lot of additional complexity).

From: David Lam <[email protected]mailto:[email protected]>
Reply-To: dlam26/xqueryvim <[email protected]mailto:[email protected]>
Date: Tuesday, 10 November 2015 19:38
To: dlam26/xqueryvim <[email protected]mailto:[email protected]>
Cc: Hakim Cassimally <[email protected]mailto:[email protected]>
Subject: Re: [xqueryvim] Remove dynamic iskeyword (#3)

yeah not really back-compat reasons, its really nostalgia so I can leave all my hackary vimscript in there [:smile:]

yes that is probably a bad reason hahaha

But maybe a more coherent reason if I was a plugin author is to be able to offer the functionality out of the box. And not have to install another plugin e.g. CamelCaseVim. Be it documented or not.

For example, Vim can indent an XML file. By default, it calls this vimscript XmlIndentGet thingy: https://github.com/vim/vim/blob/master/runtime/indent/xml.vim#L79

But a far superior method is to filter it through this xmllint program a la http://vim.wikia.com/wiki/Format_your_xml_document_using_xmllint


Reply to this email directly or view it on GitHubhttps://github.com//pull/3#issuecomment-155543392.


http://www.bbc.co.uk
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.


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

Successfully merging this pull request may close these issues.

2 participants