Thursday, May 22, 2014

Indentation after case statement

Hi all,

I'm trying to get vim to play nicely with GTK's coding style[1] by
setting cinoptions but I can't figure out what to use for case
statements.

Desired (according to the coding style):

switch (x)
{
case 1:
{
foo();
}
case 2:
bar();
}

A) What I get with "setlocal et sw=2 cinoptions=>4,n-2,{2":
(note the large indent after case 1)

switch (x)
{
case 1:
{
foo();
}
case 2:
bar();
}

B) What I get with "setlocal et sw=2 cinoptions=>4,n-2,{2,=0":
(note no indent after case 2)

switch (x)
{
case 1:
{
foo();
}
case 2:
bar();
}

Is there some combination of cinoptions that can get the desired
indentation automatically?

[1]: https://git.gnome.org/browse/gtk+/plain/docs/CODING-STYLE

Thanks
--
Ross Lagerwall

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Library/framework to manage uniformly *all* programming languages

xen wrote:
> BPJ, can I ask you something out in public?
>
> Since you and Miles Fidelman are responding to this same person after
> I have written that lengthy piece, and you're completely ignoring my
> contribution, I can only assume that I am coming across as arrogant.
>
> And you guys are trying to tone me down. Which is reasonable, I guess.

At least in my case, my response has nothing to do with yours - which,
by the way, I disagree with. Laziness is a GOOD thing in engineers -
research, don't reinvent the wheel, think before implementing, design
your way out of a job (or at least into the next one). Beyond that, it
wasn't (IMHO) on point.

My response was a somewhat snarky response to the original poster (and,
I think, on point).

Now thinking that your "contribution" was the be all and end all
response to the original poster - now that IS arrogant (or at least a
bit too full of yourself).

On the other hand, this is an Internet email list - nobody cares if you
come across as arrogant, what ultimately matters is if you're
substantive. In fact, again IMHO, nobody cares about you (or me) at
all. At best, leaving trolls aside: original-posters are looking for
answers to questions or to promote something; responders care about
giving back (maybe), gathering chits for future help, gaining cred - and
more cynically, showing off how smart, and/or clever, and/or snarky they
are; readers maybe learn something or at least are entertained.

Miles Fidelman



--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Get expansion of digraph in VimL

Is there a way to get the expansion of a digraph (entered e.g. with ^K in insert mode) programatically?

For example, I have vim set up to insert the ellipsis character '…' when I type "^K..". Is there a way, programatically, to write a function ExpandDigraph such that ExpandDigraph("..") yields "…"?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How can I pass user input value to vimgrep?


On May 22, 2014 10:14 PM, "Pinaki" <appugupta007@gmail.com> wrote:
>
> Thanks, following your advice finally the script started working.
> Here is the changed script:
>
>
> " Last Change: 2014-05-22  Thursday: 04:16:18 PM
> " -----------------------Implementation of a simple feature
> " -----------------------"Find in Files and Directories"
> " -----------------------like Notepad++ -----------------
> " -----------------------Created & Edited by Pinaki Sekhar Gupta
> <appugupta007@gmail.com>------------------------
> " -----------------------Licence: No licence is better than
> everything-------------------------------------------
>
>
>
> :menu Edit.Find\ in\ Files  :<Esc>:<Esc>:call Find_in_Files() <Cr>
>
> function Find_in_Files()
>
> " -----------------------raw method-----------------
> " :vimgrep /GNU/ C:\CodeBlocks\TDM-GCC-64\include\*.txt
> " :cw
> " --------------------------------------------------
>
>         let what2find = inputdialog("search term", "", "cancel pressed")
>         let     directory       = browsedir("Browse the directory","")
>         let filetype = inputdialog("filetype", "", "cancel pressed")
>         let forwardslash = "/"
>         let space = " "
>         let wildcard = "*."

Strange indent here.

>     if what2find != "" && what2find != "cancel pressed" && directory !=  ""
> && filetype !=  ""
>
>                     "          port to test whether the nested strings are
> working or not
>                     "
> http://vim.1045645.n5.nabble.com/How-can-I-pass-user-input-value-to-vimgrep-td5721661.html
>                     " :echom "Hello, " . "world"
>                     " Hello, world "
> http://learnvimscriptthehardway.stevelosh.com/chapters/26.html
>                     " echo forwardslash . what2find . forwardslash . space .
> directory . wildcard . filetype

And here.

>         :execute "vimgrep /" . what2find . forwardslash . space .
> fnameescape(directory) . wildcard . fnameescape(filetype)
>         :cw
>
>     else
>         " process if user press okay
>         if what2find != "cancel pressed" && directory !=  "cancel pressed"
> && filetype !=  "cancel pressed"
>
>             :execute "vimgrep /" . what2find . forwardslash . space .
> fnameescape(directory) . wildcard . fnameescape(filetype)

It is interesting why you use "forwardslash", "space" and "wildcard" variables? Concat operator has no problems with string literals on either side of itself. And do not use '!= "cancel pressed"'.

Also why are you preceding some commands with a colon? I use it in two places: in *noremap definitions because it is required to enter command mode and after :autocmd/:command: as an element of coding style used to separate (auto)command body from the rest of arguments (preceding colon(s) are simply ignored so you may safely use them for various things like I do).

>             :cw
>
>         endif
>     endif
> endfunction
>
>
>
>
>
>
>
>
>
>
>
> If you still have any improvement suggestion please inform..
>
>
>
>
>
> --
> View this message in context: http://vim.1045645.n5.nabble.com/How-can-I-pass-user-input-value-to-vimgrep-tp5721661p5721667.html
> Sent from the Vim - General mailing list archive at Nabble.com.
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Library/framework to manage uniformly *all* programming languages

BPJ, can I ask you something out in public?

Since you and Miles Fidelman are responding to this same person after I
have written that lengthy piece, and you're completely ignoring my
contribution, I can only assume that I am coming across as arrogant.

And you guys are trying to tone me down. Which is reasonable, I guess.

And this seems to be a social phenomenon rather than something that can
also happen one-on-one. It seems to be about rules of seniority in a
group. It seems to be about new or inexperienced people having to take a
more modest place within a hierarchy when they first enter it, and to have
to "deserve" or "earn" a higher place up.

And it seems I have broken that rule a few times recently. Strangely
enough, it also happened on some YouTube comments. I had flamed a person
who had been flaming people, and although I felt really good about it,
other people pretty much repeated my sentiment without adding anything,
thereby devalueing what I had said and putting me "in my proper place".
Completely same phenomenon, but out on the open in a non-group of a
thousand million YouTube users.

I don't really understand this yet, but I'd like to learn about these
rules and what my arrogance seems to be. I don't want to keep repeating
that mistake.

My apologies if I come across as arrogant again now, but I'm sure it's
alright to ask this question of you people.

BTW, I haven't looked into my own thread yet (new vim user) but I will get
back to that when I have the proper time/energy/intention. I'm sure that's
not a problem.

Regards,

Xen.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: new vim user

2014-05-21 23:27, Elijah Griffin skrev:
> BPJ wrote:
>> >My 'problem' is that I can't by any stretch of imagination think
>> >of what's sjumped over by W as a 'word' -- it's usually at least
>> >one word and then some punctuation. I'm probably a dinosaur for
>> >havings so restrictive a view of what a 'word' is, but so be it.
>> >I guess I could rephrase it as "W: whitespace-delimited chunk".

> Don't think of what is jumped over, think of what it finds. 'W' jumps
> to the start of the next word, whatever jumble is in the way.

No it jumps to the beginning of the next whitespace-delimited
chunk, which may begin in any non-whitespace character. As a
linguist I'm a bit picky about the definition of "word",
whether you jump to, from or over whatever you do or don't
define as a word. There is a linguistic truism that a word
can't be defined by linguistic criteria alone, so the least
common denominator is 'what goes beteen whitespace', but it
usually doesn't include punctuation. My beef is with the
definition of the text objects as such: w recognises a word but
W recognises something else/more. It's clearly me needing to
change my semantic habits! :-)

/bpj

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Library/framework to manage uniformly *all* programming languages

2014-05-21 10:09, Gautier DI FOLCO skrev:
> Yes, I thought to "mainstream" programming languages.

The definition of which depends on which generation you belong to...

/bpj

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.