Skip to content

Commit

Permalink
Add an option to force botright for the log window
Browse files Browse the repository at this point in the history
  • Loading branch information
Olical committed May 23, 2020
1 parent 5cf04b3 commit cc3ccf8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 18 deletions.
5 changes: 5 additions & 0 deletions doc/conjure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ the `g:conjure_config` variable instead, as mention later in this section.
Should the HUD be displayed at all.
Default: `true`

`log.botright?`
Force the log to always open at the bottom or far right of the
editor, taking up the full width or height respectively.
Default: `false`

`log.break-length`
Length of the break comment (`; ---------...`) between log results
in characters. Used in trimming to avoid cutting forms in half.
Expand Down
1 change: 1 addition & 0 deletions fnl/conjure/config.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
{:hud {:width 0.42
:height 0.3
:enabled? true}
:botright? false
:break-length 80
:trim {:at 10000
:to 6000}})
Expand Down
23 changes: 13 additions & 10 deletions fnl/conjure/log.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,26 @@

(trim buf))))

(defn- create-win [split-fn]
(let [buf (upsert-buf)
win (split-fn (log-buf-name))]
(nvim.win_set_cursor
win
[(nvim.buf_line_count buf) 0])
(nvim.win_set_option win :wrap false)
(defn- create-win [cmd]
(let [buf (upsert-buf)]
(nvim.command
(.. (if (a.get-in config [:log :botright?])
"botright "
"")
cmd " "
(log-buf-name)))
(nvim.win_set_cursor 0 [(nvim.buf_line_count buf) 0])
(nvim.win_set_option 0 :wrap false)
(buffer.unlist buf)))

(defn split []
(create-win nvim.ex.split))
(create-win :split))

(defn vsplit []
(create-win nvim.ex.vsplit))
(create-win :vsplit))

(defn tab []
(create-win nvim.ex.tabnew))
(create-win :tabnew))

(defn close-visible []
(let [buf (upsert-buf)]
Expand Down
2 changes: 1 addition & 1 deletion lua/conjure/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ local log = nil
do
local v_23_0_ = nil
do
local v_23_0_0 = {["break-length"] = 80, hud = {["enabled?"] = true, height = 0.29999999999999999, width = 0.41999999999999998}, trim = {at = 10000, to = 6000}}
local v_23_0_0 = {["botright?"] = false, ["break-length"] = 80, hud = {["enabled?"] = true, height = 0.29999999999999999, width = 0.41999999999999998}, trim = {at = 10000, to = 6000}}
_0_0["log"] = v_23_0_0
v_23_0_ = v_23_0_0
end
Expand Down
21 changes: 14 additions & 7 deletions lua/conjure/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,18 @@ end
local create_win = nil
do
local v_23_0_ = nil
local function create_win0(split_fn)
local function create_win0(cmd)
local buf = upsert_buf()
local win = split_fn(log_buf_name())
nvim.win_set_cursor(win, {nvim.buf_line_count(buf), 0})
nvim.win_set_option(win, "wrap", false)
local function _3_()
if a["get-in"](config, {"log", "botright?"}) then
return "botright "
else
return ""
end
end
nvim.command((_3_() .. cmd .. " " .. log_buf_name()))
nvim.win_set_cursor(0, {nvim.buf_line_count(buf), 0})
nvim.win_set_option(0, "wrap", false)
return buffer.unlist(buf)
end
v_23_0_ = create_win0
Expand All @@ -296,7 +303,7 @@ do
do
local v_23_0_0 = nil
local function split0()
return create_win(nvim.ex.split)
return create_win("split")
end
v_23_0_0 = split0
_0_0["split"] = v_23_0_0
Expand All @@ -311,7 +318,7 @@ do
do
local v_23_0_0 = nil
local function vsplit0()
return create_win(nvim.ex.vsplit)
return create_win("vsplit")
end
v_23_0_0 = vsplit0
_0_0["vsplit"] = v_23_0_0
Expand All @@ -326,7 +333,7 @@ do
do
local v_23_0_0 = nil
local function tab0()
return create_win(nvim.ex.tabnew)
return create_win("tabnew")
end
v_23_0_0 = tab0
_0_0["tab"] = v_23_0_0
Expand Down

0 comments on commit cc3ccf8

Please sign in to comment.