I'm using Vim on Ubuntu 14.04 LTS. I've been confused by these two situations and I think they might have common cause:

When I open a text file in vim and paste some content that I copied from web browser using right click then paste, the pasted content cannot be recognized by the program that's supposed to process the text file anymore. Supposedly the program reads the entry from the text file and make this entries available to other programs:

ornAna1 Platypus Mar. 2007 (WUGSC 5.0.1/ornAna1) (ornAna1)
galGal2 Chicken Feb. 2004 (WUGSC 1.0/galGal2) (galGal2)
galGal3 Chicken May 2006 (WUGSC 2.1/galGal3) (galGal3)

If I deleted the line starting with galGal2 manually and typed in new content so that it becomes the following, it can be recognized by the program correctly.

ornAna1 Platypus Mar. 2007 (WUGSC 5.0.1/ornAna1) (ornAna1)
galGal4 Chicken Nov. 2011 (ICGSC Gallus_gallus-4.0/galGal4) (galGal4)
galGal3 Chicken May 2006 (WUGSC 2.1/galGal3) (galGal3)

If I paste the galGal4 line from web browser, then that line is skipped by the program.

Then in a shell script, a similar situation happened. I have a code block that looks like this:

python2 -c "import pip" > /dev/null 2>&1 
if [[ $? -eq 0 ]]; then
    echo "pip is installed"
elif [[ $? -eq 1 ]]; then
    echo "pip is not installed"

If I type the whole thing in, then this part of the script works fine. If I copy this from an indented block within the shell script, by highlighting the texts and right click copy, then right click paste, then somehow this part doesn't seem to be executed at all.

What could be the cause of these problems?

Update : While I'm certain that the problem with shell script (copying from indented text and pasting in the same file somewhere else) happened once, I wasn't able to reproduce it. There's a chance that it's a temporary glitch.

  • 1
    What do you mean "cannot be recognized by the program that's supposed to process the text file" and "this part doesn't seem to be executed"? Recognized how, executed how?
    – nobe4
    Apr 29, 2016 at 6:34
  • No, I don't get any errors. The program does not complain, bash doesn't complain either. Those contents are simply ignored. I try to use :set list to check if there's any special character but I couldn't see any difference. Apr 29, 2016 at 6:43
  • For what it's worth, try pasting after setting :set paste, I had issues with pasting in the past that I solved with this.
    – nobe4
    Apr 29, 2016 at 6:49
  • 1
    If you try with some vimscript, i.e. echomsg 'a' and for running :so % (considering your script is in the current file) ? (with manual typing and copy/pasting)
    – nobe4
    Apr 29, 2016 at 7:44
  • 3
    Interesting ... Can you paste it, save the file and the do a xxd on the file, to see if there are differences ?
    – nobe4
    Apr 29, 2016 at 8:05

1 Answer 1


After a thorough discussion with OP and alexander-batischev, the issue was massively related to the way google doc handle quotation marks.

It has two mode, basic and smart quotes.

‘smart quote’ 
'basic quote'

After investigating the pasting with xdd, we saw the pasting was done using the smart quotes instead of the basic ones (first line is basic, second is smart quotes):

$ xxd
0000000: 2761 270a e280 9861 e280 990a            'a'....a....

Here is a post explaining how to change this config: how-do-i-change-google-docs-default-quotation-symbols

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.