Giter VIP home page Giter VIP logo

vim-makeshift's Introduction

Makeshift

Gitter

Plugin for detecting your build system.

Introduction

You'll want to use this plugin if you work on a lot of projects with different build systems. You want your editor to be able to detect your current build system and set 'makeprg' accordingly.

To make building really fast, map the :make command to a function key in your vimrc.

nnoremap <F5> :<C-U>make<CR>

Installation

I recommend installing pathogen.vim, and then simply copy and paste:

cd ~/.vim/bundle
git clone git://github.com/johnsyweb/vim-makeshift.git
vim -cHelptags

Once help tags have been generated, you can view the manual with

:help makeshift

How it works

This plug-in works by looking for known build files in the current working directory upwards, and sets 'makeprg'; by default this happens on start-up. You can use the command to re-evaluate 'makeprg':

:Makeshift

Sometimes your build script won't be in the current working directory, this is particularly common when 'autochdir' is set. For this reason :Makeshift sets b:makeshift_root to be the directory containing the build script that it used to determine the build system.

:MakeshiftBuild is a wrapper around Vim's own :make command, which changes directory to b:makeshift_root before calling :make with any arguments you provide and then returns to your working directory. If you often work in subdirectories, you may want to map the :MakeshiftBuild command to a function key in your vimrc:

nnoremap <F5> :<C-U>MakeshiftBuild<CR>
nnoremap <F6> :<C-U>MakeshiftBuild check<CR>
...

If you prefer to use the location list, there's also :LMakeshiftBuild, which is the same as :MakeshiftBuild but wraps :lmake instead.

Alternatively you can use the makeshift_chdir option to automatically change the current working directory to the one containing your build script.

==============================================================================

Settings

To tune the behaviour of this plugin, add any of the following switches to your vimrc:

let g:makeshift_on_startup = 0

To prevent Makeshift from setting 'makeprg' on BufRead:

let g:makeshift_on_bufread = 0

To prevent Makeshift from setting 'makeprg' on BufNewFile:

let g:makeshift_on_bufnewfile = 0

To prevent Makeshift from setting 'makeprg' on BufEnter:

let g:makeshift_on_bufenter = 0

To automatically change directory to 'b:makeshift_root' when it is discovered:

let g:makeshift_chdir = 1

To try the build file in the current directory before searching from the file directory:

let g:makeshift_use_pwd_first = 1

To enable search for bundled build program/script:

let g:makeshift_find_bundled = 1

Build Systems

Makeshift currently associates the following files with their build systems:

* Jamfile: bjam
* Makefile: make
* GNUmakefile: make
* Rakefile: rake
* SConstruct: scons
* build.gradle: gradle
* build.xml: ant
* mix.exs: mix
* pom.xml: mvn
* build.ninja: ninja
* wscript: waf

Adding a new build system

If Makeshift doesn't already know about your build system, or you wish to override the default program for a given file, you can define a dictionary, which has filenames as keys and corresponding programs as values.

let g:makeshift_systems = {
    \'build.sbt ': 'sbt',
    \}

Removing a build system

If you don't want Makeshift to set 'makeprg' for a given build system, you can disable it by defining a list of the files to ignore.

let g:makeshift_ignored = ['Jamfile']

License

Makeshift is licensed under the same terms as Vim itself (see :help license).

Thanks

If you find this plug-in useful, please follow this repository on GitHub and vote for it vim.org. If you have something to say, you can contact johnsyweb on Twitter and GitHub.

Many thanks

I'm grateful for contributions to what was a solo project (hooray for GitHub :octocat:)! If you'd like to thank the contributors, you can find their details here:

https://github.com/johnsyweb/vim-makeshift/graphs/contributors

vim-makeshift's People

Contributors

bwidawsk avatar falk-h avatar gitter-badger avatar haaspors avatar johnsyweb avatar justinnhli avatar simmel avatar

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.