sponsor Vim development Vim logo Vim Book Ad

make_target.vim : Make target for Makefile recipe under cursor

 script karma  Rating 1/1, Downloaded by 1  Comments, bugs, improvements  Vim wiki

created by
Tom Ryder
 
script type
ftplugin
 
description
This filetype plugin for Makefiles ("make" filetype) provides an autoload function make#target#Make() and buffer-local mapping <Plug>MakeTarget to make! the target for the recipe under the cursor, if it can be identified.
 
install details
Put autoload/make/target.vim in ~/.vim/autoload/make/target.vim. The ftplugin itself should probably be saved as ~/.vim/after/ftplugin/make/target.vim (per the distribution layout) or ~/.vim/after/ftplugin/make_target.vim (if you prefer), so that it definitely loads *after* the primary make.vim plugin; or, just use your favourite Vim plugin manager.

There is no default key binding; you could do this in your .vimrc to bind _m, for example:

    autocmd FileType make
          \ nmap <buffer> _m <Plug>MakeTarget

A cleaner and more complete implementation that correctly clears the group on reload and the mapping on filetype switch might be:

    let g:maplocalleader = '_'
    augroup vimrc_filemap
      autocmd!
      autocmd FileType *
            \ silent! nmapclear <buffer> <LocalLeader>m
      autocmd FileType make
            \ nmap <buffer> <LocalLeader>m <Plug>MakeTarget
    augroup END
 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-make-target-0.2.0.tar.gz 0.2.0 2018-06-28 7.0 Tom Ryder Change directory for :make, escape target if possible
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo