Coder Social home page Coder Social logo

vim-follow-my-lead's Introduction

Follow My Lead

Vim plugin for showing all your <Leader> mappings in a readable table including the descriptions.

Installation

Copy plugin/follow-my-lead.vim to ~/.vim/plugin

Or add a GitHub repository entry if you are using a Plugin Manager such as Vundle:

Plugin 'ktonga/vim-follow-my-lead'

Features

  • List <Leader> mappings defined by the user and the plugins
  • By default only mappings defined in .vimrc are listed. It honours $MYVIMRC variable
  • Mappings from all scripts sourced by Vim can be listed if specified by configuration (see Options)
  • If the line previous to the mapping is a comment it will be used as the description
  • If no comment is available the rhs of the mapping is used as description
  • Mappings are shown in a table, grouped by source, with the following columns
    • Mode: which mode the mapping applies to
    • LHS: left hand side of the mapping (without <Leader>)
    • Description: The mapping comment if present. The rhs otherwise

Screenshots

FML screenshot

Shortcuts

  • <Leader>fml: Default mapping for triggering the plugin. It shows the mapping in a new window
  • q: Closes the mappings window

Options

  • g:fml_all_sources: if 1 all sources are used, if 0 just $MYVIMRC is used. Default 0
  • More options coming soon

License

Copyright (C) 2015 Gaston Tonietti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

vim-follow-my-lead's People

Contributors

ktonga avatar lilydjwg avatar nicoder avatar yuan- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vim-follow-my-lead's Issues

Repeated fml's create excess panes

If you do <leader>fml multiple times in a row, you can multiple fml panes. Unless I'm missing something, I can't think of any reason someone would want/need multiple panes. Maybe it's worth looking into making a second fml just refresh the old pane (or close it an open a new one, either way).

This might not be a trivial change, and it only fixes a minor annoyance, so it's more of a "if this happens to be convenient it'd be nice" than a bug/issue.

(Sidenote: sorry for all the issues I'm posting, I do really enjoy this plugin though)

Only one comment per <leader> key sequence

I sometimes define the same shortcuts for different Vim modes.

For example, I have a shortcut defined in normal mode to trim trailing spaces from the current buffer and the exact same shortcut defined in visual mode to do the same operation but on the visual selection only.

FML overwrites the comment that appears next to the normal mode mapping with the one that is subsequently defined for the same mapping for visual mode.

This results in the same comment appearing next to both the normal and visual mode mappings in the displayed list of FML leader mappings.

imap mapping not displayed

Hi

This legal mapping in my .vimrc is not detected or displayed by the plugin:

imap <leader>v <esc>:VoomToggle<CR>

However, this one is detected and displayed:

nnoremap <leader>v :VoomToggle<CR>

Am I doing something wrong?

Cheers

Ian

FML not working under GVim for Windows

I use GVim on both Windows and Linux. FML works fine on Linux but not on Windows. Currently I'm using the pre-compiled 64-Bit Windows GVim available from kaoriya.net (version 7.843).

running fml on GVim for Windows gives the following errors:

Error detected while processing function FMLShow..FMLGetLeaderMappingsBySource:
line 22:
E121: Undefined variable: s:vimrc_glob
E116: Invalid arguments for function remove(with_desc, s:vimrc_glob)
E15: Invalid expression: remove(with_desc, s:vimrc_glob)
line 23:
E121: Undefined variable: s:vimrc_glob
E15: Invalid expression: [{ 'source': s:vimrc_glob, 'mappings': vimrc_val }]
line 24:
E121: Undefined variable: vimrc_first
line 25:
E121: Undefined variable: vimrc_first
E15: Invalid expression: vimrc_first
Error detected while processing function FMLShow:
line 1:
E712: Argument of map() must be a list or Dictionary
E714: List required

Description not detected if leader hardcoded

I had this old mapping in my vimrc (my leader is comma):

" Clear current search highlighting
nnoremap <silent> ,/ :nohlsearch<CR>

While this was detected by fml, it's description was not. So the description text ended up being :nohlsearch<CR> instead of the comment above it.

Invoking fml twice in succession doesn't work

Tested on latest Vim v7.4.898 running on Ubuntu Linux 15.04

Open Vim
Run fml
Expected behaviour occurs (new split opens showing leader mappings and entering q closes the split)
Immediately on closing the fml split, run fml again
This time the leader mappings appear directly in the current buffer and q does not close

Manually closing buffer causes issues

Steps to reproduce:

  • Open FML
  • Close with :bd
  • Open FML a second time

This time FML doesn't open in a new window and in fact the text replaces what's in the current buffer which can cause data loss.

Remove default mapping (or make it optional)

I would love to see the default <Leader>fml mapping removed and instead simply allowing the user to choose their own mapping. A side effect would be that the FML mapping shows up in FML buffer -- I personally see that as a benefit.

If you want to keep the default, I think there should at least be an option to disable it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.