Saving output of :map in vim

后端 未结 4 2014
陌清茗
陌清茗 2021-01-04 07:31

Q1: Is there a way of saving the output of the command

:map

to a file?

Q2: In a related question, I have the following map in my v

相关标签:
4条回答
  • 2021-01-04 07:40

    If your problem is that <F1> gets remapped, you can use :verbose map <F1> to see where it is defined, and change it accordingly.

    0 讨论(0)
  • 2021-01-04 07:44

    A1: To redirect/save the output of :map:

    :redir >> ~/mymaps.txt
    :map
    :redir END
    

    A2:

    As kemp says, you can find it using verbose and modify the plugin file.

    Or you can create a vim file in your plugins directory that runs last, e.g., ~/.vim/plugin/zzzmyremaps.vim (check by running scriptnames)

    Edit: rampion is correct in the comments. Because this is a filetype issue, this should be handled in the after directory ~/.vim/after/plugin/latex.vim as the offending latex.vim file is not being loaded on startup but on a buffer enter.

    Note .vimrc gets sourced first so plugins have a habit of overwriting them. :scriptnames will show the order.

    0 讨论(0)
  • 2021-01-04 07:55

    I don't know a way to save the individual :map, but :mksession filename will save a file with the current state of the editor in it, which will include all the map definitions.

    0 讨论(0)
  • 2021-01-04 08:03

    Maybe you can resource the .vimrc file again. Something like:

    map <f2> :source /path/to/.vimrc
    
    0 讨论(0)
提交回复
热议问题