Re: Why .swp can be generated?

2015-05-05 Thread Gary Johnson
On 2015-05-05, Peng Yu wrote:
> Hi, When I open a file, a file like .somefile.swp will be generated.
> But why a file .swp (without the filename) can be generated?

You will get a file named .swp if you open a new unnamed buffer and
enter text into it.  For example, start Vim as

$ vim

and add some text,

ahello

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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why .swp can be generated?

2015-05-05 Thread Nikolay Pavlov
2015-05-06 6:44 GMT+03:00 Peng Yu :
> Hi, When I open a file, a file like .somefile.swp will be generated.
> But why a file .swp (without the filename) can be generated?

Extension is the part of the filename. File `.swp` does have the filename.

This can be generated when you view a directory.

>
> --
> Regards,
> Peng
>
> --
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Why .swp can be generated?

2015-05-05 Thread Peng Yu
Hi, When I open a file, a file like .somefile.swp will be generated.
But why a file .swp (without the filename) can be generated?

-- 
Regards,
Peng

-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Strange behavior after insert some shortcuts...

2015-05-05 Thread Raphael Rabelo de Oliveira
yes, this was the problem!

I'm trying to organize the vimrc with comments and this broken my configs.
I removed the comments and all working now!
I didn't know that i can't put the comments in the same line!

Thanks

On Mon, May 4, 2015 at 12:18 AM, Ben Fritz  wrote:

> On Saturday, May 2, 2015 at 6:47:17 AM UTC-5, Raphael Rabelo de Oliveira
> wrote:
> > Hello guys,
> > I'm trying to add some shortcuts to my vimrc file, but a weird behavior
> is happening:
> >
> > When i use the new shortcuts, the vim moves the cursor automatically,
> it's a very strange!
> >
> > I'm sending my "good" vimrc: http://pastebin.com/aCKJD4a2
> >
> > Here the new shortcuts that I want insert:
> >
> > nnoremap  G
> > nnoremap  gg
> > nnoremap x :x
> > nnoremap w :w
> >
>
> Are the trailing spaces actually there in your .vimrc or just part of the
> email?
>
> If they're actually in your .vimrc, then Vim is running the ` ` command
> which moves the cursor forward.
>
> If that's not your problem, then you really need to specify what "moves
> the cursor automatically" means.
>
> --
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Raphael Rabelo de Oliveira
Red Hat Certified Enginner - RHCE
Cel: 11 96105-8257
www.raphaelr.com.br

[image: Raphael Rabelo's profile on LinkedIn]


-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to determine whether an option is boolean?

2015-05-05 Thread Paul Isambert
> Some vim options are boolean, i.e. integers with the possible values 0 and 1. 
> You can, e.g., set `ai` and `noai` or use `let &ai = 1`. Other options are 
> numeric/integer or string values.
> 
> type(&option) can only be used to distinguish string from bool/int options. 
> exist('&noai') returns 0, so it cannot be used to distinguish bool from int 
> options. Is there another way to determine whether an option is a bool (an 
> int that takes only the values 0 or 1) or an int?

Off my head:

function! IsBoolean (option)
  if !exists("&" . a:option)
return 0
  endif
  let bool = 1
  exe "let old = &" . a:option
  try
exe "set no" . a:option 
  catch
let bool = 0
  endtry
  exe "let &" . a:option . " = " . old
  return bool
endfunction

I’m not sure setting and resetting the option is 100% harmless for all
options, though.

Best,
Paul

-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to determine whether an option is boolean?

2015-05-05 Thread Christian Brabandt

Am 2015-05-05 11:21, schrieb lith:

Hi!

Some vim options are boolean, i.e. integers with the possible values 0
and 1. You can, e.g., set `ai` and `noai` or use `let &ai = 1`. Other
options are numeric/integer or string values.

type(&option) can only be used to distinguish string from bool/int
options. exist('&noai') returns 0, so it cannot be used to distinguish
bool from int options. Is there another way to determine whether an
option is a bool (an int that takes only the values 0 or 1) or an int?


Some hacks, I can think of:
- parsing $VIMRUNTIME/doc/options.txt
- try/catch block around :set inv

BTW: What is the problem with treating boolean options like integer?

Best,
Christian

--
--
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to determine whether an option is boolean?

2015-05-05 Thread lith
Hi!

Some vim options are boolean, i.e. integers with the possible values 0 and 1. 
You can, e.g., set `ai` and `noai` or use `let &ai = 1`. Other options are 
numeric/integer or string values.

type(&option) can only be used to distinguish string from bool/int options. 
exist('&noai') returns 0, so it cannot be used to distinguish bool from int 
options. Is there another way to determine whether an option is a bool (an int 
that takes only the values 0 or 1) or an int?

Regards,
Tom

-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.