This commit is contained in:
Jaroslaw Konik 2023-08-03 08:24:53 +02:00
parent a2bd139738
commit 9a590bb24c
2 changed files with 136 additions and 60 deletions

122
i3config
View file

@ -180,42 +180,42 @@ mode "resize" {
bindsym $mod+r mode "resize"
# set primary gruvbox colorscheme colors
set $bg #282828CC
set $red #cc241d
set $green #4E562C
set $yellow #d79921
set $blue #458588
set $purple #b16286
set $aqua #689d68
set $gray #a89984
set $darkgray #1d2021
# set $bg #282828CC
# set $red #cc241d
# set $green #4E562C
# set $yellow #d79921
# set $blue #458588
# set $purple #b16286
# set $aqua #689d68
# set $gray #a89984
# set $darkgray #1d2021
# green gruvbox
# class border|backgr|text|indicator|child_border
client.focused $aqua $aqua $aqua $aqua $aqua
client.focused_inactive $darkgray $darkgray $darkgray $darkgray $darkgray
client.unfocused $darkgray $darkgray $darkgray $darkgray $darkgray
client.urgent $red $red $red $red $red
bar {
i3bar_command i3bar --transparency
position top
status_command SCRIPT_DIR=~/.config/i3blocks i3blocks
tray_padding 5px
padding 5px
colors {
# bar background color
background $bg
# text color used for blocks that do not have a color specified.
statusline $aqua
# workspaces section
# border backgr. text
focused_workspace $aqua $aqua $darkgray
inactive_workspace $darkgray $darkgray $yellow
active_workspace $darkgray $darkgray $yellow
urgent_workspace $red $red $bg
}
}
# client.focused $aqua $aqua $aqua $aqua $aqua
# client.focused_inactive $darkgray $darkgray $darkgray $darkgray $darkgray
# client.unfocused $darkgray $darkgray $darkgray $darkgray $darkgray
# client.urgent $red $red $red $red $red
#
# bar {
# i3bar_command i3bar --transparency
# position top
# status_command SCRIPT_DIR=~/.config/i3blocks i3blocks
# tray_padding 5px
# padding 5px
# colors {
# # bar background color
# background $bg
# # text color used for blocks that do not have a color specified.
# statusline $aqua
# # workspaces section
# # border backgr. text
# focused_workspace $aqua $aqua $darkgray
# inactive_workspace $darkgray $darkgray $yellow
# active_workspace $darkgray $darkgray $yellow
# urgent_workspace $red $red $bg
# }
# }
exec_always xrandr --output HDMI-1 --mode 3840x1200 -r 99.00
exec_always setxkbmap -option caps:escape
@ -257,7 +257,7 @@ for_window [title="Overview Home Assistant"] floating enable
for_window [title="Outlook"] floating enable
for_window [title="Netflix"] floating enable
for_window [title="Welcome to Prime Video"] floating enable
for_window [title="floating_window"] floating enable
for_window [title="floating_window"] floating enable
bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show
@ -280,3 +280,57 @@ gaps inner 20
no_focus [all]
focus_on_window_activation none
## Base16 Kanagawa
# Scheme author: Tommaso Laurenzi (https://github.com/rebelot)
# Template author: Tinted Theming (https://github.com/tinted-theming)
#
# You can use these variables anywhere in the i3 configuration file.
set $base00 #1f1f28
set $base01 #16161d
set $base02 #223249
set $base03 #54546d
set $base04 #727169
set $base05 #dcd7ba
set $base06 #c8c093
set $base07 #717c7c
set $base08 #c34043
set $base09 #ffa066
set $base0A #c0a36e
set $base0B #76946a
set $base0C #6a9589
set $base0D #7e9cd8
set $base0E #957fb8
set $base0F #d27e99
# Basic bar configuration using the Base16 variables.
bar {
i3bar_command i3bar --transparency
position top
status_command SCRIPT_DIR=~/.config/i3blocks i3blocks
tray_padding 5px
padding 5px
colors {
background $base00
separator $base01
statusline $base04
# State Border BG Text
focused_workspace $base05 $base0D $base00
active_workspace $base05 $base03 $base00
inactive_workspace $base03 $base01 $base05
urgent_workspace $base08 $base08 $base00
binding_mode $base00 $base0A $base00
}
}
# Basic color configuration using the Base16 variables for windows and borders.
# Property Name Border BG Text Indicator Child Border
client.focused $base05 $base0D $base00 $base0D $base0C
client.focused_inactive $base01 $base01 $base05 $base03 $base01
client.unfocused $base01 $base00 $base05 $base01 $base01
client.urgent $base08 $base08 $base00 $base08 $base08
client.placeholder $base00 $base00 $base05 $base00 $base00
client.background $base07

View file

@ -12,7 +12,7 @@ end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{ "NeogitOrg/neogit", dependencies = "nvim-lua/plenary.nvim" },
{ "NeogitOrg/neogit", dependencies = "nvim-lua/plenary.nvim" },
"lewis6991/fileline.nvim",
"mfussenegger/nvim-dap",
{
@ -122,9 +122,9 @@ require("lazy").setup({
-- refer to the configuration section below
},
},
{ "ellisonleao/glow.nvim", config = true, cmd = "Glow" },
{ "ellisonleao/glow.nvim", config = true, cmd = "Glow" },
"nvim-pack/nvim-spectre",
{ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } },
{ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } },
{
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
@ -198,7 +198,7 @@ local TablineFileFlags = {
{
condition = function(self)
return not vim.api.nvim_buf_get_option(self.bufnr, "modifiable")
or vim.api.nvim_buf_get_option(self.bufnr, "readonly")
or vim.api.nvim_buf_get_option(self.bufnr, "readonly")
end,
provider = function(self)
if vim.api.nvim_buf_get_option(self.bufnr, "buftype") == "terminal" then
@ -216,7 +216,7 @@ local FileIcon = {
local filename = self.filename
local extension = vim.fn.fnamemodify(filename, ":e")
self.icon, self.icon_color =
require("nvim-web-devicons").get_icon_color(filename, extension, { default = true })
require("nvim-web-devicons").get_icon_color(filename, extension, { default = true })
end,
provider = function(self)
return self.icon and (self.icon .. " ")
@ -246,7 +246,7 @@ local TablineFileNameBlock = {
end,
name = "termline_buffer_callback",
},
FileIcon, -- turns out the version defined in #crash-course-part-ii-filename-and-friends can be reutilized as is here!
FileIcon, -- turns out the version defined in #crash-course-part-ii-filename-and-friends can be reutilized as is here!
TablineFileName,
TablineFileFlags, -- turns out the version defined in #crash-course-part-ii-filename-and-friends can be reutilized as is here!
}
@ -291,14 +291,14 @@ end, { TerminalLineFileNameBlock })
local function get_terminal_bufs()
return vim.tbl_filter(function(bufnr)
return vim.api.nvim_buf_get_option(bufnr, "buftype") == "terminal"
and vim.api.nvim_buf_get_var(bufnr, "show_in_terminal_bar")
and vim.api.nvim_buf_get_var(bufnr, "show_in_terminal_bar")
end, vim.api.nvim_list_bufs())
end
local function get_non_terminal_bufs()
return vim.tbl_filter(function(bufnr)
return vim.api.nvim_buf_get_option(bufnr, "buftype") ~= "terminal"
and vim.api.nvim_buf_get_option(bufnr, "buflisted")
and vim.api.nvim_buf_get_option(bufnr, "buflisted")
end, vim.api.nvim_list_bufs())
end
@ -494,24 +494,26 @@ vim.api.nvim_create_autocmd("TermOpen", {
timers[bufnr] = timer
timer:start(1000, 750, function()
vim.schedule(function()
local tji = vim.api.nvim_buf_get_var(bufnr, "terminal_job_id")
local pid = vim.fn.jobpid(tji)
local result = vim.fn.system("pgrep -lP " .. pid)
local first_child = result:gmatch("([^\n]*)\n?")()
if vim.api.nvim_buf_is_valid(bufnr) then
local tji = vim.api.nvim_buf_get_var(bufnr, "terminal_job_id")
local pid = vim.fn.jobpid(tji)
local result = vim.fn.system("pgrep -lP " .. pid)
local first_child = result:gmatch("([^\n]*)\n?")()
local words_iterator = first_child:gmatch("%S+")
words_iterator()
local words_iterator = first_child:gmatch("%S+")
words_iterator()
local words = {}
for word in words_iterator do
table.insert(words, word)
end
local words = {}
for word in words_iterator do
table.insert(words, word)
end
local process_name = table.concat(words, " ")
if process_name ~= "" then
vim.api.nvim_buf_set_name(bufnr, bufnr .. " " .. process_name)
else
vim.api.nvim_buf_set_name(bufnr, tostring(bufnr))
local process_name = table.concat(words, " ")
if process_name ~= "" then
vim.api.nvim_buf_set_name(bufnr, bufnr .. " " .. process_name)
else
vim.api.nvim_buf_set_name(bufnr, tostring(bufnr))
end
end
end)
end)
@ -629,8 +631,8 @@ wk.register({
local current_buf_nr = vim.fn.bufnr()
local all = vim.tbl_filter(function(bufnr)
return current_buf_nr ~= bufnr
and vim.api.nvim_buf_get_option(bufnr, "buftype") ~= "terminal"
and vim.api.nvim_buf_get_option(bufnr, "buflisted")
and vim.api.nvim_buf_get_option(bufnr, "buftype") ~= "terminal"
and vim.api.nvim_buf_get_option(bufnr, "buflisted")
end, vim.api.nvim_list_bufs())
for _, bufnr in ipairs(all) do
require("bufdelete").bufdelete(bufnr, false)
@ -642,7 +644,27 @@ wk.register({
},
}, { prefix = "<leader>" })
vim.keymap.set("n", "<Tab>", "<cmd>bnext<CR>", {})
vim.keymap.set("n", "<Tab>", function()
if vim.bo.buftype == "terminal" then
local current_buf_nr = vim.fn.bufnr()
local current_idx = nil
local terminals = get_terminal_bufs()
for i, v in pairs(terminals) do
if v == current_buf_nr then
current_idx = i
break
end
end
if current_idx < #terminals then
vim.cmd("buffer " .. terminals[current_idx + 1])
else
vim.cmd("buffer " .. terminals[1])
end
else
vim.cmd("<cmd>bnext<CR>")
end
end, {})
vim.keymap.set("n", "<c-o>", "<cmd>BufferLinePick<CR>", {})
vim.keymap.set("n", "<c-p>", telescope_builtin.find_files, {})
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>", {})