aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fnl/defaults.fnl1
-rw-r--r--fnl/layouts/ide.fnl4
-rw-r--r--fnl/layouts/quiet.fnl4
-rw-r--r--fnl/opt.fnl15
-rw-r--r--fnl/plugins/which_key.fnl7
-rw-r--r--fnl/settings-ui.fnl59
-rw-r--r--init.fnl4
-rw-r--r--lua/lua/lualine.lua4
8 files changed, 89 insertions, 9 deletions
diff --git a/fnl/defaults.fnl b/fnl/defaults.fnl
index c50c4e4..71dac80 100644
--- a/fnl/defaults.fnl
+++ b/fnl/defaults.fnl
@@ -2,6 +2,7 @@
(when (or (= (. _G.settings key) nil) ?force) (tset _G.settings key value)))
(global defaults (lambda [force]
+ (default :layout "" force)
(default :colorscheme :oxocarbon force)
(default :lsp "pyright,lua_ls,clangd,zls,csharp_ls,ts_ls,rust_analyzer" force)))
diff --git a/fnl/layouts/ide.fnl b/fnl/layouts/ide.fnl
new file mode 100644
index 0000000..8ba6182
--- /dev/null
+++ b/fnl/layouts/ide.fnl
@@ -0,0 +1,4 @@
+(fn []
+(vim.cmd "ToggleTerm direction=horizontal")
+(vim.cmd "Neotree toggle")
+(vim.cmd "Outline"))
diff --git a/fnl/layouts/quiet.fnl b/fnl/layouts/quiet.fnl
new file mode 100644
index 0000000..73d8b0f
--- /dev/null
+++ b/fnl/layouts/quiet.fnl
@@ -0,0 +1,4 @@
+(fn []
+(tset vim.opt :number false)
+(tset vim.o :signcolumn :no)
+(tset vim.opt :fillchars {:eob " "}))
diff --git a/fnl/opt.fnl b/fnl/opt.fnl
index 17e4e0d..663fdee 100644
--- a/fnl/opt.fnl
+++ b/fnl/opt.fnl
@@ -11,13 +11,17 @@
(tset vim.opt :termguicolors true)
;--vim.opt.fillchars = { eob = ""}
+(local color_change (fn []
+ (vim.api.nvim_set_hl 0 :Normal {: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})))
+
(when (= _G.settings.trans "enable")
(vim.api.nvim_create_autocmd "Colorscheme" {
:pattern :*
- :callback (fn []
- (vim.api.nvim_set_hl 0 :Normal {:bg :none})
- (vim.api.nvim_set_hl 0 :NormalFloat {:bg :none})
- (vim.api.nvim_set_hl 0 :FloatBorder {:bg :none}))}))
+ :callback color_change})
+ (color_change))
(vim.cmd (.. "colorscheme " _G.settings.colorscheme))
@@ -27,3 +31,6 @@
(vim.fn.mkdir target_path :p 0777))
(tset vim.o :undodir target_path)
(tset vim.o :undofile true))
+
+(when (not= _G.settings.layout "")
+ ((require (.. :layouts. _G.settings.layout))))
diff --git a/fnl/plugins/which_key.fnl b/fnl/plugins/which_key.fnl
index e3279db..16b10a1 100644
--- a/fnl/plugins/which_key.fnl
+++ b/fnl/plugins/which_key.fnl
@@ -13,6 +13,7 @@
(wmap :t "<cmd>ToggleTerm direction=horizontal<CR>" "hterm")
(wmap :d "<cmd>Glance references<CR>" "references")
(wmap :s "<cmd>Telescope live_grep<CR>" "search")
+ (wmap :z "<cmd>Telescope find_files<CR>" "open file")
(wmap :b "<cmd>JABSOpen<CR>" "buffers")
(wmap :g (fn []
(local buffer (vim.fn.expand :%))
@@ -27,10 +28,8 @@
;;layouts
(gmap :l "layout")
- (wmap :li (fn []
- (vim.cmd "ToggleTerm direction=horizontal")
- (vim.cmd "Neotree toggle")
- (vim.cmd "Outline")) "ide")
+ (wmap :li (require :layouts.ide) "ide")
+ (wmap :lq (require :layouts.quiet) "quiet")
;;visual
(gmap :v "visual")
diff --git a/fnl/settings-ui.fnl b/fnl/settings-ui.fnl
new file mode 100644
index 0000000..e7f32d3
--- /dev/null
+++ b/fnl/settings-ui.fnl
@@ -0,0 +1,59 @@
+(local options {
+ :colorscheme {:array false :options [:oxocarbon :monochrome :doom-one]}
+ :lsp {:array true}})
+
+(local options_k {})
+(each [k v (pairs options)] (table.insert options_k k))
+
+(lambda startswith [arr str]
+ (local end {})
+ (each [_ a (pairs arr)]
+ (when (= (a:sub 1 (# str)) str)
+ (table.insert end a)))
+ end)
+
+(lambda trim [_str]
+ (var str _str)
+ (while (and (> (# str) 0) (= (str:sub 1 1) " ")) (set str (str:sub 2)))
+ (while (and (> (# str) 0) (= (str:sub -1 -1) " ")) (set str (str:sub 1 -2)))
+ str)
+
+(lambda carray [str]
+ (local word [])
+ (each [w (str:gmatch "([^,]+)")] (table.insert word w))
+ word)
+
+(lambda tarray [arr]
+ (var string "")
+ (each [_ a (pairs arr)]
+ (set string (.. string "," a)))
+ string)
+
+(vim.api.nvim_create_user_command "Settings"
+ (fn [opts]
+ (var (option item rest) (opts.args:match "(%w+)%s*(%w+)(.*)"))
+ (var action 0) ; 0 = set, 1 = add, 2 = remove
+ (case item
+ (where n (= n "add")) (set action 1)
+ (where n (= n "remove")) (set action 2))
+
+ (when (= action 0) (tset _G.settings option (.. item " " rest)))
+ (when (= action 1) (tset _G.settings option (.. (. _G.settings option) rest)))
+ )
+ {:nargs 1 :complete (fn [arglead cmdline]
+ (local parsed [])
+ (each [o (string.gmatch cmdline "%S+")] (table.insert parsed o))
+ ;add an extra element when creating a new element
+ (when (= (cmdline:sub -1) " ") (table.insert parsed " "))
+
+ (case (# parsed)
+ (where n (= n 2)) (startswith options_k arglead)
+ (where n (and (= n 3) (?. options (. parsed 2) :array))) (startswith [:add :remove] arglead)
+ (where n (and (= n 4) (?. options (. parsed 2) :array) (= (. parsed 3) :remove))) (startswith (carray (. _G.settings (. parsed 2))) arglead)
+
+ (where n (and (>= n 3) (?. options (. parsed 2) :options)))
+ ;only one for now, not sure what else i would add besides functions
+ (case (type (. options (. parsed 2) :options))
+ (where n (= n "table")) (startswith (. options (. parsed 2) :options) arglead))
+
+ ))})
diff --git a/init.fnl b/init.fnl
index 3438c99..2ad3590 100644
--- a/init.fnl
+++ b/init.fnl
@@ -3,6 +3,7 @@
(packer-setup! {})
(global settings (require :settings))
+(require :settings-ui)
(when (~= (vim.fn.getenv :NVIM_DEBUG) :1)
(require :keybinds)
@@ -27,7 +28,7 @@
(use! :rcarriga/nvim-notify :require :plugins.notify)
(use! :akinsho/toggleterm.nvim :require :plugins.toggleterm)
(use! :nvim-telescope/telescope.nvim)
- (use! :matbme/JABS.nvim :config (util.setup! :jabs))
+ (use! :matbme/JABS.nvim :config (util.setup! :jabs {:use_devicons false}))
(use! :CRAG666/code_runner.nvim :config (util.setup! :code_runner))
(use! :sindrets/diffview.nvim)
@@ -82,6 +83,7 @@
(use! :williamboman/mason.nvim :config (util.setup! :mason))
;themes
+ (use! :kepano/flexoki-neovim)
(use! :kdheepak/monochrome.nvim)
(use! :nyoom-engineering/oxocarbon.nvim)
(use! :NTBBloodbath/doom-one.nvim)
diff --git a/lua/lua/lualine.lua b/lua/lua/lualine.lua
index db17d97..5737895 100644
--- a/lua/lua/lualine.lua
+++ b/lua/lua/lualine.lua
@@ -19,6 +19,10 @@ local colors = {
red = '#ec5f67',
}
+if _G.settings.trans == "enable" then
+ colors.bg = "none"
+end
+
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1