aboutsummaryrefslogtreecommitdiff
path: root/fnl/opt.fnl
blob: 2925595397fae2a5a964f776e95f5805beaf02c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
(local util (require :util))

(tset vim.opt :wrap false)
(tset vim.opt :linebreak false)

(tset vim.opt :tabstop 2)
(tset vim.opt :shiftwidth 2)
(tset vim.bo :softtabstop 2)
(tset vim.opt :expandtab true)

(tset vim.opt :number true)
(tset vim.o :signcolumn :yes)
(tset vim.opt :termguicolors true)
;--vim.opt.fillchars = { eob = ""}

(local color_change (fn [] 
      ;havent found how to make toggleterm to work, it wont switch until you select the window
      ;possible bug with toggleterm?
      (vim.api.nvim_set_hl 0 :Normal {:bg :none :fg :none})
      (vim.api.nvim_set_hl 0 :SignColumn {:bg :none})
      (vim.api.nvim_set_hl 0 :EndOfBuffer {:bg :none})
      (vim.api.nvim_set_hl 0 :NormalFloat {:bg :none})
      (vim.api.nvim_set_hl 0 :FloatBorder {:bg :none})
      (vim.api.nvim_set_hl 0 :NvimTreeNormal {:bg :none})
      (vim.api.nvim_set_hl 0 :NormalNC {:bg :none})
      (vim.api.nvim_set_hl 0 :TermCursor {:bg :none})
      (vim.api.nvim_set_hl 0 :TermCursorNC {:bg :none})
      (vim.api.nvim_set_hl 0 :VertSplit {:bg :none})
      (vim.api.nvim_set_hl 0 :LineNr {:bg :none})
      (vim.api.nvim_set_hl 0 :StatusLine {:bg :none})))

(global _trans_ false)

(fn trans-disable []
  (global _trans_ false)
  (vim.api.nvim_clear_autocmds {:event :Colorscheme})
  (vim.cmd (.. "colorscheme " _G.settings.colorscheme)))

(fn trans-enable []
  (global _trans_ true)
  (vim.api.nvim_create_autocmd "Colorscheme" {
    :pattern :*
    :callback color_change})
  (color_change)
  (vim.cmd (.. "colorscheme " _G.settings.colorscheme)))

(when (= _G.settings.trans "enable")
  (trans-enable))

(vim.cmd (.. "colorscheme " _G.settings.colorscheme))

(when (= (vim.fn.has :persistent_undo) 1) 
  (local target_path (vim.fn.expand "~/.undodir"))
  (when (not= (vim.fn.isdirectory target_path) 1)
    (vim.fn.mkdir target_path :p 0777))
  (tset vim.o :undodir target_path)
  (tset vim.o :undofile true))

(tset _G :current_layout "")
(when (and (not= _G.settings.layout "") (not= _G.settings.layout "none"))
  (util.after-setup (. (require (.. :layouts. _G.settings.layout)) :enable))
  (tset _G :current_layout _G.settings.layout))

{:trans-disable trans-disable :trans-enable trans-enable}