Code Monkey home page Code Monkey logo

focus.vim's Introduction

Focus.vim

Focus mode is a state where you are focusing on one thing and one thing only. This is what this plugin does for you.

No matter the initial layout of your Vim session, once you activate focus mode all buffers except for the current one will be closed. Also, the only remaining buffer will be centered in your Vim window so you can have it in the center of your viewing area. When you exit focus mode all your previously opened buffers will be restored for you along with their corresponding windows.

Requirements

No requirements (except Vim of course). This is a stand-alone plugin with no outside dependencies.

Installation

  1. Vundle Add the following line to your .vimrc:

     Bundle "merlinrebrovic/focus.vim"
    

    After this just source your .vimrc and run :BundleInstall inside Vim.

  2. Pathogen Copy or clone this repository to .vim/bundle folder (vimfiles\bundle on Windows).

  3. Manually
    Copy focus.vim script to .vim/plugin folder (vimfiles\plugin on Windows).

Configuration

By default the plugin maps the <leader>fmt combination for toggling the focus mode. You can set your own combination by adding the following lines in your .vimrc:

let g:focus_use_default_mapping = 0
nmap key_combination <Plug>FocusModeToggle

Be sure to use nmap instead of noremap as we are counting on the result being remapped here. This is to prevent the plugin leaking stuff into the global namespace as much as possible.

You can set the desired width of the focused buffer while in focus mode. There are several ways to do this in order of priority:

  1. If the textwidth Vim option is set, it will be used.

  2. If it's not set, you can set g:focusmode_width variable at any time before entering the focus mode and Focus.vim will use that. If used regularly, put it in your .vimrc file. For example:

     let g:focusmode_width = 72
    
  3. If the previous values were not set, the default value (80) is used.

License

Copyright (c) Merlin Rebrović. Distributed under the MIT license.

Created by Merlin Rebrović and Zoran Meliš

Contributors:

focus.vim's People

Contributors

merlinrebrovic avatar landofz avatar joshtch avatar ict avatar

Watchers

 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.