Is "vim -C" supposed to override .vimrc?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is "vim -C" supposed to override .vimrc?

Ottavio Caruso
Hi,

this is a snippet or my vimrc:

$ cat .vim/vimrc
source $VIMRUNTIME/defaults.vim
set dir=~/.vim/tmp
set expandtab
set autoindent
iabbrev mydate <C-R>=strftime("%a %d/%m/%Y")
digraph bl 8226 " Insert Bullet with <CTRL>+k bl
map <f5> :1m$<cr>

which sources the default vim system file, which in turn sets
"nocompatible", as expected. So far. so good.

If I start vim with:
$ vim -C somefile

I expect this to turn some features off, for example visual mode with
mouse clicks, but it doesn't. If I manually set "compatible" from the
ex command line, it does turn visual mode off. I assume I could put
this is my vimrc, but I don't want to do this all the time. I could
probably make an alias to:

vim -c "set compatible" somefile

However I wonder if this is intended behaviour or not, that is, I
expected "vim -C" to override vimrc.

My settings:
$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 13 2019 20:46:00)
Included patches: 1-2200
Modified by [hidden email]
Compiled by oc@e130
Huge version without GUI.  Features included (+) or not (-):
+acl               -farsi             -mouse_sysmouse    -tag_any_white
+arabic            +file_in_path      +mouse_urxvt       -tcl
+autocmd           +find_in_path      +mouse_xterm       +termguicolors
+autochdir         +float             +multi_byte        +terminal
-autoservername    +folding           +multi_lang        +terminfo
-balloon_eval      -footer            -mzscheme          +termresponse
+balloon_eval_term +fork()            +netbeans_intg     +textobjects
-browse            +gettext           +num64             +textprop
-builtin_terms     -hangul_input      +packages          +timers
+byte_offset       +iconv             +path_extra        +title
+channel           +insert_expand     -perl              -toolbar
+cindent           +job               +persistent_undo   +user_commands
-clientserver      +jumplist          +postscript        +vartabs
-clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +virtualedit
+cmdline_hist      +langmap           -python            +visual
+cmdline_info      +libcall           -python3           +visualextra
+comments          +linebreak         +quickfix          +viminfo
+conceal           +lispindent        +reltime           +vreplace
+cryptv            +listcmds          +rightleft         +wildignore
+cscope            +localmap          -ruby              +wildmenu
+cursorbind        -lua               +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con        +mksession         +smartindent       -X11
+diff              +modify_fname      -sound             -xfontset
+digraphs          +mouse             +spell             -xim
-dnd               -mouseshape        +startuptime       -xpm
-ebcdic            +mouse_dec         +statusline        -xsmp
+emacs_tags        -mouse_gpm         -sun_workshop      -xterm_clipboard
+eval              -mouse_jsbterm     +syntax            -xterm_save
+ex_extra          +mouse_netterm     +tag_binary
+extra_search      +mouse_sgr         -tag_old_static
   system vimrc file: "/usr/pkg/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/pkg/share/vim"
Compilation: cc -c -I. -Iproto -DHAVE_CONFIG_H   -I/usr/include
-I/usr/pkg/include/ncurses  -O2 -I/usr/include
-I/usr/pkg/include/ncurses -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: cc   -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/local/lib
-Wl,--as-needed -o vim               -lm -lnsl  -lncurses -liconv -ldl



--
Ottavio Caruso

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAEJNuHy%2BFp%3DNSaduUSBJp8HHmnMj5qVaDX0s5xeFAQ9%3DpMEqXQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Is "vim -C" supposed to override .vimrc?

Gary Johnson-4
On 2020-02-13, 'Ottavio Caruso' via vim_use wrote:

> Hi,
>
> this is a snippet or my vimrc:
>
> $ cat .vim/vimrc
> source $VIMRUNTIME/defaults.vim
> set dir=~/.vim/tmp
> set expandtab
> set autoindent
> iabbrev mydate <C-R>=strftime("%a %d/%m/%Y")
> digraph bl 8226 " Insert Bullet with <CTRL>+k bl
> map <f5> :1m$<cr>
>
> which sources the default vim system file, which in turn sets
> "nocompatible", as expected. So far. so good.
>
> If I start vim with:
> $ vim -C somefile
>
> I expect this to turn some features off, for example visual mode with
> mouse clicks, but it doesn't. If I manually set "compatible" from the
> ex command line, it does turn visual mode off. I assume I could put
> this is my vimrc, but I don't want to do this all the time. I could
> probably make an alias to:
>
> vim -c "set compatible" somefile
>
> However I wonder if this is intended behaviour or not, that is, I
> expected "vim -C" to override vimrc.

From ":help -C":

    -C      Compatible mode.  Sets the 'compatible' option.  You can use
            this to get 'compatible', even though a .vimrc file exists.
            Keep in mind that the command ":set nocompatible" in some
            plugin or startup script overrules this, so you may end up
            with 'nocompatible' anyway.

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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200213170019.GB9366%40phoenix.
Reply | Threaded
Open this post in threaded view
|

Re: Is "vim -C" supposed to override .vimrc?

Ottavio Caruso
On Thu, 13 Feb 2020 at 17:00, Gary Johnson <[hidden email]> wrote:

>
> On 2020-02-13, 'Ottavio Caruso' via vim_use wrote:
> > Hi,
> >
> > this is a snippet or my vimrc:
> >
> > $ cat .vim/vimrc
> > source $VIMRUNTIME/defaults.vim
> > set dir=~/.vim/tmp
> > set expandtab
> > set autoindent
> > iabbrev mydate <C-R>=strftime("%a %d/%m/%Y")
> > digraph bl 8226 " Insert Bullet with <CTRL>+k bl
> > map <f5> :1m$<cr>
> >
> > which sources the default vim system file, which in turn sets
> > "nocompatible", as expected. So far. so good.
> >
> > If I start vim with:
> > $ vim -C somefile
> >
> > I expect this to turn some features off, for example visual mode with
> > mouse clicks, but it doesn't. If I manually set "compatible" from the
> > ex command line, it does turn visual mode off. I assume I could put
> > this is my vimrc, but I don't want to do this all the time. I could
> > probably make an alias to:
> >
> > vim -c "set compatible" somefile
> >
> > However I wonder if this is intended behaviour or not, that is, I
> > expected "vim -C" to override vimrc.
>
> From ":help -C":
>
>     -C      Compatible mode.  Sets the 'compatible' option.  You can use
>             this to get 'compatible', even though a .vimrc file exists.
>             Keep in mind that the command ":set nocompatible" in some
>             plugin or startup script overrules this, so you may end up
>             with 'nocompatible' anyway.

Thanks. I was looking at the wrong section of the help file.

(For posterity, setting "mouse=r" did what I meant to do).


--
Ottavio Caruso

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAEJNuHz1%2BhFhdh9UKqtL%3DPG6O7jd9Vh_zrvvvn5cLq7T-uzBHg%40mail.gmail.com.