wezterm.lua 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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(
  18. -- "JetBrainsMono NF",
  19. -- { weight = "Regular", italic = false }
  20. -- )
  21. -- config.font = wezterm.font("JetBrainsMono NF")
  22. -- config.font = wezterm.font("JetBrainsMono NF Light")
  23. -- config.font = wezterm.font("DejaVuSansMono Nerd Font Mono")
  24. -- config.font = wezterm.font("DejaVuSansM Nerd Font")
  25. -- config.font = wezterm.font("DejaVu Sans Mono")
  26. -- config.font = wezterm.font("MesloLGS Nerd Font")
  27. -- config.font = wezterm.font("Hack Nerd Font")
  28. -- config.font = wezterm.font("FiraMono Nerd Font")
  29. -- config.font = wezterm.font("FiraCode Nerd Font")
  30. -- config.font = wezterm.font("FiraCode Nerd Font Ret")
  31. -- config.font = wezterm.font("FiraCode Nerd Font Light")
  32. config.font = wezterm.font("Consolas NF")
  33. -- config.font = wezterm.font("Menlo")
  34. -- config.font = wezterm.font("Source Code Pro")
  35. config.font_size = 18
  36. config.line_height = 1.15 -- for Consolas NF
  37. -- config.cell_width = 1
  38. config.bold_brightens_ansi_colors = true
  39. config.freetype_load_target = "Light"
  40. config.freetype_render_target = "HorizontalLcd"
  41. -- config.font_rules = {
  42. -- {
  43. -- intensity = "Bold",
  44. -- italic = true,
  45. -- font = wezterm.font {
  46. -- family = "JetBrainsMono NF",
  47. -- weight = "Bold",
  48. -- style = "Italic",
  49. -- },
  50. -- },
  51. -- {
  52. -- intensity = "Bold",
  53. -- italic = false,
  54. -- font = wezterm.font {
  55. -- family = "JetBrainsMono NF",
  56. -- weight = "Bold",
  57. -- style = "Normal",
  58. -- },
  59. -- },
  60. -- {
  61. -- intensity = "Normal",
  62. -- italic = true,
  63. -- font = wezterm.font {
  64. -- family = "JetBrainsMono NF",
  65. -- style = "Italic",
  66. -- },
  67. -- },
  68. -- }
  69. config.harfbuzz_features = { "calt=0", "clig=0", "liga=0" }
  70. config.enable_tab_bar = false
  71. config.window_padding = {
  72. left = 0,
  73. right = 0,
  74. top = 0,
  75. bottom = 0,
  76. }
  77. config.window_decorations = "RESIZE"
  78. config.window_background_opacity = 1.0
  79. -- config.window_background_image = '/home/alexander/Pictures/Wallpapers/NewWallpapers/0313.jpg'
  80. -- config.text_background_opacity = 0.3
  81. config.default_cursor_style = "SteadyBlock"
  82. -- Keybindings
  83. local act = wezterm.action
  84. config.keys = {
  85. -- Toggle full screen
  86. {
  87. key = "Enter",
  88. mods = "ALT",
  89. action = act.DisableDefaultAssignment,
  90. },
  91. -- Scrolling
  92. { key = "UpArrow", mods = "CTRL|SHIFT", action = act.ScrollByLine(-1) },
  93. { key = "DownArrow", mods = "CTRL|SHIFT", action = act.ScrollByLine(1) },
  94. { key = "PageUp", mods = "CTRL|SHIFT", action = act.ScrollByPage(-1) },
  95. { key = "PageDown", mods = "CTRL|SHIFT", action = act.ScrollByPage(1) },
  96. { key = "Home", mods = "CTRL|SHIFT", action = act.ScrollToTop },
  97. { key = "End", mods = "CTRL|SHIFT", action = act.ScrollToBottom },
  98. -- Split
  99. { -- horizontal
  100. key = "z",
  101. mods = "CTRL|SHIFT",
  102. action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
  103. },
  104. { -- vertical
  105. key = "x",
  106. mods = "CTRL|SHIFT",
  107. action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }),
  108. },
  109. { -- Create new tab
  110. key = "t",
  111. mods = "CTRL|SHIFT",
  112. action = act.SpawnTab("CurrentPaneDomain"),
  113. -- action = act.SpawnTab 'DefaultDomain',
  114. -- action = act.SpawnTab { DomainName = 'unix' },
  115. },
  116. {
  117. key = "j",
  118. mods = "CTRL|SHIFT",
  119. action = wezterm.action.ActivatePaneDirection("Down"),
  120. },
  121. {
  122. key = "k",
  123. mods = "CTRL|SHIFT",
  124. action = wezterm.action.ActivatePaneDirection("Up"),
  125. },
  126. {
  127. key = "h",
  128. mods = "CTRL|SHIFT",
  129. action = wezterm.action.EmitEvent("switch-to-left"),
  130. },
  131. {
  132. key = "l",
  133. mods = "CTRL|SHIFT",
  134. action = wezterm.action.EmitEvent("switch-to-right"),
  135. },
  136. -- Show TabNavigator
  137. { key = "F9", mods = "ALT", action = wezterm.action.ShowTabNavigator },
  138. { key = "]", mods = "CTRL", action = wezterm.action.ActivateTabRelative(1) },
  139. { key = "[", mods = "CTRL", action = wezterm.action.ActivateTabRelative(-1) },
  140. -- { key = ']', mods = 'CTRL', action = wezterm.action.ActivateTabRelativeNoWrap(1) },
  141. -- { key = '[', mods = 'CTRL', action = wezterm.action.ActivateTabRelativeNoWrap(-1) },
  142. { -- Rename current tab
  143. key = "t",
  144. mods = "ALT|SHIFT",
  145. action = act.PromptInputLine({
  146. description = "Enter new name for tab",
  147. -- action = wezterm.action_callback(function(window, pane, line)
  148. action = wezterm.action_callback(function(window, line)
  149. -- line will be `nil` if they hit escape without entering anything
  150. -- An empty string if they just hit enter
  151. -- Or the actual line of text they wrote
  152. if line then
  153. window:active_tab():set_title(line)
  154. end
  155. end),
  156. }),
  157. },
  158. }
  159. -- Activate tab by ctrl+number
  160. for i = 1, 8 do
  161. -- CTRL + number to activate that tab
  162. table.insert(config.keys, {
  163. key = tostring(i),
  164. mods = "CTRL",
  165. action = act.ActivateTab(i - 1),
  166. })
  167. -- -- F1 through F8 to activate that tab
  168. -- table.insert(config.keys, {
  169. -- key = 'F' .. tostring(i),
  170. -- action = act.ActivateTab(i - 1),
  171. -- })
  172. end
  173. -- -- timeout_milliseconds defaults to 1000 and can be omitted
  174. -- config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1000 }
  175. -- config.keys = {
  176. -- {
  177. -- key = '|',
  178. -- mods = 'LEADER|SHIFT',
  179. -- action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
  180. -- },
  181. -- -- Send "CTRL-A" to the terminal when pressing CTRL-A, CTRL-A
  182. -- {
  183. -- key = 'a',
  184. -- mods = 'LEADER|CTRL',
  185. -- action = wezterm.action.SendKey { key = 'a', mods = 'CTRL' },
  186. -- },
  187. -- }
  188. -- FUNCTIONS
  189. -- switch between splitted panes
  190. wezterm.on("switch-to-left", function(window, pane)
  191. local tab = window:mux_window():active_tab()
  192. if tab:get_pane_direction("Left") ~= nil then
  193. window:perform_action(wezterm.action.ActivatePaneDirection("Left"), pane)
  194. else
  195. window:perform_action(wezterm.action.ActivateTabRelative(-1), pane)
  196. end
  197. end)
  198. wezterm.on("switch-to-right", function(window, pane)
  199. local tab = window:mux_window():active_tab()
  200. if tab:get_pane_direction("Right") ~= nil then
  201. window:perform_action(wezterm.action.ActivatePaneDirection("Right"), pane)
  202. else
  203. window:perform_action(wezterm.action.ActivateTabRelative(1), pane)
  204. end
  205. end)
  206. -- and finally, return the configuration to wezterm
  207. return config