diff --git a/fnl/init.fnl b/fnl/init.fnl index c9f45b8..b7f2661 100644 --- a/fnl/init.fnl +++ b/fnl/init.fnl @@ -7,9 +7,7 @@ gl plugins.galaxyline lsp plugins.lsp} require-macros [macros]}) - ;include {keybinds keybinds }}) -(local colors (utils.colors)) (global pp (fn [x] @@ -19,6 +17,7 @@ +(local colors (utils.colors)) (local bufferline (require "bufferline")) ; :h bufferline-lua-highlights diff --git a/fnl/keybinds.fnl b/fnl/keybinds.fnl index 73ae455..0345beb 100644 --- a/fnl/keybinds.fnl +++ b/fnl/keybinds.fnl @@ -5,12 +5,13 @@ fennel aniseed.fennel} require-macros [macros]}) + (utils.noremap :n : ":WhichKey ''") (utils.noremap :v : ":WhichKeyVisual ''") (utils.mapexpr :i : "compe#complete()") -(utils.mapexpr :i : "compe#confirm('')") -(utils.mapexpr :i : "compe#complete('')") +(utils.mapexpr :i : "compe#confirm(lexima#expand('CR>', 'i'))") +(utils.mapexpr :i : "compe#close('')") (fn le [s] (.. ":call luaeval(\"" s "\")")) @@ -61,7 +62,12 @@ "n" [":set relativenumber!" "toggle relative numbers"] "m" [":set nonumber! norelativenumber" "toggle numbers"] "g" [":Goyo | set linebreak" "toggle focus mode"] - "i" [":IndentGuidesToggle" "toggle indent guides"]}}) + "i" [":IndentGuidesToggle" "toggle indent guides"]} + + "b" { :name "+buffers" + "b" [":Buffers" "select open buffer"] + "c" [":bdelete!" "close open buffer"] + "w" [":bwipeout!" "wipeout open buffer"]}}) (set nvim.o.timeoutlen 200) diff --git a/fnl/plugins/galaxyline.fnl b/fnl/plugins/galaxyline.fnl index 8dcf563..427b31f 100644 --- a/fnl/plugins/galaxyline.fnl +++ b/fnl/plugins/galaxyline.fnl @@ -34,20 +34,9 @@ "" { :text "VISUAL BLOCK" :colors { :bg colors.neutral_blue :fg colors.dark0}}}) - -(fn get-mode-data [] - (or (. modes (nvim.fn.mode)) - { :text (nvim.fn.mode) - :colors {:bg colors.neutral_orange :fg colors.dark0}})) - (fn buf-empty? [] (= 1 (nvim.fn.empty (nvim.fn.expand "%:t")))) -(fn checkwidth [] - (and (< 35 (/ (nvim.fn.winwidth 0) 2)) - (not buf-empty?))) - - (fn get-current-file-name [] (let [file (nvim.fn.expand "%:t")] (if @@ -55,6 +44,16 @@ nvim.bo.readonly (.. "RO " file) (and nvim.bo.modifiable nvim.bo.modified) (.. file " ") file))) + +(fn get-mode-data [] + (or (. modes (nvim.fn.mode)) + { :text (nvim.fn.mode) + :colors {:bg colors.neutral_orange :fg colors.dark0}})) + +(fn vim-mode-provider [] + (let [modedata (get-mode-data)] + (utils.highlight "GalaxyViMode" modedata.colors) + (.. " " modedata.text " "))) (utils.highlight "StatusLine" {:bg colors.dark1 :fg colors.light0 }) @@ -62,47 +61,38 @@ (set galaxyline.section.left - [ { :ViMode { :provider - (fn [] - (let [modedata (get-mode-data)] - (utils.highlight "GalaxyViMode" modedata.colors) - (.. " " modedata.text " "))) }} - + [ { :ViMode { :provider vim-mode-provider}} { :FileName { :provider get-current-file-name - :highlight [colors.light4 colors.dark1] }} + :highlight [colors.light4 colors.dark1]}} { :Space { :provider (fn [] "") - :highlight [colors.light0 colors.dark1] }}]) - + :highlight [colors.light0 colors.dark1]}}]) -(fn provider-lsp-diag [kind] +(fn make-lsp-diagnostic-provider [kind] (fn [] (let [n (vim.lsp.diagnostic.get_count 0 kind)] - (if - (= n 0) "" - (.. " " n " "))))) + (if (= n 0) "" (.. " " n " "))))) +(fn git-branch-provider [] + (let [branch (gl-vcs.get_git_branch)] + (if (= "master" branch) "" branch))) + (set galaxyline.section.right - [ { :GitBranch { :provider (fn [] - (let [branch (gl-vcs.get_git_branch)] - (if (= "master" branch) "" branch))) - :highlight [colors.light4 colors.dark1] }} + [ { :GitBranch { :provider git-branch-provider + :highlight [colors.light4 colors.dark1]}} { :FileType { :provider (fn [] nvim.bo.filetype) - :highlight [colors.neutral_aqua colors.dark1] }} + :highlight [colors.neutral_aqua colors.dark1]}} - { :DiagnosticInfo { :provider (provider-lsp-diag "Info") - :highlight [colors.dark1 colors.neutral_blue] }} - { :DiagnosticWarn { :provider (provider-lsp-diag "Warning") + { :DiagnosticInfo { :provider (make-lsp-diagnostic-provider "Info") + :highlight [colors.dark1 colors.neutral_blue]}} + { :DiagnosticWarn { :provider (make-lsp-diagnostic-provider "Warning") :highlight [colors.dark1 colors.neutral_yellow] - :separator "" }} - { :DiagnosticError { :provider (provider-lsp-diag "Error") + :separator ""}} + { :DiagnosticError { :provider (make-lsp-diagnostic-provider "Error") :highlight [colors.dark1 colors.bright_red] - :separator "" }} + :separator ""}} { :LineInfo { :provider (fn [] (.. " " (gl-fileinfo.line_column) " ")) :highlight "GalaxyViMode" - :separator "" }}]) - - - + :separator ""}}]) (do (fn add-segment-defaults [data] diff --git a/fnl/plugins/lsp.fnl b/fnl/plugins/lsp.fnl index 030cdf6..398a679 100644 --- a/fnl/plugins/lsp.fnl +++ b/fnl/plugins/lsp.fnl @@ -54,7 +54,7 @@ :calc true :nvim_lsp true :nvim_lua true - :vsnip false }}) + :vsnip false}}) (saga.init_lsp_saga diff --git a/init.vim b/init.vim index 8f517ec..7f58234 100644 --- a/init.vim +++ b/init.vim @@ -356,6 +356,9 @@ source $VIM_ROOT/whichkeyConfig.vim let g:aniseed#env = v:true +let g:lexima_no_default_rules = v:true +call lexima#set_default_rules() + "inoremap compe#complete() "inoremap compe#confirm('') "inoremap compe#close('') diff --git a/plugins.vim b/plugins.vim index 0cca160..7a8e150 100644 --- a/plugins.vim +++ b/plugins.vim @@ -138,7 +138,7 @@ call plug#begin('~/.vim/plugged') Plug 'bakpakin/fennel.vim' Plug 'tjdevries/nlua.nvim' - Plug 'nvim-lua/completion-nvim' + "Plug 'nvim-lua/completion-nvim' "Plug 'mxw/vim-prolog'