Tuesday, May 6, 2014

Re: Odd behaviour with :q!

if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=ucs-bom,utf-8,latin1
endif

set nocompatible " Use Vim defaults (much better!)
set bs=indent,eol,start " allow backspacing over everything in insert mode
"set ai " always set autoindenting on
"set backup " keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time

" Only do this part when compiled with support for autocommands
if has("autocmd")
augroup redhat
autocmd!
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
" don't write swapfile on most commonly used directories for NFS mounts or USB sticks
autocmd BufNewFile,BufReadPre /media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp
" start with spec file template
autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec
augroup END
endif

if has("cscope") && filereadable("/usr/bin/cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif

filetype plugin on

if &term=="xterm"
set t_Co=8
set t_Sb=dm
set t_Sf=dm
endif

" Don't wake up system with blinking cursor:
" http://www.linuxpowertop.org/known.php
let &guicursor = &guicursor . ",a:blinkon0"
#! /bin/ksh
integer i
for ((i=0; i < 100; ++i )); do
echo "try#${i}"
vim -u nicholls.vimrc -c "q!"
done
Graham Nicholls wrote:
> On Tuesday, 6 May 2014 12:18:39 UTC+1, Graham Nicholls wrote:
>> On a RHEL 6.2 server, I get odd behaviour with vim 7.2.411; randomly at a frequency of about 1 in 5, entering :q! (when in command mode) puts me into insert mode after adding an M and a blank line.
>>
>> A subsequent :q! usually works, but sometimes does the same.
>>
>> I'm using konsole under KDE if that's of interest.
> Seems like it's nocompatible which is doing it - by a process of elimination - I started at the bottom, eliminating lines/functions till it worked.
>
> All very odd, but thanks for your help.
>
I'm not sure that you've correctly identified the problem. I've
attached two files:

nicholls : a shell script that runs vim a hundred times, using
nicholls.vimrc (which I copied from your earlier email) and which
immediately tells vim to quit. I also ran it after having changed vim
to gvim, by the way.

Result: a bit of blinking as (g)vim popped in and out, but otherwise it
ran as expected. If a vim had refused to quit, a (g)vim window would
have remained open. I did this on a scientific linux 6.4 (Carbon)
system with a huge vim 7.4.272.

Suggestion: try running vim with -V and, when it refuses to quit and
goes insert instead, maybe you can see what happened. I don't much like
having distributed .vimrc files, as that frequently causes problems, but
I don't see anything in that .virc that should cause that quitting
issue. Dropping the "set nocompatible" is like preventing yourself from
having a car accident by removing the car's battery. It may work but
one does miss out on a lot.

What happens when you run the attached script?

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.

No comments: