wezterm.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. {
  66. key = 'c',
  67. mods = 'ALT',
  68. action = wezterm.action.CopyTo('Clipboard'),
  69. },
  70. {
  71. key = 'v',
  72. mods ='ALT',
  73. action = wezterm.action.PasteFrom('Clipboard')
  74. },
  75. {
  76. key = 'k',
  77. mods = 'ALT|SHIFT',
  78. action = wezterm.action.IncreaseFontSize
  79. },
  80. {
  81. key = 'j',
  82. mods = 'ALT|SHIFT',
  83. action = wezterm.action.DecreaseFontSize
  84. },
  85. {
  86. key = '0',
  87. mods = 'ALT',
  88. action = wezterm.action.ResetFontSize
  89. },
  90. {
  91. key = 'u',
  92. mods = 'ALT',
  93. action = wezterm.action.ScrollByPage(-1)
  94. },
  95. {
  96. key = 'd',
  97. mods = 'ALT',
  98. action = wezterm.action.ScrollByPage(1)
  99. },
  100. {
  101. key = 'k',
  102. mods = 'ALT',
  103. action = wezterm.action.ScrollByLine(-1)
  104. },
  105. {
  106. key = 'j',
  107. mods = 'ALT',
  108. action = wezterm.action.ScrollByLine(1)
  109. },
  110. {
  111. key = 'f',
  112. mods = 'ALT',
  113. action = wezterm.action.Search { CaseInSensitiveString = '' },
  114. },
  115. }
  116. return config