updates to nvim

This commit is contained in:
Tyler Starr 2023-02-13 21:22:54 -08:00
parent d5790929bb
commit f1d2764a79
6 changed files with 118 additions and 1 deletions

View File

@ -184,7 +184,7 @@ bindsym $mod+Shift+r move container to workspace $tag8
# audio
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +2%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -2%
bindsym XF86AudioMute exec amixer -q set Master toggle
bindsym XF86AudioMute exec pactl set-sink-mute 0 toggle
# [o]pen applications
bindsym $mod+Return exec alacritty
@ -217,6 +217,7 @@ mode scratch {
exec --no-startup-id "autorandr --change && i3-msg restart"
exec --no-startup-id "pipewire & pipewire-pulse &"
exec --no-startup-id "udiskie &"
exec_always --no-startup-id "$HOME/.config/i3/scripts/autolayout.sh"
exec_always --no-startup-id "$HOME/.config/i3/scripts/polybar.sh"
exec_always --no-startup-id "blueman-applet"
exec_always --no-startup-id "nm-applet"

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python
import i3ipc
i3 = i3ipc.Connection()
def on_window_event(i3, e):
focused_container = i3.get_tree().find_focused().parent
# Get parent layout of focused window
parent_layout = focused_container.layout
# Get number of windows in focues container
num_parent_windows = len(focused_container.nodes)
# Get number of windows in workspace
workspace = i3.get_tree().find_focused().workspace()
num_workspace_windows = len(workspace.leaves())
if num_parent_windows > 1 and parent_layout != "tabbed":
i3.command("splitv; layout tabbed")
elif num_workspace_windows == 1:
i3.command("layout splith")
# Subscribe to window events
i3.on("window", on_window_event)
# Start the main loop
i3.main()

View File

@ -104,3 +104,4 @@ local function config(_config)
end
require("lspconfig").tsserver.setup(config())
require'lspconfig'.pyright.setup(config())

View File

@ -3,3 +3,4 @@ require("tstarr.packer")
require("tstarr.telescope")
require("tstarr.vimwiki")
require("tstarr.which-key")
require("tstarr.iron")

View File

@ -0,0 +1,88 @@
local iron = require("iron.core")
local wk = require("which-key")
iron.setup {
config = {
-- Whether a repl should be discarded or not
scratch_repl = true,
-- Your repl definitions come here
repl_definition = {
sh = {
-- Can be a table or a function that
-- returns a table (see below)
command = {"zsh"}
},
python = require("iron.fts.python").ipython
},
-- How the repl window will be displayed
-- See below for more information
repl_open_cmd = require('iron.view').right("35%"),
},
-- Iron doesn't set keymaps by default anymore.
-- You can set them here or manually add keymaps to the functions in iron.core
keymaps = {
send_motion = "<leader>rm",
visual_send = "<leader>rv",
send_file = "<leader>rf",
send_line = "<leader>rl",
send_mark = "<leader>rms",
mark_motion = "<leader>rmm",
mark_visual = "<leader>rmv",
remove_mark = "<leader>rmm",
cr = "<leader>r<cr>",
interrupt = "<leader>r<space>",
exit = "<leader>rq",
clear = "<leader>rc",
},
-- If the highlight is on, you can change how it looks
-- For the available options, check nvim_set_hl
highlight = {
italic = true
},
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
}
-- Iron also has a list of commands, see :h iron-commands for all available commands
vim.keymap.set('n', '<leader>rs', '<cmd>IronRepl<cr>')
vim.keymap.set('n', '<leader>rr', '<cmd>IronRestart<cr>')
vim.keymap.set('n', '<leader>rh', '<cmd>IronHide<cr>')
-- Define the function to exit terminal mode
local function exit_terminal_mode()
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-\\><C-n>', true, false, true), 'n', true)
end
-- Map the Escape key to the exit_terminal_mode function in terminal mode
vim.keymap.set('t', '<Esc>', function () exit_terminal_mode() end, {noremap = true})
wk.register({
r = {
name = "+iron",
m = "Send Motion",
v = "Send Visual",
f = "Send File",
l = "Send Line",
["<cr>"] = "Send Enter",
["<leader>"] = "Send Interrupt",
q = "Exit",
c = "Clear REPL",
m = {
name = "+mark",
s = "Send Mark",
m = "Mark Motion",
v = "Mark Visual",
r = "Remove Mark"
}
},
}, { prefix = "<leader>" })
wk.register({
r = {
name = "+iron",
v = "Send Visual",
m = {
name = "+mark",
v = "Mark Visual",
}
},
}, { prefix = "<leader>", mode = "v"})

View File

@ -37,5 +37,6 @@ return require('packer').startup(function(use)
use ('nathangrigg/vim-beancount')
use ('vimwiki/vimwiki')
use ('folke/which-key.nvim')
use ('hkupty/iron.nvim')
end)