Tuesday, January 31, 2017

Re: How to set a local syntax file?

On 2017-01-31 14:44, Charles E Campbell wrote:

Fabio D'Alfonso wrote:
Hi,
I am using nasm, and made the change in syntax to nasm in the global
config, both to highlight and snippets.
Could you tell me where I could make a local setting?
Also I am using ti amix/vimrc .
IF: you've taken nasm.vim and modified it, but its a complete syntax
file...  put it in $HOME/.vim/syntax
IF: you've just modified a rule or two, added something,  and have a
small changes file: put it in $HOME/.vim/after/syntax

I'm not sure what you mean by using it amix/vimrc . If you have a
specific filetype that you want it used on (abc.amix?): in a file called
$HOME/.vim/filetype.vim:

 au BufNewFile,BufReadPost *.amix                                      
                            setf amix

assuming that you've called the syntax file amix.vim .

Regards,
Chip Campbell

-- 

I did this in the global  filetype.vim, I would know where I could put this in a local setting.

Thanks

Fabio

Changing the default syntax to nasm

sudo vi /usr/share/vim/vim74/filetype.vim

” if b:asmsyntax still isn’t set, default to asmsyntax or NASM (was GNU)
if b:asmsyntax == “”
if exists(“g:asmsyntax”)
let b:asmsyntax = g:asmsyntax
else
let b:asmsyntax = “nasm”  (was “asm”)
endif
endif

Look for “asm” and change to “nasm”

 

--

Fabio D'Alfonso

Network Analysis And VMware Enterprise Solutions

cell. +39.348.059.40.22

web: http://www​.​fabiodalfonso​.​com    email: fabio.dalfonso@fabiodalfonso.com    Linkedin:   https://it.linkedin.com/in/fabiodalfonso    Twitter:    https://twitter.com/fabio_dalfonso  
FB Page: https://www.facebook.com/dalfonsoco/
fax: +39.06.874.599.581

Re: How to set a local syntax file?

Fabio D'Alfonso wrote:
> Hi,
> I am using nasm, and made the change in syntax to nasm in the global
> config, both to highlight and snippets.
> Could you tell me where I could make a local setting?
> Also I am using ti amix/vimrc .
IF: you've taken nasm.vim and modified it, but its a complete syntax
file... put it in $HOME/.vim/syntax
IF: you've just modified a rule or two, added something, and have a
small changes file: put it in $HOME/.vim/after/syntax

I'm not sure what you mean by using it amix/vimrc . If you have a
specific filetype that you want it used on (abc.amix?): in a file called
$HOME/.vim/filetype.vim:

au BufNewFile,BufReadPost *.amix
setf amix

assuming that you've called the syntax file amix.vim .

Regards,
Chip Campbell

--
--
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.

How to set a local syntax file?

Hi,
I am using nasm, and made the change in syntax to nasm in the global
config, both to highlight and snippets.
Could you tell me where I could make a local setting?
Also I am using ti amix/vimrc .
Thanks

--

Fabio D'Alfonso

'Enabling Business Through IT'

cell. +39.348.059.40.22 *

web: www​.​fabiodalfonso​.​com

email: fabio.dalfonso@gmail.com

fax: +39.06.874.599.581

BlackBerry® Wireless Enabled Address.

* Hidden numbers are automatically rejected by the phone


--
--
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.

Monday, January 30, 2017

ANN: dbext.vim version 25.00 - Database access from within Vim

What is it?
-----------
dbext.vim : Provides database access to most databases.

This plugin contains functions/mappings/commands to enable Vim to
access several databases. Currently Mysql, PostgreSQL, Ingres, Oracle,
Sybase Adaptive Server Anywhere, Sybase Adaptive Server Enterprise,
Microsoft SQL Server, DB2, RDB,  SAP HANA, Crate.IO and Interbase 
are supported.  If you have a Perl enabled Vim, it also allows database 
connections via DBI and ODBC.

It abstracts database access, so the same Vim commands will produce
the same output regardless of the database you use.

Extensive help file with full tutorials.

 New Features
 ------------
- Added support for using Vim's Job / Channel feature for asynchronous execution.  If the job fails to start, the usual synchronous way of launching the process happens (after displaying a message).  The main purpose for this feature is to allow you to continue editing your files while waiting for the results from SQL statements to complete.  Prior to Vim's Job feature, this was a synchronous process which could interrupt your development needlessly.

- New commands DBJobStatus, DBJobStop, DBJobTimerStart, DBJobTimerStop.

- New options g:dbext_default_use_jobs defaults to 1 (enabled),  g:dbext_default_job_status_update_ms defaults to 2000. 


 Bug Fixes
 ---------
 - None


I am always open to suggestions, just email me.  See :h dbext.txt for contact details.

David

--
--
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: horizontal range, kindof

BPJ wrote:
> I'm trying to do a substitution in a 'horizontal/virtual column range'.
>
> I have an ASCII table where the columns are separated by tab
> characters (for now). I want to wrap the contents (which contain
> space (U+0020) and \S characters, being of unequal length of
> course!) of some specific table columns in asterisks (think
> Markdown emphasis). I thought I could use a range and \%v to
> match the text between two screen virtual columns and then use an
> expression with substitute() to wrap instances of \T\+
> inside the matched screen column range, something like
>
> 'a,'b s/\%13v.*\%46v/\=substitute(submatch(0),'\T\+','*&*','g')/
>
> but apparently I've misunderstood \%v because I get no match.
> So what is the right way to do this? I'm not looking forward to
> changing three columns on some 70 lines manually!
>
You might be able to make use of vis.vim
(http://www.drchip.org/astronaut/vim/index.html#VIS) where you define a
region using visual-block mode (ctrl-v, move) and a :B command.

You might find Christian Brabandt's nrrwregion plugin of use (search for
it on http://vim.sf.net).

Regards,
Chip Campbell

--
--
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: HI Can VIM format a flat file to its fields using a record layout (cobol) ?

>> In IBM the are tools to map a file according to a given structure
>> (File Aid).
>>

Depending on exactly what this means, Perl's "format" might do the trick:
http://www.tutorialspoint.com/perl/perl_formats.htm

--
--
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: HI Can VIM format a flat file to its fields using a record layout (cobol) ?

Zvika Dvir wrote:
> HI
>
> In IBM the are tools to map a file according to a given structure
> (File Aid).
>
> I ask if Vim has thus feature ?
>
>
Since I haven't used an IBM machine in decades, I don't really know what
"mapping a file to a given structure" means in detail. However, one can
align things with plugins and patterns (see
http://www.drchip.org/astronaut/vim/index.html/#ALIGN).

So, if aligning is what you want -- do one or more substitutes to put an
alignment character of some sort in between the fields you want, then
run align on that character. Finally, remove that character.

Chip Campbell

--
--
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.

HI Can VIM format a flat file to its fields using a record layout (cobol) ?

HI

In IBM the are tools to map a file according to a given structure
(File Aid).

I ask if Vim has thus feature ?

Thanks

Zvika

--
--
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.

Sunday, January 29, 2017

Re: Why the substitute in the selection only substitute the first letter in the selection in my vimscript?

On Friday, January 27, 2017 at 9:17:06 PM UTC+8, Christian Brabandt wrote:
> Hi Zhe!
>
> On Fr, 27 Jan 2017, Zhe Lee wrote:
>
> > Why the substitute in the selection only substitute the first letter in the selection?
> >
> > The \%V option works fine when I just use the command line to exec it.
> >
> > But it seems not work very well when I use it in the vimscript.
> >
> > vnoremap <leader>dfc :call DragonflyCmdProcess(1)<CR>
> >
> > function! DragonflyCmdProcess(visual)
> > if a:visual
> > normal! gv
> > " execute "s/\\%V./&,/g"
> > execute "'<,'>s/\\%Ve/x/g"
> > else
> > endfunction
>
> I am not sure, I understand. Please try with the following changes:
>
> vnoremap <leader>dfc :<c-u>call DragonflyCmdProcess(1)<CR>
> function! DragonflyCmdProcess(visual)
> if a:visual
> '<,'>s/\%Ve/x/g
> endif
> endfunction
>
>
> Best,
> Christian
> --
> Amerikaner werden mißtrauisch, wenn man nicht einer von ihnen werden
> will - im Gegensatz zu Franzosen, Engländern, Schweden und den meisten
> anderen Völkern, die es gerade mißtrauisch macht, wenn man zu ihnen
> gehören möchte.
> -- Billy Wilder

add a more backslash will work thnx`
function! DragonflyCmdProcess(visual)
if a:visual
'<,'>s/\\%Ve/x/g
endif
endfunction

--
--
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: vim: thesaurus

I have written a few lines of code to use synonyms in Vim in multiple
languages. I have posted this in:

http://stackoverflow.com/questions/33453468/vim-thesaurus-file

this is the answer at the bottom of the page. I have already contacted Guido
Milanese, who found it useful. Along the lines of Nicola's suggestions, this
solution uses awk to access thesauri from LibreOffice. Other people on the
list may find it useful, although it should work only on Unix-like systems.

--
--
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 to do block pasting?

Thanks. I'll try them.

On 2017年01月23日 09:16, Ryan Nabinger wrote:
> A quick note:
>
> I find P more useful than p because of columns' typical left-alignment and my desire to not mangle the tailend of my paste destination.
>
> Also, 1v is very useful when dealing with blocks (:he visual-start), especially when transposing blocks / overwriting blocks.
>

--
--
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.

Friday, January 27, 2017

Re: How to open another file and go to a search pattern

On Fri, Jan 27, 2017 at 10:58:25PM +0300, Nikolay Aleksandrovich Pavlov wrote:
> If you want to avoid spaces, do use concat.

Thanks, that helped.

> let @/ = searchpat
> normal! gg0n

Thanks. This has solved the problem. Only one more thing I wish is if it
could highlight the pattern as well. Just hitting "n" once highlights it,
though wish it was automatic.

Will incorporate other suggested improvements as well. Thanks for those.

Mayuresh.

--
--
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 to open another file and go to a search pattern

2017-01-27 15:20 GMT+03:00 Mayuresh <mayuresh@acm.org>:
> Sorry, when typing out text I have made some mistakes, which may have
> given wrong impressions of what I tried at a couple of places. I should
> have rather pasted the code I tried, but I had changed it by the time I
> thought of writing a mail. Will correct it now.
>
> On Fri, Jan 27, 2017 at 02:13:24PM +0300, Nikolay Aleksandrovich Pavlov wrote:
>> > function! GoToFile()
>> > let line = getline(".")
>> > let searchpat = split(line,":")[1]
>> > let file = split(line," ")[1]
>> > " See below what all I tried here
>> > endfunction
>> > map <C-o> :exec GoToFile()<CR>
>>
>> Given how this function looks, you should not be using `:execute`. For
>> calling functions there is `:call`. This works only because
> Point taken.
>
>> > 1. Tried loading the file and searching in it using two different
>> > statements:
>> >
>> > exec "e" file
>> > search(searchpat,"")
>> >
>> > With this, I find that such search is applied to current file instead of
>> > new file and then the file is loaded. I find this strange.
>>
>> How did you check that "search is applied to current file"? I see that
>> these commands are not going to work because there is no `:search`
>> command.
>
> Clarification: Tried exec search(searchpat)

That does not make sense, `search` already moves cursor. No need to
make `exec` move cursor afterwards (similar problem to the above
point).

> It did not search in the current file. (My mistake in above mail.)
>
> However the other thing that I tried was:
> exec "/"searchpat
> or more precisely, to avoid an extra space after "/"
> exec join(["/",searchpat],"")

If you want to avoid spaces, do use concat.

:execute arg1 arg2

is the same thing as

:execute arg1." ".arg2

for convenience. You just need to have explicit concat:

:execute arg1.arg2

does not add any spaces.

>
> On either of these the message "Search hit bottom ...." appeared in the
> current buffer itself. Only on hitting Enter the next file was opened.
> From this I thought it is searching in current file.
>
>> And you forgot `fnameescape()`. First line should be `:execute 'e'
>> fnameescape(file)` or you get problems with special characters in
>> `file`.
> Thanks for the tip. Will incorporate.
>
>> > 2. From above, assuming loading and searching as two statements won't
>> > work, tried:
>> >
>> > exec "+/" searchpat file
>> >
>> > But this breaks with searchpat having spaces (even if I use \" to cover
>> > the search pattern).
>>
>> ?! This command is not opening a file, it will run something like
>>
>> +/{space}{search pattern}{space}{filename}
>>
>> : perform search in the current file, starting from the current line
>> (same {range} without command interpretation).
>
> Precise command is:
>
> exec "e " join(["+/",searchpat],"") file
>
> This is opening the file, but to highlight the pattern I have to press
> "/<Up>"<CR>. Looking for this last step to happen automatically.

I am unable to move to the search result even with this code. You are
using :execute on a function which returns 0, it *must* bring you to
the first line once function exits, so all your attempts to move to
the search pattern are useless. To move and highlight you need to use
something like

execute 'edit' fnameescape(file)
let @/ = searchpat
normal! gg0n

. E.g. this works as I expect:

vim -u gtf.vim -i NONE -N

" gtf.vim:
function GoToFile() abort
let line = getline(".")
let [file, searchpat] = matchlist(line, '\v\C^(.{-})\ \:\ (.*)$')[1:2]
execute 'edit' fnameescape(file)
let @/ = searchpat
normal! gg0n
endfunction
nnoremap <C-o> :<C-u>call GoToFile()<CR>

call writefile(['/tmp/gtf-test : abc def'], '/tmp/gtf-test-init')
call writefile(['foo', 'abc def'], '/tmp/gtf-test')
set hlsearch
edit /tmp/gtf-test-init
call feedkeys("gg\<C-o>", "t")

. Note:

0. `nnoremap`: you must not use `*map` without `nore` unless you know
what you are doing. This avoids possible issues with other mappings.
1. `:<C-u>`: check how function behaves when you press `10<C-o>` without this.
2. `call GoToFile()`, not `execute`.
3. Original `file` and `searchpat` definition will not work correctly
with `SomeFileName : Some Multiple Words of Search Pattern`. I assumed
that code is wrong, not example line.

>
> Mayuresh
>
> --
> --
> 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: annoying PasteStart/PasteEnd

On Thu, Jan 26, 2017 at 08:40:27PM +0100, Bram Moolenaar wrote:
>
> Johannes-Maria Kaltenbach wrote:
>
> > On Wed, Jan 25, 2017 at 01:53:54PM +0100, Johannes-Maria Kaltenbach wrote:
> > > On Tue, Jan 24, 2017 at 03:58:14PM +0100, Bram Moolenaar wrote:
> > > > Found it: part of the change was missing from the patch.
> > > > So it worked for me but nobody else.
> > >
> > > Thanks.
> > > I've updated now to vim-8.0.237 and it works fine.
> >
> > but (at least for me) it is better to keep 'set t_BE=' in the
> > configuration file. The <PasteStart>/<PasteEnd> around pasted
> > text is gone but if one yanks a whole line (or part of the line
> > until the end of the line) with the mouse and pastes it in an
> > xterm then the pasted text contains a ^M at the end instead
> > of executing a 'return' (as was the old behaviour and the one
> > I prefer instead of first deleting the ^M and then pressing
> > return).
> > [Only in command line (including searches), not while inserting
> > in buffer.]
>
> I assume you are talking about the command line, or entering search.

yes, both.

> Yes, it's intentional that the line break does not work like pressing
> Enter. The idea is that you are pasting text, not a command.

OK, so in the case of the end-of-line it was intended.

> You are supposed to view the text before deciding to execute it.
> The thread that started it mentioned that the source of the text may
> give you something else than what you expected. In practice, what often
> happens is that you accidentally copy the wrong text and include the
> line break when that is not intended.

Personally I prefer like it was in earlier versions
but that's no problem since I can have this with 'set t_BE='.

Thanks,
Johannes-Maria


--
--
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: Why the substitute in the selection only substitute the first letter in the selection in my vimscript?

Hi Zhe!

On Fr, 27 Jan 2017, Zhe Lee wrote:

> Why the substitute in the selection only substitute the first letter in the selection?
>
> The \%V option works fine when I just use the command line to exec it.
>
> But it seems not work very well when I use it in the vimscript.
>
> vnoremap <leader>dfc :call DragonflyCmdProcess(1)<CR>
>
> function! DragonflyCmdProcess(visual)
> if a:visual
> normal! gv
> " execute "s/\\%V./&,/g"
> execute "'<,'>s/\\%Ve/x/g"
> else
> endfunction

I am not sure, I understand. Please try with the following changes:

vnoremap <leader>dfc :<c-u>call DragonflyCmdProcess(1)<CR>
function! DragonflyCmdProcess(visual)
if a:visual
'<,'>s/\%Ve/x/g
endif
endfunction


Best,
Christian
--
Amerikaner werden mißtrauisch, wenn man nicht einer von ihnen werden
will - im Gegensatz zu Franzosen, Engländern, Schweden und den meisten
anderen Völkern, die es gerade mißtrauisch macht, wenn man zu ihnen
gehören möchte.
-- Billy Wilder

--
--
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.

Why the substitute in the selection only substitute the first letter in the selection in my vimscript?

Why the substitute in the selection only substitute the first letter in the selection?

The \%V option works fine when I just use the command line to exec it.

But it seems not work very well when I use it in the vimscript.

vnoremap <leader>dfc :call DragonflyCmdProcess(1)<CR>

function! DragonflyCmdProcess(visual)
if a:visual
normal! gv
" execute "s/\\%V./&,/g"
execute "'<,'>s/\\%Ve/x/g"
else
endfunction

--
--
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 to open another file and go to a search pattern

Sorry, when typing out text I have made some mistakes, which may have
given wrong impressions of what I tried at a couple of places. I should
have rather pasted the code I tried, but I had changed it by the time I
thought of writing a mail. Will correct it now.

On Fri, Jan 27, 2017 at 02:13:24PM +0300, Nikolay Aleksandrovich Pavlov wrote:
> > function! GoToFile()
> > let line = getline(".")
> > let searchpat = split(line,":")[1]
> > let file = split(line," ")[1]
> > " See below what all I tried here
> > endfunction
> > map <C-o> :exec GoToFile()<CR>
>
> Given how this function looks, you should not be using `:execute`. For
> calling functions there is `:call`. This works only because
Point taken.

> > 1. Tried loading the file and searching in it using two different
> > statements:
> >
> > exec "e" file
> > search(searchpat,"")
> >
> > With this, I find that such search is applied to current file instead of
> > new file and then the file is loaded. I find this strange.
>
> How did you check that "search is applied to current file"? I see that
> these commands are not going to work because there is no `:search`
> command.

Clarification: Tried exec search(searchpat)
It did not search in the current file. (My mistake in above mail.)

However the other thing that I tried was:
exec "/"searchpat
or more precisely, to avoid an extra space after "/"
exec join(["/",searchpat],"")

On either of these the message "Search hit bottom ...." appeared in the
current buffer itself. Only on hitting Enter the next file was opened.
From this I thought it is searching in current file.

> And you forgot `fnameescape()`. First line should be `:execute 'e'
> fnameescape(file)` or you get problems with special characters in
> `file`.
Thanks for the tip. Will incorporate.

> > 2. From above, assuming loading and searching as two statements won't
> > work, tried:
> >
> > exec "+/" searchpat file
> >
> > But this breaks with searchpat having spaces (even if I use \" to cover
> > the search pattern).
>
> ?! This command is not opening a file, it will run something like
>
> +/{space}{search pattern}{space}{filename}
>
> : perform search in the current file, starting from the current line
> (same {range} without command interpretation).

Precise command is:

exec "e " join(["+/",searchpat],"") file

This is opening the file, but to highlight the pattern I have to press
"/<Up>"<CR>. Looking for this last step to happen automatically.

Mayuresh

--
--
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 to open another file and go to a search pattern

2017-01-27 5:46 GMT+03:00 Mayuresh <mayuresh@acm.org>:
> I have a requirement where the cursor is on following line:
>
> SomeFileName : Some Multiple Words of Search Pattern
>
> I want to define a hot key (Say <C-o>) to open SomeFileName and go to and
> highlight the whole pattern "Some Multiple Words of Search Pattern"
>
> Following is my attempt to solve it, which has not succeeded fully:
>
> In vimrc:
>
> function! GoToFile()
> let line = getline(".")
> let searchpat = split(line,":")[1]
> let file = split(line," ")[1]
> " See below what all I tried here
> endfunction
> map <C-o> :exec GoToFile()<CR>

Given how this function looks, you should not be using `:execute`. For
calling functions there is `:call`. This works only because

1. Without explicit `:return` statement function returns `0` at exit.
2. Vim can implicitly convert numbers to strings.
3. `:{range}` takes you to the last line in range if run without a command.
4. Line number 0 means first line, even though first line has number 1.

>
> Following things are tried at the end of the function:
>
>
> 1. Tried loading the file and searching in it using two different
> statements:
>
> exec "e" file
> search(searchpat,"")
>
> With this, I find that such search is applied to current file instead of
> new file and then the file is loaded. I find this strange.

How did you check that "search is applied to current file"? I see that
these commands are not going to work because there is no `:search`
command.

And you forgot `fnameescape()`. First line should be `:execute 'e'
fnameescape(file)` or you get problems with special characters in
`file`.

>
>
> 2. From above, assuming loading and searching as two statements won't
> work, tried:
>
> exec "+/" searchpat file
>
> But this breaks with searchpat having spaces (even if I use \" to cover
> the search pattern).

?! This command is not opening a file, it will run something like

+/{space}{search pattern}{space}{filename}

: perform search in the current file, starting from the current line
(same {range} without command interpretation).

>
>
>
> 3. To overcome above problem, I replaced all spaces in searchpat with ".".
> Now this is closest to what I need. But now the pattern is not highlighted
> automatically. I have to say "/<Up>" to get the search pattern again
> interactively and then it jumps to and highlights the pattern.
>
>
> Sorry about the length of mail. Just wanted to share whatever is already
> tried to describe the problem.
>
> Hope some solution is possible.
>
> Mayuresh
>
> --
> --
> 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.

Thursday, January 26, 2017

How to open another file and go to a search pattern

I have a requirement where the cursor is on following line:

SomeFileName : Some Multiple Words of Search Pattern

I want to define a hot key (Say <C-o>) to open SomeFileName and go to and
highlight the whole pattern "Some Multiple Words of Search Pattern"

Following is my attempt to solve it, which has not succeeded fully:

In vimrc:

function! GoToFile()
let line = getline(".")
let searchpat = split(line,":")[1]
let file = split(line," ")[1]
" See below what all I tried here
endfunction
map <C-o> :exec GoToFile()<CR>

Following things are tried at the end of the function:


1. Tried loading the file and searching in it using two different
statements:

exec "e" file
search(searchpat,"")

With this, I find that such search is applied to current file instead of
new file and then the file is loaded. I find this strange.


2. From above, assuming loading and searching as two statements won't
work, tried:

exec "+/" searchpat file

But this breaks with searchpat having spaces (even if I use \" to cover
the search pattern).



3. To overcome above problem, I replaced all spaces in searchpat with ".".
Now this is closest to what I need. But now the pattern is not highlighted
automatically. I have to say "/<Up>" to get the search pattern again
interactively and then it jumps to and highlights the pattern.


Sorry about the length of mail. Just wanted to share whatever is already
tried to describe the problem.

Hope some solution is possible.

Mayuresh

--
--
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: annoying PasteStart/PasteEnd

Johannes-Maria Kaltenbach wrote:

> On Wed, Jan 25, 2017 at 01:53:54PM +0100, Johannes-Maria Kaltenbach wrote:
> > On Tue, Jan 24, 2017 at 03:58:14PM +0100, Bram Moolenaar wrote:
> > > Found it: part of the change was missing from the patch.
> > > So it worked for me but nobody else.
> >
> > Thanks.
> > I've updated now to vim-8.0.237 and it works fine.
>
> but (at least for me) it is better to keep 'set t_BE=' in the
> configuration file. The <PasteStart>/<PasteEnd> around pasted
> text is gone but if one yanks a whole line (or part of the line
> until the end of the line) with the mouse and pastes it in an
> xterm then the pasted text contains a ^M at the end instead
> of executing a 'return' (as was the old behaviour and the one
> I prefer instead of first deleting the ^M and then pressing
> return).
> [Only in command line (including searches), not while inserting
> in buffer.]

I assume you are talking about the command line, or entering search.
Yes, it's intentional that the line break does not work like pressing
Enter. The idea is that you are pasting text, not a command.
You are supposed to view the text before deciding to execute it.
The thread that started it mentioned that the source of the text may
give you something else than what you expected. In practice, what often
happens is that you accidentally copy the wrong text and include the
line break when that is not intended.

--
ARTHUR: Be quiet!
DENNIS: --but by a two-thirds majority in the case of more--
ARTHUR: Be quiet! I order you to be quiet!
WOMAN: Order, eh -- who does he think he is?
ARTHUR: I am your king!
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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.

viminfo file location for Vim 8

I use the following line in my vimrc (Windows):

    set viminfo=\"50,'500,:500,/500,h,f1,rA:,r$TEMP:,r$TMP:,r$TMPDIR:!,n$VIM/_viminfo


For Vim 5,6,7 this works as expected and the _viminfo file is created in my $VIM root directory.

When I upgraded to Vim 8, now the _viminfo is being created in whatever directory I launched Vim from.  I have been through the docs and do not see what might be causing it.

The text for the viminfo options for the "n" parameter appears to be unchanged between Vim 7 and Vim 8:

Other options you might want to use:
n name used for the viminfo file (must be the last option)

I have also tried shortening my set viminfo line and playing around.

Anyone have any ideas?

Thanks,
David

--
--
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: annoying PasteStart/PasteEnd

On Wed, Jan 25, 2017 at 01:53:54PM +0100, Johannes-Maria Kaltenbach wrote:
> On Tue, Jan 24, 2017 at 03:58:14PM +0100, Bram Moolenaar wrote:
> > Found it: part of the change was missing from the patch.
> > So it worked for me but nobody else.
>
> Thanks.
> I've updated now to vim-8.0.237 and it works fine.

but (at least for me) it is better to keep 'set t_BE=' in the
configuration file. The <PasteStart>/<PasteEnd> around pasted
text is gone but if one yanks a whole line (or part of the line
until the end of the line) with the mouse and pastes it in an
xterm then the pasted text contains a ^M at the end instead
of executing a 'return' (as was the old behaviour and the one
I prefer instead of first deleting the ^M and then pressing
return).
[Only in command line (including searches), not while inserting
in buffer.]

Best regards,
Johannes-Maria



--
--
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.

Wednesday, January 25, 2017

Re: How to make the curly brace on the same line when press enter between them ?

On 2017-01-25, Zhe Lee wrote:
> On Thursday, January 26, 2017 at 10:06:09 AM UTC+8, Gary Johnson wrote:
> > On 2017-01-25, Zhe Lee wrote:
> > > On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:
> > > > On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee wrote:
> > > > > here is the thing:
> > > > > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > > > > How to fix it?
> > > > >
> > > >
> > > > If you mean they are not in the same (vertical) _column_ then I'm not
> > > > sure; it may or may not be possible, check in particular the options
> > > > containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> > > > then hit Tab until you come to an entry that looks promising).
> > > >
> > > > OTOH, if what worries you is really that they aren't on the same
> > > > (horizontal) _line_ then the answer is simple: Dont hit Enter between
> > > > them, but possibly the space bar, the Tab key, or even nothing. Or
> > > > type them both one after the other, then hit Left-Arrow to bring the
> > > > cursor back between them.
> > > >
> > > > Best regards,
> > > > Tony.
> > >
> > > I mean that when the cursor is between a pair of curly braces(the
> > > curly braces just at the beginning of the line), press enter now
> > > the right brace should be at the start of a newline, but it seems
> > > add a `tab` first and then insert the } at the new line.
> >
> > That behavior is controlled by the indent settings made in your
> > ~/.vimrc or in the indent plugin for the file type you are editing.
> > What do you see when you execute this?
> >
> > :verbose ft? cindent? cinoptions? indentexpr?
> >
> > Regards,
> > Gary
>
> yeah as for me is about the settiing of the indentexpr? thx~

Just to satisfy my own curiosity, what did you discover?

Regards,
Gary

--
--
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 to make the curly brace on the same line when press enter between them ?

On Thursday, January 26, 2017 at 10:06:09 AM UTC+8, Gary Johnson wrote:
> On 2017-01-25, Zhe Lee wrote:
> > On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:
> > > On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee wrote:
> > > > here is the thing:
> > > > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > > > How to fix it?
> > > >
> > >
> > > If you mean they are not in the same (vertical) _column_ then I'm not
> > > sure; it may or may not be possible, check in particular the options
> > > containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> > > then hit Tab until you come to an entry that looks promising).
> > >
> > > OTOH, if what worries you is really that they aren't on the same
> > > (horizontal) _line_ then the answer is simple: Dont hit Enter between
> > > them, but possibly the space bar, the Tab key, or even nothing. Or
> > > type them both one after the other, then hit Left-Arrow to bring the
> > > cursor back between them.
> > >
> > > Best regards,
> > > Tony.
> >
> > I mean that when the cursor is between a pair of curly braces(the
> > curly braces just at the beginning of the line), press enter now
> > the right brace should be at the start of a newline, but it seems
> > add a `tab` first and then insert the } at the new line.
>
> That behavior is controlled by the indent settings made in your
> ~/.vimrc or in the indent plugin for the file type you are editing.
> What do you see when you execute this?
>
> :verbose ft? cindent? cinoptions? indentexpr?
>
> Regards,
> Gary

yeah as for me is about the settiing of the indentexpr? thx~

--
--
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 to make the curly brace on the same line when press enter between them ?

On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:
> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <imlegendlzz@gmail.com> wrote:
> > here is the thing:
> > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > How to fix it?
> >
>
> If you mean they are not in the same (vertical) _column_ then I'm not
> sure; it may or may not be possible, check in particular the options
> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> then hit Tab until you come to an entry that looks promising).
>
> OTOH, if what worries you is really that they aren't on the same
> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> them, but possibly the space bar, the Tab key, or even nothing. Or
> type them both one after the other, then hit Left-Arrow to bring the
> cursor back between them.
>
> Best regards,
> Tony.
Oh if in vimrc file the result will be normal:
{
}

but if in a new buffer it will be:
{
}

Is there a way to debug what happened in the process ? Like use the debug ?

just use debug call Testf() doesn't work here.

function! Testf()
" execute "norm i{}\<left>\<CR>"
execute "norm i{\<CR>"
endfunction

--
--
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 to make the curly brace on the same line when press enter between them ?

On 2017-01-25, Zhe Lee wrote:
> On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:
> > On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee wrote:
> > > here is the thing:
> > > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > > How to fix it?
> > >
> >
> > If you mean they are not in the same (vertical) _column_ then I'm not
> > sure; it may or may not be possible, check in particular the options
> > containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> > then hit Tab until you come to an entry that looks promising).
> >
> > OTOH, if what worries you is really that they aren't on the same
> > (horizontal) _line_ then the answer is simple: Dont hit Enter between
> > them, but possibly the space bar, the Tab key, or even nothing. Or
> > type them both one after the other, then hit Left-Arrow to bring the
> > cursor back between them.
> >
> > Best regards,
> > Tony.
>
> I mean that when the cursor is between a pair of curly braces(the
> curly braces just at the beginning of the line), press enter now
> the right brace should be at the start of a newline, but it seems
> add a `tab` first and then insert the } at the new line.

That behavior is controlled by the indent settings made in your
~/.vimrc or in the indent plugin for the file type you are editing.
What do you see when you execute this?

:verbose ft? cindent? cinoptions? indentexpr?

Regards,
Gary

--
--
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 to make the curly brace on the same line when press enter between them ?

On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:
> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <imlegendlzz@gmail.com> wrote:
> > here is the thing:
> > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > How to fix it?
> >
>
> If you mean they are not in the same (vertical) _column_ then I'm not
> sure; it may or may not be possible, check in particular the options
> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> then hit Tab until you come to an entry that looks promising).
>
> OTOH, if what worries you is really that they aren't on the same
> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> them, but possibly the space bar, the Tab key, or even nothing. Or
> type them both one after the other, then hit Left-Arrow to bring the
> cursor back between them.
>
> Best regards,
> Tony.

I mean that when the cursor is between a pair of curly braces(the curly braces just at the beginning of the line), press enter now the right brace should be at the start of a newline, but it seems add a `tab` first and then insert the } at the new line.

--
--
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 to make the curly brace on the same line when press enter between them ?

On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:
> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <imlegendlzz@gmail.com> wrote:
> > here is the thing:
> > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > How to fix it?
> >
>
> If you mean they are not in the same (vertical) _column_ then I'm not
> sure; it may or may not be possible, check in particular the options
> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> then hit Tab until you come to an entry that looks promising).
>
> OTOH, if what worries you is really that they aren't on the same
> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> them, but possibly the space bar, the Tab key, or even nothing. Or
> type them both one after the other, then hit Left-Arrow to bring the
> cursor back between them.
>
> Best regards,
> Tony.

Yeah, I mean the same column, I try to debug the function testf()(which pic is in another post of mine below), and locate the problem but it worked normally this time.

--
--
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 to make the curly brace on the same line when press enter between them ?

On Thursday, January 26, 2017 at 4:23:09 AM UTC+8, Tony Mechelynck wrote:
> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <imlegendlzz@gmail.com> wrote:
> > here is the thing:
> > {|}, | is my curve when I press enter now the curly braces will not on the same line.
> > How to fix it?
> >
>
> If you mean they are not in the same (vertical) _column_ then I'm not
> sure; it may or may not be possible, check in particular the options
> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> then hit Tab until you come to an entry that looks promising).
>
> OTOH, if what worries you is really that they aren't on the same
> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> them, but possibly the space bar, the Tab key, or even nothing. Or
> type them both one after the other, then hit Left-Arrow to bring the
> cursor back between them.
>
> Best regards,
> Tony.

yeah, I mean the curly braces not in the same column, plz check my update

--
--
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 to make the curly brace on the same line when press enter between them ?

On Thursday, January 26, 2017 at 7:36:31 AM UTC+8, DrChip wrote:
> Tony Mechelynck wrote:
> > P.S. See also «:help 'cinoptions'» if it is a C-like language.
> >
> > Best regards,
> > Tony.
> >
> > On Wed, Jan 25, 2017 at 9:23 PM, Tony Mechelynck
> > <antoine.mechelynck@gmail.com> wrote:
> >> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <imlegendlzz@gmail.com> wrote:
> >>> here is the thing:
> >>> {|}, | is my curve when I press enter now the curly braces will not on the same line.
> >>> How to fix it?
> >>>
> >> If you mean they are not in the same (vertical) _column_ then I'm not
> >> sure; it may or may not be possible, check in particular the options
> >> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> >> then hit Tab until you come to an entry that looks promising).
> >>
> >> OTOH, if what worries you is really that they aren't on the same
> >> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> >> them, but possibly the space bar, the Tab key, or even nothing. Or
> >> type them both one after the other, then hit Left-Arrow to bring the
> >> cursor back between them.
> >>
> This may be a question about a plugin which facilitates entry of things
> like{...}. A snippet, perhaps? If so, find the plugin author in the
> documentation and ask him/her.
>
> Chip Campbell

It happens in the new buffer with no filetype, and I check the _.snippet file but there is no related snippet.

I try to debug the process by call the Testf() but it works normally this time.
I don't know why.

--
--
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 to make the curly brace on the same line when press enter between them ?

Tony Mechelynck wrote:
> P.S. See also «:help 'cinoptions'» if it is a C-like language.
>
> Best regards,
> Tony.
>
> On Wed, Jan 25, 2017 at 9:23 PM, Tony Mechelynck
> <antoine.mechelynck@gmail.com> wrote:
>> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <imlegendlzz@gmail.com> wrote:
>>> here is the thing:
>>> {|}, | is my curve when I press enter now the curly braces will not on the same line.
>>> How to fix it?
>>>
>> If you mean they are not in the same (vertical) _column_ then I'm not
>> sure; it may or may not be possible, check in particular the options
>> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
>> then hit Tab until you come to an entry that looks promising).
>>
>> OTOH, if what worries you is really that they aren't on the same
>> (horizontal) _line_ then the answer is simple: Dont hit Enter between
>> them, but possibly the space bar, the Tab key, or even nothing. Or
>> type them both one after the other, then hit Left-Arrow to bring the
>> cursor back between them.
>>
This may be a question about a plugin which facilitates entry of things
like{...}. A snippet, perhaps? If so, find the plugin author in the
documentation and ask him/her.

Chip Campbell

--
--
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.

idx-edx: Different Character count in Vim and Python

Example:

s="I like crème caramel but not only caramel I also like crème fraîche."

Searching the idx-edx numbers of the matches of the word "crème":
echo matchstrpos(s, "crème") --> 7,13
echo matchstrpos(s, "crème",14) --> 55,61

I do have a python function in which I transform the above string using slices.
But the problem is that in python accented letters are counted as 1
and in Vim as 2, my slicing goes wrong.

How can I resolve this problem?

--
--
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 to make the curly brace on the same line when press enter between them ?

P.S. See also «:help 'cinoptions'» if it is a C-like language.

Best regards,
Tony.

On Wed, Jan 25, 2017 at 9:23 PM, Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:
> On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <imlegendlzz@gmail.com> wrote:
>> here is the thing:
>> {|}, | is my curve when I press enter now the curly braces will not on the same line.
>> How to fix it?
>>
>
> If you mean they are not in the same (vertical) _column_ then I'm not
> sure; it may or may not be possible, check in particular the options
> containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
> then hit Tab until you come to an entry that looks promising).
>
> OTOH, if what worries you is really that they aren't on the same
> (horizontal) _line_ then the answer is simple: Dont hit Enter between
> them, but possibly the space bar, the Tab key, or even nothing. Or
> type them both one after the other, then hit Left-Arrow to bring the
> cursor back between them.
>
> Best regards,
> Tony.

--
--
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 to make the curly brace on the same line when press enter between them ?

On Wed, Jan 25, 2017 at 7:11 PM, Zhe Lee <imlegendlzz@gmail.com> wrote:
> here is the thing:
> {|}, | is my curve when I press enter now the curly braces will not on the same line.
> How to fix it?
>

If you mean they are not in the same (vertical) _column_ then I'm not
sure; it may or may not be possible, check in particular the options
containing "indent" (:help '*indent*' but hit Ctrl-D instead of Enter,
then hit Tab until you come to an entry that looks promising).

OTOH, if what worries you is really that they aren't on the same
(horizontal) _line_ then the answer is simple: Dont hit Enter between
them, but possibly the space bar, the Tab key, or even nothing. Or
type them both one after the other, then hit Left-Arrow to bring the
cursor back between them.

Best regards,
Tony.

--
--
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.

How to make the curly brace on the same line when press enter between them ?

here is the thing:
{|}, | is my curve when I press enter now the curly braces will not on the same line.
How to fix it?


![0126020710.png](http://7xpvdr.com1.z0.glb.clouddn.com/0126020710.png)

brace seems normal here
![0126020934.png](http://7xpvdr.com1.z0.glb.clouddn.com/0126020934.png)

--
--
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: GNU screen hardstatus line

Thanks ewfalor and ZyX,

I see what you mean.

ps -ostart_time $(echo $STY | cut -d. -f1)

will give me the start time and

ps -p $(echo $STY | cut -d. -f1) -o etime

will give me the elapsed time.

I finally end up with using the following backtick in my .screenrc:

backtick 0 30 30 sh -c 'ps -o lstart $(echo $STY | cut -d. -f1) '

Thanks


On Wednesday, January 25, 2017 at 11:29:56 AM UTC-5, ewfalor wrote:
> On Wed, Jan 25, 2017 at 08:12:25AM -0800, Allan wrote:
> > Hi
> >
> > Is there a way to note down the starting time or the duration of the current screen session? I always resume after a long time after and feel it would be helpful to know when the screen session was started.
>
> This is not really a vim question, but I'll bite.
>
> Unfortunately, screen's built-in 'time' command gives you the current
> time instead of the duration of the screen session itself.
>
> Offhand, I'd suggest asking ps(1) for the starting time of your screen
> server. You can get the PID of the screen server from the STY
> environment variable from within screen:
>
> ps -ostart_time $(echo $STY | cut -d. -f1)
>
> You could put the output of a variation of that command into the
> statusline by means of screen's 'backtick' command.
>
> For follow-up discussion, I recommend the screen-users mailing list
>
> http://lists.gnu.org/archive/html/screen-users
>
> and/or the #screen channel on Freenode.
>
> --
> Erik Falor
> Registered Linux User #445632 http://unnovative.net

--
--
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: GNU screen hardstatus line

On Wed, Jan 25, 2017 at 08:12:25AM -0800, Allan wrote:
> Hi
>
> Is there a way to note down the starting time or the duration of the current screen session? I always resume after a long time after and feel it would be helpful to know when the screen session was started.

This is not really a vim question, but I'll bite.

Unfortunately, screen's built-in 'time' command gives you the current
time instead of the duration of the screen session itself.

Offhand, I'd suggest asking ps(1) for the starting time of your screen
server. You can get the PID of the screen server from the STY
environment variable from within screen:

ps -ostart_time $(echo $STY | cut -d. -f1)

You could put the output of a variation of that command into the
statusline by means of screen's 'backtick' command.

For follow-up discussion, I recommend the screen-users mailing list

http://lists.gnu.org/archive/html/screen-users

and/or the #screen channel on Freenode.

--
Erik Falor
Registered Linux User #445632 http://unnovative.net

--
--
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: GNU screen hardstatus line

2017-01-25 19:12 GMT+03:00 Allan <mahe6562@gmail.com>:
> Hi
>
> Is there a way to note down the starting time or the duration of the current screen session? I always resume after a long time after and feel it would be helpful to know when the screen session was started.

`ps -p {process id} -o etime` (for the current shell: `ps -p $$ -o
etime`). Universal, works for every app. Though can't say how this
interacts with hibernation and <C-z> suspends.

May need to check `pstree -p -h` or `ps -t $TTY` to get `{process id}`.

>
> Thanks
>
> --
> --
> 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.

GNU screen hardstatus line

Hi

Is there a way to note down the starting time or the duration of the current screen session? I always resume after a long time after and feel it would be helpful to know when the screen session was started.

Thanks

--
--
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: annoying PasteStart/PasteEnd

On Tue, Jan 24, 2017 at 03:58:14PM +0100, Bram Moolenaar wrote:
> Found it: part of the change was missing from the patch.
> So it worked for me but nobody else.

Thanks.
I've updated now to vim-8.0.237 and it works fine.

Best regards,
Johannes-Maria


--
--
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.

Tuesday, January 24, 2017

Re: annoying PasteStart/PasteEnd

Johannes-Maria Kaltenbach wrote:

> > > > > I just updated vim from 8.0.197 to 8.0.222 and now I
> > > > > always get a very annoying <PasteStart> before and
> > > > > <PasteEnd> after anything I paste with the mouse
> > > > > (middle button) in an xterm on Unix (BSD).
> > > > > How can I get rid of this 'feature'?
> > > >
> > > > Support for bracketed paste was added, it is supposed to make paste work
> > > > better.
> > > >
> > > > I cannot see the problem. Can you say what exactly you do?
> > > > What is your 'mouse' setting?
> > >
> > > no setting.
> > > ('verbose set mouse' just returns 'mouse='.)
> > >
> > > I don't use gvim, only vim in an xterm.
> > > and just use the mouse as usual in X windows.
> > >
> > > When I yank something (left mouse butten), e. g. 'xxx',
> > > and paste it (with the middle mouse butten) then the xxx
> > > is surrounded by <PasteStart> and <PasteEnd>:
> > >
> > > <PasteStart>xxx<PasteEnd>
> > >
> > > I've got rid of this with Christian's help by adding
> > > 'set t_BE=' to my .exrc.
> > >
> > >
> > > I only found out today that this occurs only in the
> > > command line (:) or search (/, ?), not when writing
> > > to the buffer.
> >
> > Whatever I try I cannot reproduce it.
> >
> > Does this still happen when you start Vim with:
> >
> > vim -u NONE -N
> >
> > When not resetting t_BE, of course.
>
> yes

Found it: part of the change was missing from the patch.
So it worked for me but nobody else.

--
I still remember when I gave up Smoking, Drinking and Sex. It was the
most *horrifying* hour of my life!

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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: annoying PasteStart/PasteEnd

On Tuesday, January 24, 2017 at 8:51:08 AM UTC-5, Bram Moolenaar wrote:
> Does this still happen when you start Vim with:
>
> vim -u NONE -N
>
> When not resetting t_BE, of course.

It happens for me, but only when I paste in command line mode. Changing t_BE makes no difference. I use Jonathon Fernyhough's Ubuntu vim as described at https://launchpad.net/~jonathonf/+archive/ubuntu/vim

--
--
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: annoying PasteStart/PasteEnd

On 24 January 2017 at 15:02, Johannes-Maria Kaltenbach
<johannes-maria@t-online.de> wrote:
>> Whatever I try I cannot reproduce it.
>>
>> Does this still happen when you start Vim with:
>>
>> vim -u NONE -N
>>
>> When not resetting t_BE, of course.
>
> yes

I've just updated vim to 8.226 and get the same issue. Works fine in
the buffer window, but not in the command line. This is with Vim
running in a gnome terminal.

--
--
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: annoying PasteStart/PasteEnd

On Tue, Jan 24, 2017 at 02:51:00PM +0100, Bram Moolenaar wrote:
>
> Johannes-Maria Kaltenbach wrote:
>
> > > > I just updated vim from 8.0.197 to 8.0.222 and now I
> > > > always get a very annoying <PasteStart> before and
> > > > <PasteEnd> after anything I paste with the mouse
> > > > (middle button) in an xterm on Unix (BSD).
> > > > How can I get rid of this 'feature'?
> > >
> > > Support for bracketed paste was added, it is supposed to make paste work
> > > better.
> > >
> > > I cannot see the problem. Can you say what exactly you do?
> > > What is your 'mouse' setting?
> >
> > no setting.
> > ('verbose set mouse' just returns 'mouse='.)
> >
> > I don't use gvim, only vim in an xterm.
> > and just use the mouse as usual in X windows.
> >
> > When I yank something (left mouse butten), e. g. 'xxx',
> > and paste it (with the middle mouse butten) then the xxx
> > is surrounded by <PasteStart> and <PasteEnd>:
> >
> > <PasteStart>xxx<PasteEnd>
> >
> > I've got rid of this with Christian's help by adding
> > 'set t_BE=' to my .exrc.
> >
> >
> > I only found out today that this occurs only in the
> > command line (:) or search (/, ?), not when writing
> > to the buffer.
>
> Whatever I try I cannot reproduce it.
>
> Does this still happen when you start Vim with:
>
> vim -u NONE -N
>
> When not resetting t_BE, of course.

yes


Best regards,
Johannes-Maria


--
--
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: annoying PasteStart/PasteEnd

Johannes-Maria Kaltenbach wrote:

> > > I just updated vim from 8.0.197 to 8.0.222 and now I
> > > always get a very annoying <PasteStart> before and
> > > <PasteEnd> after anything I paste with the mouse
> > > (middle button) in an xterm on Unix (BSD).
> > > How can I get rid of this 'feature'?
> >
> > Support for bracketed paste was added, it is supposed to make paste work
> > better.
> >
> > I cannot see the problem. Can you say what exactly you do?
> > What is your 'mouse' setting?
>
> no setting.
> ('verbose set mouse' just returns 'mouse='.)
>
> I don't use gvim, only vim in an xterm.
> and just use the mouse as usual in X windows.
>
> When I yank something (left mouse butten), e. g. 'xxx',
> and paste it (with the middle mouse butten) then the xxx
> is surrounded by <PasteStart> and <PasteEnd>:
>
> <PasteStart>xxx<PasteEnd>
>
> I've got rid of this with Christian's help by adding
> 'set t_BE=' to my .exrc.
>
>
> I only found out today that this occurs only in the
> command line (:) or search (/, ?), not when writing
> to the buffer.

Whatever I try I cannot reproduce it.

Does this still happen when you start Vim with:

vim -u NONE -N

When not resetting t_BE, of course.

--
Futility Factor: No experiment is ever a complete failure - it can always
serve as a negative example.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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.