Thursday, April 1, 2010

Re: vim says error messages in linux machine not in windows machine

iconv -f cp949 -t utf8 ~/_vimrc
 &&
dos2unix ~/_vimrc
 &&
find ~/.vim -type f | xargs dos2unix

iconv is for broken hangul alphabets.
dos2unix is for dostype text files(dostype dosn't use LF only but CR also. unixtype uses LF only.)

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

Some text formatting questions

When I write some text in vim and enter each item preceded by "-" like:

- text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text

the lines from the third is not intended. Is there a way to correct
this?

Also if I edit text already written with backspace, then the text that
is left get one extra whitespace. Is there a setting for this?


Jostein

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

To unsubscribe, reply using "remove me" as the subject.

Re: Vimscript to paste into a file

Hi,

davvs wrote:
>
> Hi I want to find out if there's any way to run a one line shell command to
> do the same as the following:
>
> vim pastefile.txt
> (press keyboard buttons GO"*pwq!)

I guess you meant '0' (Zero) instead of 'O' (upper case oh) and that there
is a colon missing before 'wq!'.

>
> I want someting like this:
> prompt> vim pastefile.txt -inputchars 'GO"*pwdq!"
> prompt>

You can achieve this with

vim -c 'normal G0"*p' -c 'wq!' pastefile.txt

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

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

To unsubscribe, reply using "remove me" as the subject.

Re: concatenate with '.' or without

Am 30.03.2010 19:36, schrieb Tony Mechelynck:
> On 31/01/10 18:12, Gary Johnson wrote:
>> On 2010-01-30, Bee wrote:
>>> On Jan 29, 10:52 am, "Benjamin R. Haskell"<v...@benizi.com> wrote:
>>>> On Fri, 29 Jan 2010, Bee wrote:
>>>>> On Jan 29, 7:43 am, "Benjamin R. Haskell"<v...@benizi.com> wrote:
>>>>>> ...
>>>>>> :redir @a
>>>>>> ...
>>>>> How to save directly to a filename?
>>>>> [...]
>>>>> But this creates a file named savevimrc in $HOME
>>>>> redir> savevimrc
>>>>> How to expand savevimrc to the file name?
>>>> :exe "redir> " . savevimrc
>>>
>>> Will this always do the same?
>>> :exe "redir>" savevimrc
>>
>> Yes.
>>
>>> From what I have read '.' concatenates without adding spaces,
>>> whereas without using '.' a space will be added.
>>
>> '.' is an expression operator and will concatenate two strings in a
>> context where an expression is allowed. Not having to use a '.'
>> between arguments of an exe command is a property of the exe
>> command, which concatenates all of its arguments with intervening
>> spaces.
>>
>>> Is it just better to get the habit of using '.' ?
>>
>> No, not if you're paying attention to the context in which you're
>> concatenating strings. I prefer not to use the '.' in exe arguments
>> if I can avoid it because it looks less cluttered.
>>
>> Now that I look at them, the examples under ":help :exe" are
>> confusing. The first two examples include spaces after the executed
>> command names even though none are needed there.
>>
>> Regards,
>> Gary
>
> I agree: both "exe[cute]" and "echo" treat their arguments the same way:
> any number of expressions are allowed, and their values are concatenated
> space-separated into one long string before being further processed.
> Then :echo displays the result while :exe treats it as an ex-command
> line. IOW you can always use :echo instead of :exe to make sure which
> ex-command :exe would generate.

Almost ...

:echo {expr1} {expr2}

slightly differs from

:echo {expr1}.' '.{expr2}

The first command echoes the result of {exprN} before evaluating the next.

------------------
func! TestString()
echon '!'
return 'foo'
endfunc

echon TestString() TestString()
echo ""
echon TestString()." ".TestString()
------------------

!foo!foo
!!foo foo

--
Andy

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

Vimscript to paste into a file

Hi I want to find out if there's any way to run a one line shell command to
do the same as the following:

vim pastefile.txt
(press keyboard buttons GO"*pwq!)

I want someting like this:
prompt> vim pastefile.txt -inputchars 'GO"*pwdq!"
prompt>

--
View this message in context: http://old.nabble.com/Vimscript-to-paste-into-a-file-tp28106196p28106196.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

To unsubscribe, reply using "remove me" as the subject.

Re: calling dictionary functions with call()

Am 01.04.2010 04:31, schrieb Ted:
> Hello,
> I'm hoping to call a "static" dictionary function using call(). By
> "static" I mean that the keyword 'dict' is not used in the function's
> definition. I use this nomenclature in the hopes that the effect of
> this keyword is to declare a static member function as is possible in
> java/C++/etc, ie to restrict the scope of the function name without
> requiring it to be associated with an object. However this doesn't
> seem to work. For example:
>
> " Setup:
> let testdict = { }
> funct! testdict.funct()
> echo "called"
> endfunct
>
> " Tests:
> " Following each line is an indented comment containing its
> " output in message land, ie what was echoed.
> call testdict.funct()
> " called
> echo testdict.funct
> " 667
> echo string(testdict.funct)
> " function('667')
> echo function('667')
> " E475: Invalid argument: 667
> echo function('testdict.funct')
> " testdict.funct
> call call(testdict.funct, [ ])
> " E725: Calling dict function without Dictionary: 667

If it wants a dict, then give it a dict:

call call(testdict.funct, [], {})

> " Same deal if there's an intermediate variable involved.
> let TestdictDotFunct = testdict.funct
> echo TestdictDotFunct
> " 667
> echo string(TestdictDotFunct)
> " function('667')
> call TestdictDotFunct()
> " E725: Calling dict function without Dictionary: 667

call call(TestdictDotFunct, [], {})

>> From the help topic *E725*:
> It is also possible to add a function without the "dict" attribute
> as a Funcref to a Dictionary, but the "self" variable is not
> available then.

Applies when the function is global:
func! GlobalFunc()
echo exists("self")
endfunc
let testdict.onemorefunc = function("GlobalFunc")

> So logic would seem to indicate that if "self" is not available, then
> it should be possible to call the function referenced by the Funcref
> without a Dictionary. However this doesn't seem to be the case. Am I
> missing something?

It's because the following implies the dict attribute:

let testdict = { }
funct! testdict.funct()
...

HTH (no warranty),
Andy

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

To unsubscribe, reply using "remove me" as the subject.

Re: How to remember end of line when quitting/reopening in insert mode

Hi Andy,
One (last?) suggestion to improve lastpos.vim

1) Consider a .vimrc containing the following 2 lines:
set insertmode
imap <F8> <C-\><C-O>:bprevious<CR>

Please do the following:
gvim file1
CTRL-O :e file2
put the cursor at the end of line 10
<F8>
put the cursor at the end of line 10 (in file1)
Use <F8> several times
You see that the end of lines are remembered (Good)

2) Just add "set hidden" in the .vimrc
set insertmode
set hidden
imap <F8> <C-\><C-O>:bprevious<CR>

Please do the following:
gvim file1
CTRL-O :e file2
put the cursor at the end of line 10
<F8>
put the cursor at the end of line 10 (in file1)
Use <F8> several times
You see that only line numbers are remembered. The cursor is always on
column 1.

Can you improve that?

Hint: Using vimrc_example.vim as .vimrc (without lastpos.vim), the
same problem occurs in normal mode. The solution is to replace
BufReadPost with BufWinEnter in vimrc_example.vim.

Best regards
Jean Johner

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

To unsubscribe, reply using "remove me" as the subject.