Giter Club home page Giter Club logo

harpoon's Introduction

WARNING

This is still beta. We are getting there, but its not as fast as I would like. Therefore APIs are subject to change.

harpoon

The goal of Harpoon is to get you where you want with the fewest keystrokes.

The Problem

You work on code. The code base is medium, large, tiny, whatever. You find yourself frequenting a small set of files (maybe it depends on task) and you are tired of using a fuzzy finder, :bnext/prev, alternate file doesn't quite cut it, etc etc.

The Solution

The ability to specify, or on the fly, mark and create persisting key strokes to go to the files you want. This includes terminal navigation.

Installation

Simply install via your favorite plugin manager.

Plug 'ThePrimeagen/harpoon'

Harpooning

The Basics

Harpoon provides up to 4 slots for terminals. Now you don't want to overload terminals with everything. I just tend to think about this as project specific tasks. Such as, yarn lint, yarn test, or some command based off of current file.

Personally I only use 1 terminal. I have no use for multiple terminals, but it does provide the hooks for that.

Navigation

To start navigating with Harpoon you simply :call GotoBuffer(<bufnu>). This will create / navigate to the terminal in current buffer.

bufnu: can be a number from 0 - 3. As stated above, there are up to 4 slots.

Sending Commands

Where Harpoon shines is in local configs.

To setup a local config (per project) you must have a .nvimrc in the root of your project (where you open up vim) and you must have the following sets in your root vimrc.

set exrc
set secure "optional, but it prevents harmful scripts from editing
           "I don't have this option on

Local Configuration example

For VimDeathmatch we have a local config for running commands. Here is an example.

nnoremap <leader>ce :call SendTerminalCommand(0, "cd ~/personal/VimDeathmatch/server/server && npm run test" . expand("%") . "\n")<CR>
  1. I have c as the start into my local commands.
  2. e = middle finger, home row on Dvorak. Power finger.
  3. Setup your own commands

That means when I am in Deathmatch and I want to test my current file I press <leader>ce and it will open a terminal if there isn't one opened and execute the commands. I could of made that command a lot better, I was just in a hurry :) Forgive me.

General Navigation examples

Personally I have the following remaps in my root rc.

nmap <leader>tu :call GotoBuffer(0)<CR>
nmap <leader>te :call GotoBuffer(1)<CR>
nmap <leader>to :call GotoBuffer(2)<CR>
nmap <leader>ta :call GotoBuffer(3)<CR>

Same concept as before. t is my entrence into the terminal world and aoeu is my homerow. All power positions.

harpoon's People

Contributors

theprimeagen avatar asbjornhaland avatar dink4n avatar anott03 avatar polarmutex avatar rudotriton avatar stuartmackey 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.