diff options
| author | Mike Vink <> | 2023-03-31 20:34:31 +0200 |
|---|---|---|
| committer | Mike Vink <> | 2023-03-31 20:34:31 +0200 |
| commit | eb4b9bbfada4c52c38b979735e21fc3bf770f92b (patch) | |
| tree | c210e69cad77a2cc7e8bdc46f74fd194795fc33a | |
| parent | f2b07d71fc4984cf542978c9cbb265b311edb488 (diff) | |
fixup
| -rw-r--r-- | fnl/conf/pkgs/cmp.fnl | 3 | ||||
| -rw-r--r-- | fnl/conf/pkgs/dap.fnl | 38 | ||||
| -rw-r--r-- | fnl/conf/pkgs/heirline.fnl | 58 | ||||
| -rw-r--r-- | fnl/conf/pkgs/lspconfig.fnl | 18 |
4 files changed, 100 insertions, 17 deletions
diff --git a/fnl/conf/pkgs/cmp.fnl b/fnl/conf/pkgs/cmp.fnl index 5efb74a..4368a8e 100644 --- a/fnl/conf/pkgs/cmp.fnl +++ b/fnl/conf/pkgs/cmp.fnl @@ -32,8 +32,7 @@ :<C-f> (cmp.mapping.scroll_docs 4) :<C-A> (cmp.mapping.complete) :<C-y> (cmp.mapping.confirm {:select true})} - :sources (cmp.config.sources [{:name :conjure} - {:name :nvim_lsp} + :sources (cmp.config.sources [{:name :nvim_lsp} {:name :path} {:name :luasnip}])}) (if (not autocomplete) (tset cfg :completion {:autocomplete false})) diff --git a/fnl/conf/pkgs/dap.fnl b/fnl/conf/pkgs/dap.fnl index 429527e..7ff79fc 100644 --- a/fnl/conf/pkgs/dap.fnl +++ b/fnl/conf/pkgs/dap.fnl @@ -10,13 +10,17 @@ :executable {:command :dlv :args [:dap :-l "127.0.0.1:${port}"]}}) (tset configurations :go - [{:type :delve :name :Debug :request :launch :program "${fileDirname}"} + [{:type :delve + :name :Debug + :request :launch + :env {:CGO_CFLAGS :-Wno-error=cpp} + :program "${fileDirname}"} {:type :delve :name :DebugTest :request :launch :mode :test :env {:CGO_CFLAGS :-Wno-error=cpp} - :program "${file}"} + :program "${fileDirname}"} {:type :delve :name :DebugTerraform :request :launch @@ -36,17 +40,25 @@ :env {:CGO_CFLAGS :-Wno-error=cpp} :program "${relativeFileDirname}"}]) -(let [venv (os.getenv :VIRTUAL_ENV)] - (when venv - (tset adapters :python - {:type :executable - :command (.. venv :/bin/python) - :args [:-m :debugpy.adapter]}) - (tset configurations :python - [{:type :python :request :launch :name :file :program "${file}"}]))) +(dapui.setup {:expand_lines false}) -(dapui.setup) -(vim.keymap.set :n :<leader>dui dapui.toggle {:silent true}) +(vim.keymap.set :n :si (lambda [] + (dapui.toggle {:reset true})) {:silent true}) +;; "breakpoints", +;; "repl", +;; "scopes", +;; "stacks", +;; "watches", +;; "hover", +;; "console",) +(vim.keymap.set :n :sfw + (lambda [] + (dapui.float_element :watches + {:width (vim.api.nvim_win_get_width 0) :height 30 :enter true}))) +(vim.keymap.set :n :sfs + (lambda [] + (dapui.float_element :scopes + {:width (vim.api.nvim_win_get_width 0) :height 30 :enter true}))) (vim.keymap.set :n :sq dap.terminate {:silent true}) (vim.keymap.set :n :sc dap.continue {:silent true}) @@ -62,5 +74,5 @@ (vim.fn.input "Log point message: "))) {:silent true}) -(vim.keymap.set :n :st dap.repl.open {:silent true}) +(vim.keymap.set :n :st dap.repl.toggle {:silent true}) (vim.keymap.set :n :sl dap.run_last {:silent true}) diff --git a/fnl/conf/pkgs/heirline.fnl b/fnl/conf/pkgs/heirline.fnl index 70e3121..e990ba4 100644 --- a/fnl/conf/pkgs/heirline.fnl +++ b/fnl/conf/pkgs/heirline.fnl @@ -1,4 +1,60 @@ (local heirline (require :heirline)) -(local colors (let [kanagawa-colors (require :kanagawa.colors)] (kanagawa-colors.setup))) +(local conditions (require :heirline.conditions)) +(local utils (require :heirline.utils)) +(local colors (let [kanagawa-colors (require :kanagawa.colors)] + (kanagawa-colors.setup))) (heirline.load_colors colors) +(fn palette [name] + (. (. colors :palette) name)) + +(fn theme [theme name] + (. (. (. colors :theme) theme) name)) + +(var FileNameBlock + {;; let's first set up some attributes needed by this component and it's children + :init (lambda [self] + (tset self :filename (vim.api.nvim_buf_get_name 0)))}) + +(local FileName + {:provider (lambda [self] + ;; first, trim the pattern relative to the current directory. For other + ;;- options, see :h filename-modifers + (var filename (vim.fn.fnamemodify (. self :filename) ":.")) + (if (= filename "") + (set filename "[No Name]") + ;;- now, if the filename would occupy more than 1/4th of the available + ;;-- space, we trim the file path to its initials + ;;-- See Flexible Components section below for dynamic truncation + (if (not (conditions.width_percent_below (length filename) + 0.25)) + (set filename (vim.fn.pathshorten filename)))) + filename) + :hl {:fg (. (utils.get_highlight :Directory) :fg)}}) + +(local FileNameModifier {:hl (lambda [] + (when vim.bo.modified + {:fg (theme :diag :warning) + :bold true + :force true}))}) + +(local FileFlags [{:condition (lambda [] vim.bo.modified) + :provider "[+]" + :hl {:fg (theme :diag :warning)}}]) + +(set FileNameBlock (utils.insert FileNameBlock + (utils.insert FileNameModifier FileName) + FileFlags {:provider "%<"})) + +(local DAPMessages {:condition (lambda [] + (local dap (require :dap)) + (local session (dap.session)) + (not (= session nil))) + :provider (lambda [] + (local dap (require :dap)) + (.. " " (dap.status))) + :hl :Debug}) + +(local Statusline [FileNameBlock DAPMessages]) + +(heirline.setup {:statusline Statusline}) diff --git a/fnl/conf/pkgs/lspconfig.fnl b/fnl/conf/pkgs/lspconfig.fnl index 518e1f7..5cdd550 100644 --- a/fnl/conf/pkgs/lspconfig.fnl +++ b/fnl/conf/pkgs/lspconfig.fnl @@ -1,4 +1,5 @@ (local lspconfig (require :lspconfig)) +(local configs (require :lspconfig.configs)) (local {: attach} (require :conf.lsp)) (lspconfig.pyright.setup {:root_dir (lspconfig.util.root_pattern :.git @@ -12,4 +13,19 @@ (lspconfig.gopls.setup {:root_dir (lspconfig.util.root_pattern :.git (vim.fn.getcwd)) :on_attach attach - :settings {:gopls {:buildFlags ["-tags=all"]}}}) + :settings {:gopls {:buildFlags [:-tags=all]}}}) + +(tset configs :fennel_language_server + {:default_config {;; replace it with true path + :cmd [:fennel-language-server] + :filetypes [:fennel] + :single_file_support true + ;; source code resides in directory `fnl/` + :root_dir (lspconfig.util.root_pattern :fnl) + :settings {:fennel {:workspace {;; If you are using hotpot.nvim or aniseed, + ;; make the server aware of neovim runtime files. + :library (vim.api.nvim_list_runtime_paths)} + :diagnostics {:globals [:vim]}}}}}) + + +(lspconfig.fennel_language_server.setup {:on_attach attach}) |
