Using set paste disables imap jk Why does 'set' syntax not work for syntax highlighting in vim?VIM commenting...

what can you do with Format View

What percentage of campground outlets are GFCI or RCD protected?

How do I know when and if a character requires a backstory?

Movie with a girl/fairy who was talking to a unicorn in a snow covered forest

Getting an entry level IT position later in life

Why should I "believe in" weak solutions to PDEs?

Why does capacitance not depend on the material of the plates?

How do I show and not tell a backstory?

What is it exactly about flying a Flyboard across the English channel that made Zapata's thighs burn?

Does the length of a password for Wi-Fi affect speed?

Is space radiation a risk for space film photography, and how is this prevented?

Is the first page of a novel really that important?

How to win against ants

How to check a file was encrypted (really & correctly)

Can I enter a rental property without giving notice if I'm afraid a tenant may be hurt?

Is it okay to use different fingers every time while playing a song on keyboard? Is it considered a bad practice?

Why do dragons like shiny stuff?

How easy is it to get a gun illegally in the United States?

Generate random number in Unity without class ambiguity

What does "autolyco-sentimental" mean?

Is there a booking app or site that lets you specify your gender for shared dormitories?

If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?

Is it uncompelling to continue the story with lower stakes?

Square root of the square of the cosine: absolute value or not



Using set paste disables imap jk


Why does 'set' syntax not work for syntax highlighting in vim?VIM commenting out what I pasteWhy is this copy/paste in vim configuration not working properly?How can I set check interval for set autoread option in VIMRemap Up and Down arrows to gj-gk in vim input mode without using <c-o>?Vim: set “cursor keys” hjkl to wasdHow to send the ESC signal to vim when my esc key doesn't work?Using middle mouse click to paste text enters insert mode:set nohlsearch doesn't workVim statusline shows ^[[2;2R^[[>41;330;0c^[]10;rgb:e5e5/e5e5/e5e5^G^[]11;rgb:0000/0000/0000^G after mapping Capslock to Esc






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I use the following line in ~/.vimrc to allow me to press jk instead of Esc.



:imap jk <Esc>


It works fine until I add a :set paste:



" Pressing jk is same as pressing Esc
:imap jk <Esc>

" Enable paste from system clipboard
" Bug? This disables imap jk <Esc>
set paste


Can anyone tell me why this happens? It happens on at least these systems:



Host: Amazon Linux AMI
Vim version: 7.4



Host: MacOS 10.14.5
Vim version 8.0.1283










share|improve this question

























  • You might want to check out the Vi and Vim Stack Exchange for questions on Vim!

    – filbranden
    3 hours ago


















1















I use the following line in ~/.vimrc to allow me to press jk instead of Esc.



:imap jk <Esc>


It works fine until I add a :set paste:



" Pressing jk is same as pressing Esc
:imap jk <Esc>

" Enable paste from system clipboard
" Bug? This disables imap jk <Esc>
set paste


Can anyone tell me why this happens? It happens on at least these systems:



Host: Amazon Linux AMI
Vim version: 7.4



Host: MacOS 10.14.5
Vim version 8.0.1283










share|improve this question

























  • You might want to check out the Vi and Vim Stack Exchange for questions on Vim!

    – filbranden
    3 hours ago














1












1








1








I use the following line in ~/.vimrc to allow me to press jk instead of Esc.



:imap jk <Esc>


It works fine until I add a :set paste:



" Pressing jk is same as pressing Esc
:imap jk <Esc>

" Enable paste from system clipboard
" Bug? This disables imap jk <Esc>
set paste


Can anyone tell me why this happens? It happens on at least these systems:



Host: Amazon Linux AMI
Vim version: 7.4



Host: MacOS 10.14.5
Vim version 8.0.1283










share|improve this question














I use the following line in ~/.vimrc to allow me to press jk instead of Esc.



:imap jk <Esc>


It works fine until I add a :set paste:



" Pressing jk is same as pressing Esc
:imap jk <Esc>

" Enable paste from system clipboard
" Bug? This disables imap jk <Esc>
set paste


Can anyone tell me why this happens? It happens on at least these systems:



Host: Amazon Linux AMI
Vim version: 7.4



Host: MacOS 10.14.5
Vim version 8.0.1283







vim vimrc






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 4 hours ago









tomcamtomcam

1164 bronze badges




1164 bronze badges
















  • You might want to check out the Vi and Vim Stack Exchange for questions on Vim!

    – filbranden
    3 hours ago



















  • You might want to check out the Vi and Vim Stack Exchange for questions on Vim!

    – filbranden
    3 hours ago

















You might want to check out the Vi and Vim Stack Exchange for questions on Vim!

– filbranden
3 hours ago





You might want to check out the Vi and Vim Stack Exchange for questions on Vim!

– filbranden
3 hours ago










1 Answer
1






active

oldest

votes


















0














This is expected.



The point of 'paste' is to "avoid unexpected affects" when pasting text and insert-mode mappings are first in the list of features disabled by it.



From :help 'paste':




When the 'paste' option is switched on (also when it was already on):




  • mapping in Insert mode and Command-line mode is disabled

  • abbreviations are disabled

  • [...]




It also disables other options that cause Vim to modify pasted text, such as options related to indentation and text wrapping.



The only exception of keystroke that is special in paste mode (other than ESC, to leave insert mode) is a keystroke set by 'pastetoggle', if one is set. That keystroke will disable paste mode (when enabled), so you can go back to normal insert mode.



Also note that 'paste' mode is not really supposed to be left on, in most cases. Since you're disabling a lot of Vim features when you enable it, you typically only want it one for the duration of a paste and disable it right afterwards.





If you're willing to look at a plug-in recommendation that has useful keybindings for paste mode, I can suggest tpope's vim-unimpaired, which exposes these three mappings (from normal mode):





  • [op: Paste before the current line


  • ]op: Paste after the current line


  • yop: Paste replacing the current line


In all cases, Vim will be put into Insert-mode with 'paste' on, and 'paste' will be turned off as soon as you leave Insert-mode with an ESC. The idea is that pasting is the only thing you'll do with that option turned on, so the sequence of one of those keystrokes, followed by the actual pasted contents, followed by an ESC will become a coherent operation.



See :help pasting for that plug-in for more details.






share|improve this answer




























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f534060%2fusing-set-paste-disables-imap-jk-esc%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    This is expected.



    The point of 'paste' is to "avoid unexpected affects" when pasting text and insert-mode mappings are first in the list of features disabled by it.



    From :help 'paste':




    When the 'paste' option is switched on (also when it was already on):




    • mapping in Insert mode and Command-line mode is disabled

    • abbreviations are disabled

    • [...]




    It also disables other options that cause Vim to modify pasted text, such as options related to indentation and text wrapping.



    The only exception of keystroke that is special in paste mode (other than ESC, to leave insert mode) is a keystroke set by 'pastetoggle', if one is set. That keystroke will disable paste mode (when enabled), so you can go back to normal insert mode.



    Also note that 'paste' mode is not really supposed to be left on, in most cases. Since you're disabling a lot of Vim features when you enable it, you typically only want it one for the duration of a paste and disable it right afterwards.





    If you're willing to look at a plug-in recommendation that has useful keybindings for paste mode, I can suggest tpope's vim-unimpaired, which exposes these three mappings (from normal mode):





    • [op: Paste before the current line


    • ]op: Paste after the current line


    • yop: Paste replacing the current line


    In all cases, Vim will be put into Insert-mode with 'paste' on, and 'paste' will be turned off as soon as you leave Insert-mode with an ESC. The idea is that pasting is the only thing you'll do with that option turned on, so the sequence of one of those keystrokes, followed by the actual pasted contents, followed by an ESC will become a coherent operation.



    See :help pasting for that plug-in for more details.






    share|improve this answer






























      0














      This is expected.



      The point of 'paste' is to "avoid unexpected affects" when pasting text and insert-mode mappings are first in the list of features disabled by it.



      From :help 'paste':




      When the 'paste' option is switched on (also when it was already on):




      • mapping in Insert mode and Command-line mode is disabled

      • abbreviations are disabled

      • [...]




      It also disables other options that cause Vim to modify pasted text, such as options related to indentation and text wrapping.



      The only exception of keystroke that is special in paste mode (other than ESC, to leave insert mode) is a keystroke set by 'pastetoggle', if one is set. That keystroke will disable paste mode (when enabled), so you can go back to normal insert mode.



      Also note that 'paste' mode is not really supposed to be left on, in most cases. Since you're disabling a lot of Vim features when you enable it, you typically only want it one for the duration of a paste and disable it right afterwards.





      If you're willing to look at a plug-in recommendation that has useful keybindings for paste mode, I can suggest tpope's vim-unimpaired, which exposes these three mappings (from normal mode):





      • [op: Paste before the current line


      • ]op: Paste after the current line


      • yop: Paste replacing the current line


      In all cases, Vim will be put into Insert-mode with 'paste' on, and 'paste' will be turned off as soon as you leave Insert-mode with an ESC. The idea is that pasting is the only thing you'll do with that option turned on, so the sequence of one of those keystrokes, followed by the actual pasted contents, followed by an ESC will become a coherent operation.



      See :help pasting for that plug-in for more details.






      share|improve this answer




























        0












        0








        0







        This is expected.



        The point of 'paste' is to "avoid unexpected affects" when pasting text and insert-mode mappings are first in the list of features disabled by it.



        From :help 'paste':




        When the 'paste' option is switched on (also when it was already on):




        • mapping in Insert mode and Command-line mode is disabled

        • abbreviations are disabled

        • [...]




        It also disables other options that cause Vim to modify pasted text, such as options related to indentation and text wrapping.



        The only exception of keystroke that is special in paste mode (other than ESC, to leave insert mode) is a keystroke set by 'pastetoggle', if one is set. That keystroke will disable paste mode (when enabled), so you can go back to normal insert mode.



        Also note that 'paste' mode is not really supposed to be left on, in most cases. Since you're disabling a lot of Vim features when you enable it, you typically only want it one for the duration of a paste and disable it right afterwards.





        If you're willing to look at a plug-in recommendation that has useful keybindings for paste mode, I can suggest tpope's vim-unimpaired, which exposes these three mappings (from normal mode):





        • [op: Paste before the current line


        • ]op: Paste after the current line


        • yop: Paste replacing the current line


        In all cases, Vim will be put into Insert-mode with 'paste' on, and 'paste' will be turned off as soon as you leave Insert-mode with an ESC. The idea is that pasting is the only thing you'll do with that option turned on, so the sequence of one of those keystrokes, followed by the actual pasted contents, followed by an ESC will become a coherent operation.



        See :help pasting for that plug-in for more details.






        share|improve this answer













        This is expected.



        The point of 'paste' is to "avoid unexpected affects" when pasting text and insert-mode mappings are first in the list of features disabled by it.



        From :help 'paste':




        When the 'paste' option is switched on (also when it was already on):




        • mapping in Insert mode and Command-line mode is disabled

        • abbreviations are disabled

        • [...]




        It also disables other options that cause Vim to modify pasted text, such as options related to indentation and text wrapping.



        The only exception of keystroke that is special in paste mode (other than ESC, to leave insert mode) is a keystroke set by 'pastetoggle', if one is set. That keystroke will disable paste mode (when enabled), so you can go back to normal insert mode.



        Also note that 'paste' mode is not really supposed to be left on, in most cases. Since you're disabling a lot of Vim features when you enable it, you typically only want it one for the duration of a paste and disable it right afterwards.





        If you're willing to look at a plug-in recommendation that has useful keybindings for paste mode, I can suggest tpope's vim-unimpaired, which exposes these three mappings (from normal mode):





        • [op: Paste before the current line


        • ]op: Paste after the current line


        • yop: Paste replacing the current line


        In all cases, Vim will be put into Insert-mode with 'paste' on, and 'paste' will be turned off as soon as you leave Insert-mode with an ESC. The idea is that pasting is the only thing you'll do with that option turned on, so the sequence of one of those keystrokes, followed by the actual pasted contents, followed by an ESC will become a coherent operation.



        See :help pasting for that plug-in for more details.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 3 hours ago









        filbrandenfilbranden

        13.1k2 gold badges26 silver badges55 bronze badges




        13.1k2 gold badges26 silver badges55 bronze badges

































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f534060%2fusing-set-paste-disables-imap-jk-esc%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...