mirror of
https://github.com/stevenproctor/dotfiles.git
synced 2026-01-28 11:29:56 -06:00
neovim - smartsplits plugin
This commit is contained in:
@@ -79,28 +79,29 @@
|
|||||||
; Trim trailing Whitespace in current line
|
; Trim trailing Whitespace in current line
|
||||||
(util.lnnoremap :tw "<C-U>.s/\\s\\+$//ge<CR>:nohlsearch<Enter>/<BS>")
|
(util.lnnoremap :tw "<C-U>.s/\\s\\+$//ge<CR>:nohlsearch<Enter>/<BS>")
|
||||||
|
|
||||||
|
;; (noremap :n :<C-A-l> ":echo \"test\"\n")
|
||||||
; Window switching
|
; Window switching
|
||||||
; ˙ -> alt-h
|
; ˙ -> alt-h
|
||||||
; ∆ -> alt-j
|
; ∆ -> alt-j
|
||||||
; ˚ -> alt-k
|
; ˚ -> alt-k
|
||||||
; ¬ -> alt-l
|
; ¬ -> alt-l
|
||||||
;; Terminal mode
|
;; Terminal mode
|
||||||
(noremap :t "˙" "<c-\\><c-n><c-w>h")
|
;; (noremap :t "˙" "<c-\\><c-n><c-w>h")
|
||||||
(noremap :t "∆" "<c-\\><c-n><c-w>j")
|
;; (noremap :t "∆" "<c-\\><c-n><c-w>j")
|
||||||
(noremap :t "˚" "<c-\\><c-n><c-w>k")
|
;; (noremap :t "˚" "<c-\\><c-n><c-w>k")
|
||||||
(noremap :t "¬" "<c-\\><c-n><c-w>l")
|
;; (noremap :t "¬" "<c-\\><c-n><c-w>l")
|
||||||
;; Insert mode:
|
;; ;; Insert mode:
|
||||||
(noremap :i "˙" :<Esc><c-w>h)
|
;; (noremap :i "˙" :<Esc><c-w>h)
|
||||||
(noremap :i "∆" :<Esc><c-w>j)
|
;; (noremap :i "∆" :<Esc><c-w>j)
|
||||||
(noremap :i "˚" :<Esc><c-w>k)
|
;; (noremap :i "˚" :<Esc><c-w>k)
|
||||||
(noremap :i "¬" :<Esc><c-w>l)
|
;; (noremap :i "¬" :<Esc><c-w>l)
|
||||||
;; Visual mode:
|
;; ;; Visual mode:
|
||||||
(noremap :v "˙" :<Esc><c-w>h)
|
;; (noremap :v "˙" :<Esc><c-w>h)
|
||||||
(noremap :v "∆" :<Esc><c-w>j)
|
;; (noremap :v "∆" :<Esc><c-w>j)
|
||||||
(noremap :v "˚" :<Esc><c-w>k)
|
;; (noremap :v "˚" :<Esc><c-w>k)
|
||||||
(noremap :v "¬" :<Esc><c-w>l)
|
;; (noremap :v "¬" :<Esc><c-w>l)
|
||||||
;; Normal mode:
|
;; ;; Normal mode:
|
||||||
(noremap :n "˙" :<c-w>h)
|
;; (noremap :n "˙" :<c-w>h)
|
||||||
(noremap :n "∆" :<c-w>j)
|
;; (noremap :n "∆" :<c-w>j)
|
||||||
(noremap :n "˚" :<c-w>k)
|
;; (noremap :n "˚" :<c-w>k)
|
||||||
(noremap :n "¬" :<c-w>l)
|
;; (noremap :n "¬" :<c-w>l)
|
||||||
|
|||||||
27
nvim/.config/nvim/fnl/dotfiles/plugin/smartsplits.fnl
Normal file
27
nvim/.config/nvim/fnl/dotfiles/plugin/smartsplits.fnl
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
(module dotfiles.plugin.smartsplits
|
||||||
|
{autoload {nvim aniseed.nvim
|
||||||
|
a aniseed.core
|
||||||
|
smart-splits smart-splits
|
||||||
|
;; util dotfiles.util
|
||||||
|
}})
|
||||||
|
|
||||||
|
(smart-splits.setup)
|
||||||
|
|
||||||
|
;; recommended mappings
|
||||||
|
;; resizing splits
|
||||||
|
;; these keymaps will also accept a range,
|
||||||
|
;; for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)`
|
||||||
|
(vim.keymap.set :n :<M-S-h> smart-splits.resize_left)
|
||||||
|
(vim.keymap.set :n :<M-S-j> smart-splits.resize_down)
|
||||||
|
(vim.keymap.set :n :<M-S-k> smart-splits.resize_up)
|
||||||
|
(vim.keymap.set :n :<M-S-l> smart-splits.resize_right)
|
||||||
|
;; moving between splits
|
||||||
|
(vim.keymap.set :n :<M-h> smart-splits.move_cursor_left)
|
||||||
|
(vim.keymap.set :n :<M-j> smart-splits.move_cursor_down)
|
||||||
|
(vim.keymap.set :n :<M-k> smart-splits.move_cursor_up)
|
||||||
|
(vim.keymap.set :n :<M-l> smart-splits.move_cursor_right)
|
||||||
|
;; swapping buffers between windows
|
||||||
|
(vim.keymap.set :n :<leader><leader>h smart-splits.swap_buf_left)
|
||||||
|
(vim.keymap.set :n :<leader><leader>j smart-splits.swap_buf_down)
|
||||||
|
(vim.keymap.set :n :<leader><leader>k smart-splits.swap_buf_up)
|
||||||
|
(vim.keymap.set :n :<leader><leader>l smart-splits.swap_buf_right)
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
:lifepillar/vim-solarized8 {}
|
:lifepillar/vim-solarized8 {}
|
||||||
:lukas-reineke/headlines.nvim {:mod :headlines}
|
:lukas-reineke/headlines.nvim {:mod :headlines}
|
||||||
; :michaelb/sniprun {:run "bash ./install.sh" :mod :sniprun}
|
; :michaelb/sniprun {:run "bash ./install.sh" :mod :sniprun}
|
||||||
|
:mrjones2014/smart-splits.nvim {:mod :smartsplits}
|
||||||
:neovim/nvim-lspconfig {:mod :lspconfig}
|
:neovim/nvim-lspconfig {:mod :lspconfig}
|
||||||
:norcalli/nvim-colorizer.lua {:mod :colorizer}
|
:norcalli/nvim-colorizer.lua {:mod :colorizer}
|
||||||
:nvim-orgmode/orgmode {:mod :orgmode}
|
:nvim-orgmode/orgmode {:mod :orgmode}
|
||||||
|
|||||||
31
tmux.conf
31
tmux.conf
@@ -1,6 +1,9 @@
|
|||||||
set -g prefix C-a
|
set -g prefix C-a
|
||||||
unbind C-b
|
unbind C-b
|
||||||
|
|
||||||
|
set -g xterm-keys on
|
||||||
|
set -s extended-keys on
|
||||||
|
|
||||||
set -g history-file ~/.tmux_history
|
set -g history-file ~/.tmux_history
|
||||||
|
|
||||||
set -s escape-time 1
|
set -s escape-time 1
|
||||||
@@ -58,3 +61,31 @@ set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
|
|||||||
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
|
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
|
||||||
|
|
||||||
set-option -g focus-events on
|
set-option -g focus-events on
|
||||||
|
|
||||||
|
|
||||||
|
# Smart pane switching with awareness of Vim splits.
|
||||||
|
# See: https://github.com/christoomey/vim-tmux-navigator
|
||||||
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||||
|
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
||||||
|
bind-key -n M-S-h if-shell "$is_vim" 'send-keys M-S-h' 'resize-pane -L 3'
|
||||||
|
bind-key -n M-S-j if-shell "$is_vim" 'send-keys M-S-j' 'resize-pane -D 3'
|
||||||
|
bind-key -n M-S-k if-shell "$is_vim" 'send-keys M-S-k' 'resize-pane -U 3'
|
||||||
|
bind-key -n M-S-l if-shell "$is_vim" 'send-keys M-S-l' 'resize-pane -R 3'
|
||||||
|
|
||||||
|
bind-key -n M-h if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
|
||||||
|
bind-key -n M-j if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
|
||||||
|
bind-key -n M-k if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
|
||||||
|
bind-key -n M-l if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
|
||||||
|
|
||||||
|
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
|
||||||
|
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
|
||||||
|
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
||||||
|
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
|
||||||
|
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
|
||||||
|
|
||||||
|
bind-key -T copy-mode-vi 'M-S-h' select-pane -L
|
||||||
|
bind-key -T copy-mode-vi 'M-S-j' select-pane -D
|
||||||
|
bind-key -T copy-mode-vi 'M-S-k' select-pane -U
|
||||||
|
bind-key -T copy-mode-vi 'M-S-l' select-pane -R
|
||||||
|
bind-key -T copy-mode-vi 'M-S-\' select-pane -l
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user