From b8f7b2909ebfa3d45e3adb195cef439c7ffa56b2 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Sat, 3 Apr 2021 16:14:56 +0200 Subject: [PATCH] fennel stuff --- fnl/init.fnl | 140 +++++++++++++++++++++++++++++------------------ fnl/keybinds.fnl | 25 ++++----- fnl/util.fnl | 13 ----- fnl/utils.fnl | 56 +++++++++++++++++++ init.vim | 7 ++- plugins.vim | 6 +- 6 files changed, 162 insertions(+), 85 deletions(-) delete mode 100644 fnl/util.fnl create mode 100644 fnl/utils.fnl diff --git a/fnl/init.fnl b/fnl/init.fnl index 4b90e51..56eb9d1 100644 --- a/fnl/init.fnl +++ b/fnl/init.fnl @@ -1,33 +1,33 @@ - -(module init +(module init {require {a aniseed.core - nvim aniseed.nvim} - require-macros [macros] - include {keybinds keybinds}}) + fennel aniseed.fennel + nvim aniseed.nvim + kb keybinds + utils utils} + require-macros [macros]}) + ;include {keybinds keybinds}}) + +(global pp + (fn [x] + (print (fennel.view x)))) (set nvim.g.conjure#client#fennel#aniseed#aniseed_module_prefix "aniseed.") -(local lsp (require "lspconfig")) -(local util lsp.util) -(local saga (require "lspsaga")) +(local lsp (require "lspconfig")) +(local saga (require "lspsaga")) (local compe (require "compe")) -(fn on_attach [client bufnr] - (if client.resolved_capabilities.document_highlight - (nvim.api.nvim_exec - "hi LspReferenceRead cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828' - hi LspReferenceText cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828' - hi LspReferenceWrite cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828' - augroup lsp_document_highlight - autocmd! * - autocmd CursorHold lua vim.lsp.buf.document_highlight() - autocmd CursorMoved lua vim.lsp.buf.clear_references() - augroup END - " - false))) +;(fn on_attach [client bufnr] + ;(if client.resolved_capabilities.document_highlight + ;(nvim.api.nvim_exec + ;"hi LspReferenceRead cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828' hi LspReferenceText cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828' hi LspReferenceWrite cterm=bold ctermbg=red guibg='#8ec07c' guifg='#282828' + ;augroup lsp_document_highlight + ;autocmd! * autocmd CursorHold lua vim.lsp.buf.document_highlight() autocmd CursorMoved lua vim.lsp.buf.clear_references() + ;augroup END " false))) +(fn on_attach [client bufnr] (print "hi")) (lsp.rust_analyzer.setup { :on_attach on_attach}) @@ -37,47 +37,81 @@ (lsp.bashls.setup { :on_attach on_attach}) (lsp.html.setup { :on_attach on_attach}) -(lsp.denols.setup - { :on_attach on_attach +(lsp.denols.setup { :on_attach on_attach :root_dir (lsp.util.root_pattern ".git")}) -(lsp.hls.setup - { :on_attach on_attach - :settings { :languageServerHaskell { :formattingProvider "stylish-haskell"}}}) - +(lsp.hls.setup { :on_attach on_attach} + :settings { :languageServerHaskell { :formattingProvider "stylish-haskell"}}) (compe.setup { :enabled true - :autocomplete true - :debug false - :min_length 1 - :preselect "enable" - :throttle_time 80 - :source_timeout 200 - :incomplete_delay 400 - :max_abbr_width 100 - :max_kind_width 100 - :max_menu_width 100 - :documentation true + :autocomplete false + :debug false + :min_length 1 + :preselect "enable" + :throttle_time 80 + :source_timeout 200 + :incomplete_delay 400 + :max_abbr_width 100 + :max_kind_width 100 + :max_menu_width 100 + :documentation true :source { :path true - :buffer true - :calc true - :nvim_lsp true - :nvim_lua true - :vsnip false}}) + :buffer true + :calc true + :nvim_lsp true + :nvim_lua true + :vsnip false}}) -(saga.init_lsp_saga +(saga.init_lsp_saga { :border_style 1 - :code_action_keys { :quit "" :exec ""} - :rename_action_keys { :quit "" :exec ""} - :finder_action_keys - { :quit "" - :open "" - :vsplit "v" - :split "b" - :scroll_up "" - :scroll_down ""}}) + :code_action_keys { :quit "" :exec ""} + :rename_action_keys { :quit "" :exec ""} + :finder_action_keys { :quit "" + :open "" + :vsplit "v" + :split "b" + :scroll_up "" + :scroll_down ""}} + + + (local galaxyline (require "galaxyline")) + (local colors (utils.colors))) + + +(local modes + { :n { :text "NORMAL" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :i { :text "INSERT" :colors { :bg colors.neutral_yellow :fg colors.dark0}} + :c { :text "CMD" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :ce { :text "NORMEX" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :cv { :text "EX" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :ic { :text "INSCOMP" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :no { :text "OP-PENDING" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :r { :text "HIT-ENTER" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :r? { :text "CONFIRM" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :R { :text "REPLACE" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :Rv { :text "VIRTUAL" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :s { :text "SELECT" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :S { :text "SELECT" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :t { :text "TERM" :colors { :bg colors.neutral_aqua :fg colors.dark0}} + :v { :text "VISUAL" :colors { :bg colors.neutral_blue :fg colors.dark0}} + :V { :text "VISUAL LINE" :colors { :bg colors.neutral_blue :fg colors.dark0}} + "" { :text "VISUAL BLOCK" :colors { :bg colors.neutral_blue :fg colors.dark0}}}) +(fn viModeProvider [] + (let [modedata (or (. modes (nvim.fn.mode)) + { :text (nvim.fn.mode) :colors {:bg colors.neutral_orange :fg colors.dark0}})] + (utils.highlight "GalaxyViMode" modedata.colors) + modedata.text)) + + +(tset galaxyline.section.left 1 + { :ViMode { :provider viModeProvider :icon " "}}) + +(tset galaxyline.section.left 2 + { :FileSize { :provider "FileSize"}}) + + diff --git a/fnl/keybinds.fnl b/fnl/keybinds.fnl index 763f688..73ae455 100644 --- a/fnl/keybinds.fnl +++ b/fnl/keybinds.fnl @@ -1,21 +1,18 @@ (module keybinds {require {a aniseed.core nvim aniseed.nvim - util util} + utils utils + fennel aniseed.fennel} require-macros [macros]}) +(utils.noremap :n : ":WhichKey ''") +(utils.noremap :v : ":WhichKeyVisual ''") -(util.noremap :n : ":WhichKey ''") -(util.noremap :v : ":WhichKeyVisual ''") +(utils.mapexpr :i : "compe#complete()") +(utils.mapexpr :i : "compe#confirm('')") +(utils.mapexpr :i : "compe#complete('')") - -(util.mapexpr :i : "compe#complete()") -(util.mapexpr :i : "compe#confirm('')") -(util.mapexpr :i : "compe#complete('')") - - - -(fn le [s] (.. ":call luaeval \"" s "\")")) +(fn le [s] (.. ":call luaeval(\"" s "\")")) (set nvim.g.which_key_map {}) (nvim.command "call which_key#register('', \"g:which_key_map\")") @@ -68,11 +65,9 @@ (set nvim.o.timeoutlen 200) + + ; TODO ; autocmd! VimEnter * :unmap ig ; autocmd! FileType which_key) - - - - diff --git a/fnl/util.fnl b/fnl/util.fnl deleted file mode 100644 index 4902e0b..0000000 --- a/fnl/util.fnl +++ /dev/null @@ -1,13 +0,0 @@ -(module util - {require {a aniseed.core - nvim aniseed.nvim} - require-macros [macros]}) - -(defn noremap [mode from to] - "Sets a mapping with {:noremap true :silent true}." - (nvim.set_keymap mode from to {:noremap true :silent true})) - -(defn mapexpr [mode from to] - "Sets a mapping with {:noremap true :silent true :expr true}." - (nvim.set_keymap mode from to {:noremap true :silent true :expr true})) - diff --git a/fnl/utils.fnl b/fnl/utils.fnl new file mode 100644 index 0000000..b1f33e2 --- /dev/null +++ b/fnl/utils.fnl @@ -0,0 +1,56 @@ +(module utils + {require {a aniseed.core + nvim aniseed.nvim} + require-macros [macros]}) + +(defn noremap [mode from to] + "Sets a mapping with {:noremap true :silent true}." + (nvim.set_keymap mode from to {:noremap true :silent true})) + +(defn mapexpr [mode from to] + "Sets a mapping with {:noremap true :silent true :expr true}." + (nvim.set_keymap mode from to {:noremap true :silent true :expr true})) + + + +(defn colors [] + { :dark0_hard "#1d2021" + :dark0 "#282828" + :dark0_soft "#32302f" + :dark1 "#3c3836" + :dark2 "#504945" + :dark3 "#665c54" + :dark4 "#7c6f64" + :light0_hard "#f9f5d7" + :light0 "#fbf1c7" + :light0_soft "#f2e5bc" + :light1 "#ebdbb2" + :light2 "#d5c4a1" + :light3 "#bdae93" + :light4 "#a89984" + :bright_red "#fb4934" + :bright_green "#b8bb26" + :bright_yellow "#fabd2f" + :bright_blue "#83a598" + :bright_purple "#d3869b" + :bright_aqua "#8ec07c" + :bright_orange "#fe8019" + :neutral_red "#cc241d" + :neutral_green "#98971a" + :neutral_yellow "#d79921" + :neutral_blue "#458588" + :neutral_purple "#b16286" + :neutral_aqua "#689d6a" + :neutral_orange "#d65d0e" + :faded_red "#9d0006" + :faded_green "#79740e" + :faded_yellow "#b57614" + :faded_blue "#076678" + :faded_purple "#8f3f71" + :faded_aqua "#427b58" + :faded_orange "#af3a03" + :gray "#928374"}) + + +(defn highlight [group colset] + (nvim.command (.. "hi " group " guifg='" colset.fg "' guibg='" colset.bg "'"))) diff --git a/init.vim b/init.vim index e9db202..8f517ec 100644 --- a/init.vim +++ b/init.vim @@ -350,13 +350,12 @@ nnoremap รถ a source $VIM_ROOT/whichkeyConfig.vim -luafile $VIM_ROOT/lsp.lua +"luafile $VIM_ROOT/lsp.lua "source $VIM_ROOT/lsp.vim let g:aniseed#env = v:true - "inoremap compe#complete() "inoremap compe#confirm('') "inoremap compe#close('') @@ -364,3 +363,7 @@ let g:aniseed#env = v:true "nnoremap lua require('lspsaga.action').smart_scroll_with_saga(1) "nnoremap lua require('lspsaga.action').smart_scroll_with_saga(-1) + + + + diff --git a/plugins.vim b/plugins.vim index e43797e..b0926d7 100644 --- a/plugins.vim +++ b/plugins.vim @@ -31,8 +31,10 @@ call plug#begin('~/.vim/plugged') Plug 'preservim/nerdcommenter' - Plug 'vim-airline/vim-airline-themes' - Plug 'vim-airline/vim-airline' + Plug 'glepnir/galaxyline.nvim' + + "Plug 'vim-airline/vim-airline-themes' + "Plug 'vim-airline/vim-airline' " buffer line if has('nvim')