wezterm.lua 6.9 KB

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