Skip to content
Advertisement

Linux terminal( Vim ) cannot paste the whole code?

I have a problem for long time, when I use Linux terminal or putty pasting code, usually the code cannot be completely pasted, usually the beginning will lose. For example, I copy a piece of code using “ctrl+c” in a browser.

<servlet>
    <servlet-name>HelloWorld</servlet-name>
    <servlet-class>HelloWorld</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>HelloWorld</servlet-name>
    <url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>

Then I open the file in terminal using vim, right click then choose “paste”, the pasted code is only:

me>HelloWorld</servlet-name>
    <servlet-class>HelloWorld</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>HelloWorld</servlet-name>
    <url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>

Advertisement

Answer

When you start vim you are not in insertion mode so nothing is pasted. If one of characters you are pasting triggers the insertion mode the rest of the characters get pasted.

You can view the vi modes in: Vim modes

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement