wezterm.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. local wezterm = require 'wezterm'
  2. local config = {}
  3. if wezterm.config_builder then
  4. config = wezterm.config_builder()
  5. end
  6. config.font = wezterm.font 'JetBrainsMono Nerd Font'
  7. config.enable_tab_bar = false
  8. -- Function to determine if the system is in dark mode
  9. local function is_dark()
  10. if wezterm.gui then
  11. return wezterm.gui.get_appearance():find 'Dark'
  12. end
  13. return true
  14. end
  15. -- Define color schemes
  16. local dark_colors = {
  17. foreground = '#e4e1e6',
  18. background = '#1b1b1f',
  19. cursor_bg = '#add8e6',
  20. cursor_fg = 'black',
  21. cursor_border = '#add8e6',
  22. selection_fg = 'black',
  23. selection_bg = '#fffacd',
  24. scrollbar_thumb = '#222222',
  25. split = '#444444',
  26. ansi = {
  27. '#3b4252', '#bf616a', '#a3be8c', '#ebcb8b',
  28. '#81a1c1', '#b48ead', '#88c0d0', '#e5e9f0',
  29. },
  30. brights = {
  31. '#4c566a', '#bf616a', '#a3be8c', '#ebcb8b',
  32. '#81a1c1', '#b48ead', '#8fbcbb', '#eceff4',
  33. },
  34. indexed = { [136] = '#af8700' },
  35. }
  36. local light_colors = {
  37. foreground = '#2e3440',
  38. background = '#eceff4',
  39. cursor_bg = '#5e81ac',
  40. cursor_fg = 'white',
  41. cursor_border = '#5e81ac',
  42. selection_fg = '#eceff4',
  43. selection_bg = '#4c566a',
  44. scrollbar_thumb = '#d8dee9',
  45. split = '#d8dee9',
  46. ansi = {
  47. '#3b4252', '#bf616a', '#a3be8c', '#ebcb8b',
  48. '#81a1c1', '#b48ead', '#88c0d0', '#e5e9f0',
  49. },
  50. brights = {
  51. '#4c566a', '#bf616a', '#a3be8c', '#ebcb8b',
  52. '#81a1c1', '#b48ead', '#8fbcbb', '#eceff4',
  53. },
  54. indexed = { [136] = '#af8700' },
  55. }
  56. -- Apply colors based on appearance
  57. if is_dark() then
  58. config.colors = dark_colors
  59. else
  60. config.colors = light_colors
  61. end
  62. config.cursor_blink_rate = 0
  63. config.disable_default_key_bindings = true
  64. config.keys = {
  65. -- Copy
  66. { key = 'c', mods = 'ALT', action = wezterm.action.CopyTo('Clipboard') },
  67. { key = 'c', mods = 'CTRL|SHIFT', action = wezterm.action.CopyTo('Clipboard') },
  68. -- Paste
  69. { key = 'v', mods = 'ALT', action = wezterm.action.PasteFrom('Clipboard') },
  70. { key = 'v', mods = 'CTRL|SHIFT', action = wezterm.action.PasteFrom('Clipboard') },
  71. -- Font Size
  72. { key = 'k', mods = 'ALT|SHIFT', action = wezterm.action.IncreaseFontSize },
  73. { key = 'j', mods = 'ALT|SHIFT', action = wezterm.action.DecreaseFontSize },
  74. { key = '0', mods = 'ALT', action = wezterm.action.ResetFontSize },
  75. -- Scrolling
  76. { key = 'u', mods = 'ALT', action = wezterm.action.ScrollByPage(-1) },
  77. { key = 'd', mods = 'ALT', action = wezterm.action.ScrollByPage(1) },
  78. { key = 'k', mods = 'ALT', action = wezterm.action.ScrollByLine(-1) },
  79. { key = 'j', mods = 'ALT', action = wezterm.action.ScrollByLine(1) },
  80. -- Search
  81. { key = 'f', mods = 'ALT', action = wezterm.action.Search { CaseInSensitiveString = '' } },
  82. }
  83. return config