From 9c9342b080482d552c643cad4b68a79b6869ae24 Mon Sep 17 00:00:00 2001 From: ThePrimeagen Date: Tue, 23 Feb 2021 08:45:33 -0700 Subject: [PATCH] feat(an-idea) --- README.md | 60 +------------------------------------------- lua/harpoon/init.lua | 19 +++++++++----- lua/harpoon/ui.lua | 12 ++++++++- 3 files changed, 25 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index d209739..a6419bd 100644 --- a/README.md +++ b/README.md @@ -23,64 +23,6 @@ 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()`. 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. +-- TODO -- Sorry (still being dev'd on) -### 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](https://github.com/VimDeathmatch/server) we have a local -config for running commands. Here is an example. - -``` -nnoremap ce :call SendTerminalCommand(0, "cd ~/personal/VimDeathmatch/server/server && npm run test" . expand("%") . "\n") -``` - -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 -`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 tu :call GotoBuffer(0) -nmap te :call GotoBuffer(1) -nmap to :call GotoBuffer(2) -nmap ta :call GotoBuffer(3) -``` - -Same concept as before. `t` is my entrence into the terminal world and aoeu is -my homerow. All power positions. - diff --git a/lua/harpoon/init.lua b/lua/harpoon/init.lua index 0d2d388..bcd0efe 100644 --- a/lua/harpoon/init.lua +++ b/lua/harpoon/init.lua @@ -12,18 +12,23 @@ local M = {} projects = { ["/path/to/director"] = { term = { - cmds = { - } + cmds = { }, ... is there antyhnig that could be options? }, mark = { - marks = { - } + marks = {}, ... is there antyhnig that could be options? } } }, - ... high level settings + + term = { + layout = "float" | "split" | "vsplit" | "replace" (default) + }, + + mark = { + layout = "float" | "split" | "vsplit" | "replace" (default) + }, } --]] harpoon_config = harpoon_config or {} @@ -121,7 +126,9 @@ M.setup = function(config) local complete_config = merge_tables( - {projects = {}}, + { + projects = {}, + }, expand_dir(c_config), expand_dir(u_config), expand_dir(config)) diff --git a/lua/harpoon/ui.lua b/lua/harpoon/ui.lua index f1647bc..071f1d4 100644 --- a/lua/harpoon/ui.lua +++ b/lua/harpoon/ui.lua @@ -10,7 +10,17 @@ local M = {} win_id = nil bufh = nil -function create_window() +--[[ +return { + bufnr = bufnr, + win_id = win_id, + + // optional if plenary is used + border_bufnr = border.bufnr, + border_win_id = border.win_id, + } +--]] +function create_window(config) local win_info = float.percentage_range_window( factorw, factorh,