textwidth is fastened at 78, and "Function MyDiff already exists" message pops up when configuration update

37 views
Skip to first unread message

김재학

unread,
Sep 20, 2016, 3:08:36 AM9/20/16
to vim_use
Greetings,

I'm jaehak Kim and I downloaded Gvim for windows for the first time.
OS of computer is windows7 64bit.

It is very convenient , so I'm grateful to you.

but problem is generated, I wanted to edit the Gvim by _vimrc .
Some commands do not work.

when I command 'set tw=120' , it has no effect. Always textwidth is 78 in (*.txt), and 0 in (*.c)
editor is not compatible and nopaste , but I don't understand why this happening is happened

Would you tell me why it is happened?
and what should I do to change textwidth of gvim editor?


---

plus, when I refresh configuration, by this command

map <F5> :source c:\Program Files <x86>\Vim\_gvimrc<CR>

message like "Function MyDiff already exists~~" was shown.

There is no inconvenience in use, but it is just on my mind.

Magnus Woldrich

unread,
Sep 20, 2016, 3:19:58 AM9/20/16
to vim...@googlegroups.com
On Sep 20, 김재학 (김재학) wrote:
>when I command 'set tw=120' , it has no effect. Always textwidth is 78 in (*.txt), and 0 in (*.c)
>editor is not compatible and nopaste , but I don't understand why this happening is happened

tw is probably set somewhere else; check:

:verbose set tw?

>message like "Function MyDiff already exists~~" was shown.

:h :function yeilds:

When a function by this name already exists and [!] is not used
an error message is given. When [!] is used, an existing
function is silently replaced. Unless it is currently being
executed, that is an error.

so define your function as:

fu! MyDiff

김재학

unread,
Sep 20, 2016, 11:45:07 AM9/20/16
to vim_use, m...@japh.se
Thank you for your immediate responds, Magnus Woldrich!

I did that you said, but it doesn't work. ㅠㅠ

When I input command ":verbose set tw?" in _gvimrc, it works,
tw was set at 120 in only _gvimrc, but it didn't in other txt files.

when I open *.txt files and input command ":set tw=120" directly, it works.
but it is applied until the file is closed.

so when I edited _gvimrc file, input this line like "set tw=120" and saved
to apply these configurations when I open any .txt files. it works except the command "set tw=120"

I attached some pictures about my configuration.
1.PNG
2.PNG

Ben Fritz

unread,
Sep 20, 2016, 12:30:44 PM9/20/16
to vim_use, m...@japh.se
On Tuesday, September 20, 2016 at 10:45:07 AM UTC-5, 김재학 wrote:
> Thank you for your immediate responds, Magnus Woldrich!
>
> I did that you said, but it doesn't work. ㅠㅠ
>
> When I input command ":verbose set tw?" in _gvimrc, it works,
> tw was set at 120 in only _gvimrc, but it didn't in other txt files.

You misunderstood.

":verbose set tw?" was not intended as a command in your configuration to fix the problem. It is a debugging tool that you enter interactively to FIND the problem. That command will output the current value of the textwidth option, and also tell you which script set that value.

>
> when I open *.txt files and input command ":set tw=120" directly, it works.
> but it is applied until the file is closed.
>


Most likely, the value is getting set in some ftplugin or in a FileType autocmd for text and C files. You will need to edit that config file, or provide an override in an autocmd or after directory, or some similar solution.


>
> I attached some pictures about my configuration.

WHY?! Next time please just attach the textual config file itself, or copy-paste the text into your email.

김재학

unread,
Sep 20, 2016, 12:40:21 PM9/20/16
to vim_use, m...@japh.se
Thank you Ben Fritz

Oh I misunderstand.
":verbose set tw? " command told me that tw is 120 in _gimrc, but not others, it was fixed at 78 in .txt files.

your answer is right. when I edited the _gvimrc and added

"autocmd BufRead *.txt set tw=0"

it worked!

I couldn't find where the config file about Filetype autocmd is.. but it works well now.

Thank you

Reply all
Reply to author
Forward
0 new messages