From 3f99154ead37df22caebdf49701b063e1a6e4687 Mon Sep 17 00:00:00 2001 From: Federico Mengozzi <19249682+fedemengo@users.noreply.github.com> Date: Tue, 3 Oct 2023 23:44:42 +0200 Subject: [PATCH] focus on splits --- fnl/mapping.fnl | 11 +++++++++++ fnl/mods/ui/focus.fnl | 3 +++ fnl/plugins.fnl | 1 + 3 files changed, 15 insertions(+) create mode 100644 fnl/mods/ui/focus.fnl diff --git a/fnl/mapping.fnl b/fnl/mapping.fnl index c944f28..31b4ee1 100644 --- a/fnl/mapping.fnl +++ b/fnl/mapping.fnl @@ -58,6 +58,12 @@ (vim.api.nvim_buf_set_text 0 (-- sr) 0 (-- er) (length line) [newline]))))) +(fn toggle-wrap [] + (let [has-wrap (. vim.wo :wrap)] + (if has-wrap + (vim.cmd "windo set nowrap") + (vim.cmd "windo set wrap")))) + (map [:v] : eval-expression {:desc "Evaluate expression"}) ;; search with s instead of f @@ -127,8 +133,13 @@ (map [:n] :h (bindcmd "tabmove -1") {:desc "Move tab to the left"}) (map [:n] :l (bindcmd "tabmove +1") {:desc "Move tab to the right"}) + (map [:n] :s (bindcmd :split) {:desc "Split window horizontally"}) (map [:n] :v (bindcmd :vsplit) {:desc "Split window vertically"}) +(map [:n] :sd (bindcmd "vertical resize -15") {:desc "Decrease split width"}) +(map [:n] :si (bindcmd "vertical resize +15") {:desc "Increase split width"}) +(map [:n] :w toggle-wrap {:desc "Toggle wrap"}) + (map [:n] :q (bindcmd :qa) {:desc "Quit all"}) (map [:n] :Q (bindcmd :qa!) {:desc "Force quit all"}) (map [:n :v] :d64 "c=system('base64 --decode', @\")" diff --git a/fnl/mods/ui/focus.fnl b/fnl/mods/ui/focus.fnl new file mode 100644 index 0000000..d9770fe --- /dev/null +++ b/fnl/mods/ui/focus.fnl @@ -0,0 +1,3 @@ +(module mods.ui.focus {autoload {focus :focus }}) + +(focus.setup) diff --git a/fnl/plugins.fnl b/fnl/plugins.fnl index b84554a..7c7c8f9 100644 --- a/fnl/plugins.fnl +++ b/fnl/plugins.fnl @@ -76,6 +76,7 @@ :folke/zen-mode.nvim {:mod :ui.zenmode} :arkav/lualine-lsp-progress {:mod :ui.lualine} :akinsho/bufferline.nvim {:requires [[:nvim-tree/nvim-web-devicons]] :mod :ui.tab} + :nvim-focus/focus.nvim {:mod :ui.focus} ;; programming :nvim-treesitter/nvim-treesitter {:run ":TSUpdate" :mod :tools.treesitter} :ray-x/go.nvim {:mod :dev.go_nvim}