wezterm.lua 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. -- Pull in the wezterm API
  2. local wezterm = require("wezterm")
  3. -- This will hold the configuration.
  4. local config = wezterm.config_builder()
  5. -- my Everforest colorscheme
  6. config.colors = {
  7. foreground = "#d3c6aa",
  8. background = "#2d353b",
  9. cursor_bg = "#d3c6aa",
  10. cursor_border = "#d3c6aa",
  11. cursor_fg = "#475258",
  12. selection_bg = "#475258",
  13. selection_fg = "#a7c080",
  14. ansi = { "#475258", "#e67e80", "#a7c080", "#dbbc7f", "#7fbbb3", "#d699b6", "#83c092", "#d3c6aa" },
  15. brights = { "#475258", "#e67e80", "#a7c080", "#dbbc7f", "#7fbbb3", "#d699b6", "#83c092", "#d3c6aa" },
  16. }
  17. config.font = wezterm.font("JetbrainsMono Nerd Font Mono")
  18. -- config.font = wezterm.font("DejaVuSansMono Nerd Font Mono")
  19. -- config.font = wezterm.font("DejaVu Sans Mono")
  20. -- config.font = wezterm.font("MesloLGS Nerd Font Mono")
  21. -- config.font = wezterm.font("Hack Nerd Font Mono")
  22. -- config.font = wezterm.font("Consolas NF")
  23. -- config.font = wezterm.font("Menlo")
  24. -- config.font = wezterm.font("Source Code Pro")
  25. config.font_size = 17
  26. config.harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' }
  27. config.enable_tab_bar = false
  28. config.window_padding = {
  29. left = 4,
  30. right = 1,
  31. top = 0,
  32. bottom = 0,
  33. }
  34. config.window_decorations = "RESIZE"
  35. config.window_background_opacity = 1.0
  36. -- config.window_background_image = '/home/alexander/Pictures/Wallpapers/NewWallpapers/0313.jpg'
  37. -- config.text_background_opacity = 0.3
  38. config.default_cursor_style = "SteadyBlock"
  39. -- Keybindings
  40. local act = wezterm.action
  41. config.keys = {
  42. -- Toggle full screen
  43. {
  44. key = "Enter",
  45. mods = "ALT",
  46. action = act.DisableDefaultAssignment,
  47. },
  48. -- Scrolling
  49. { key = "UpArrow", mods = "CTRL|SHIFT", action = act.ScrollByLine(-1) },
  50. { key = "DownArrow", mods = "CTRL|SHIFT", action = act.ScrollByLine(1) },
  51. { key = "PageUp", mods = "CTRL|SHIFT", action = act.ScrollByPage(-1) },
  52. { key = "PageDown", mods = "CTRL|SHIFT", action = act.ScrollByPage(1) },
  53. { key = "Home", mods = "CTRL|SHIFT", action = act.ScrollToTop },
  54. { key = "End", mods = "CTRL|SHIFT", action = act.ScrollToBottom },
  55. -- Split
  56. { -- horizontal
  57. key = "z",
  58. mods = "CTRL|SHIFT",
  59. action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
  60. },
  61. { -- vertical
  62. key = "x",
  63. mods = "CTRL|SHIFT",
  64. action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }),
  65. },
  66. { -- Create new tab
  67. key = "t",
  68. mods = "CTRL|SHIFT",
  69. action = act.SpawnTab("CurrentPaneDomain"),
  70. -- action = act.SpawnTab 'DefaultDomain',
  71. -- action = act.SpawnTab { DomainName = 'unix' },
  72. },
  73. {
  74. key = "j",
  75. mods = "CTRL|SHIFT",
  76. action = wezterm.action.ActivatePaneDirection("Down"),
  77. },
  78. {
  79. key = "k",
  80. mods = "CTRL|SHIFT",
  81. action = wezterm.action.ActivatePaneDirection("Up"),
  82. },
  83. {
  84. key = "h",
  85. mods = "CTRL|SHIFT",
  86. action = wezterm.action.EmitEvent("switch-to-left"),
  87. },
  88. {
  89. key = "l",
  90. mods = "CTRL|SHIFT",
  91. action = wezterm.action.EmitEvent("switch-to-right"),
  92. },
  93. -- Show TabNavigator
  94. { key = "F9", mods = "ALT", action = wezterm.action.ShowTabNavigator },
  95. { key = "]", mods = "CTRL", action = wezterm.action.ActivateTabRelative(1) },
  96. { key = "[", mods = "CTRL", action = wezterm.action.ActivateTabRelative(-1) },
  97. -- { key = ']', mods = 'CTRL', action = wezterm.action.ActivateTabRelativeNoWrap(1) },
  98. -- { key = '[', mods = 'CTRL', action = wezterm.action.ActivateTabRelativeNoWrap(-1) },
  99. { -- Rename current tab
  100. key = "t",
  101. mods = "ALT|SHIFT",
  102. action = act.PromptInputLine({
  103. description = "Enter new name for tab",
  104. -- action = wezterm.action_callback(function(window, pane, line)
  105. action = wezterm.action_callback(function(window, line)
  106. -- line will be `nil` if they hit escape without entering anything
  107. -- An empty string if they just hit enter
  108. -- Or the actual line of text they wrote
  109. if line then
  110. window:active_tab():set_title(line)
  111. end
  112. end),
  113. }),
  114. },
  115. }
  116. -- Activate tab by ctrl+number
  117. for i = 1, 8 do
  118. -- CTRL + number to activate that tab
  119. table.insert(config.keys, {
  120. key = tostring(i),
  121. mods = "CTRL",
  122. action = act.ActivateTab(i - 1),
  123. })
  124. -- -- F1 through F8 to activate that tab
  125. -- table.insert(config.keys, {
  126. -- key = 'F' .. tostring(i),
  127. -- action = act.ActivateTab(i - 1),
  128. -- })
  129. end
  130. -- -- timeout_milliseconds defaults to 1000 and can be omitted
  131. -- config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1000 }
  132. -- config.keys = {
  133. -- {
  134. -- key = '|',
  135. -- mods = 'LEADER|SHIFT',
  136. -- action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
  137. -- },
  138. -- -- Send "CTRL-A" to the terminal when pressing CTRL-A, CTRL-A
  139. -- {
  140. -- key = 'a',
  141. -- mods = 'LEADER|CTRL',
  142. -- action = wezterm.action.SendKey { key = 'a', mods = 'CTRL' },
  143. -- },
  144. -- }
  145. -- FUNCTIONS
  146. -- switch between splitted panes
  147. wezterm.on("switch-to-left", function(window, pane)
  148. local tab = window:mux_window():active_tab()
  149. if tab:get_pane_direction("Left") ~= nil then
  150. window:perform_action(wezterm.action.ActivatePaneDirection("Left"), pane)
  151. else
  152. window:perform_action(wezterm.action.ActivateTabRelative(-1), pane)
  153. end
  154. end)
  155. wezterm.on("switch-to-right", function(window, pane)
  156. local tab = window:mux_window():active_tab()
  157. if tab:get_pane_direction("Right") ~= nil then
  158. window:perform_action(wezterm.action.ActivatePaneDirection("Right"), pane)
  159. else
  160. window:perform_action(wezterm.action.ActivateTabRelative(1), pane)
  161. end
  162. end)
  163. -- and finally, return the configuration to wezterm
  164. return config