more config

This commit is contained in:
elkowar 2021-04-03 21:21:12 +02:00
parent 01158f6a26
commit ed20de4485
6 changed files with 44 additions and 46 deletions

View file

@ -7,9 +7,7 @@
gl plugins.galaxyline gl plugins.galaxyline
lsp plugins.lsp} lsp plugins.lsp}
require-macros [macros]}) require-macros [macros]})
;include {keybinds keybinds }})
(local colors (utils.colors))
(global pp (global pp
(fn [x] (fn [x]
@ -19,6 +17,7 @@
(local colors (utils.colors))
(local bufferline (require "bufferline")) (local bufferline (require "bufferline"))
; :h bufferline-lua-highlights ; :h bufferline-lua-highlights

View file

@ -5,12 +5,13 @@
fennel aniseed.fennel} fennel aniseed.fennel}
require-macros [macros]}) require-macros [macros]})
(utils.noremap :n :<leader> ":<c-u>WhichKey '<Space>'<CR>") (utils.noremap :n :<leader> ":<c-u>WhichKey '<Space>'<CR>")
(utils.noremap :v :<leader> ":<c-u>WhichKeyVisual '<Space>'<CR>") (utils.noremap :v :<leader> ":<c-u>WhichKeyVisual '<Space>'<CR>")
(utils.mapexpr :i :<C-Space> "compe#complete()") (utils.mapexpr :i :<C-Space> "compe#complete()")
(utils.mapexpr :i :<CR> "compe#confirm('<CR>')") (utils.mapexpr :i :<CR> "compe#confirm(lexima#expand('<LT>CR>', 'i'))")
(utils.mapexpr :i :<esc> "compe#complete('<esc>')") (utils.mapexpr :i :<esc> "compe#close('<esc>')")
(fn le [s] (.. ":call luaeval(\"" s "\")")) (fn le [s] (.. ":call luaeval(\"" s "\")"))
@ -61,7 +62,12 @@
"n" [":set relativenumber!" "toggle relative numbers"] "n" [":set relativenumber!" "toggle relative numbers"]
"m" [":set nonumber! norelativenumber" "toggle numbers"] "m" [":set nonumber! norelativenumber" "toggle numbers"]
"g" [":Goyo | set linebreak" "toggle focus mode"] "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) (set nvim.o.timeoutlen 200)

View file

@ -34,20 +34,9 @@
"" { :text "VISUAL BLOCK" :colors { :bg colors.neutral_blue :fg colors.dark0}}}) "" { :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? [] (fn buf-empty? []
(= 1 (nvim.fn.empty (nvim.fn.expand "%:t")))) (= 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 [] (fn get-current-file-name []
(let [file (nvim.fn.expand "%:t")] (let [file (nvim.fn.expand "%:t")]
(if (if
@ -56,54 +45,55 @@
(and nvim.bo.modifiable nvim.bo.modified) (.. file " ") (and nvim.bo.modifiable nvim.bo.modified) (.. file " ")
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 }) (utils.highlight "StatusLine" {:bg colors.dark1 :fg colors.light0 })
(set galaxyline.short_line_list ["dbui" "diff" "peekaboo" "undotree" "vista" "vista_markdown"]) (set galaxyline.short_line_list ["dbui" "diff" "peekaboo" "undotree" "vista" "vista_markdown"])
(set galaxyline.section.left (set galaxyline.section.left
[ { :ViMode { :provider [ { :ViMode { :provider vim-mode-provider}}
(fn []
(let [modedata (get-mode-data)]
(utils.highlight "GalaxyViMode" modedata.colors)
(.. " " modedata.text " "))) }}
{ :FileName { :provider get-current-file-name { :FileName { :provider get-current-file-name
:highlight [colors.light4 colors.dark1]}} :highlight [colors.light4 colors.dark1]}}
{ :Space { :provider (fn [] "") { :Space { :provider (fn [] "")
:highlight [colors.light0 colors.dark1]}}]) :highlight [colors.light0 colors.dark1]}}])
(fn make-lsp-diagnostic-provider [kind]
(fn provider-lsp-diag [kind]
(fn [] (fn []
(let [n (vim.lsp.diagnostic.get_count 0 kind)] (let [n (vim.lsp.diagnostic.get_count 0 kind)]
(if (if (= n 0) "" (.. " " n " ")))))
(= n 0) ""
(.. " " n " ")))))
(set galaxyline.section.right (fn git-branch-provider []
[ { :GitBranch { :provider (fn []
(let [branch (gl-vcs.get_git_branch)] (let [branch (gl-vcs.get_git_branch)]
(if (= "master" branch) "" branch))) (if (= "master" branch) "" branch)))
(set galaxyline.section.right
[ { :GitBranch { :provider git-branch-provider
:highlight [colors.light4 colors.dark1]}} :highlight [colors.light4 colors.dark1]}}
{ :FileType { :provider (fn [] nvim.bo.filetype) { :FileType { :provider (fn [] nvim.bo.filetype)
:highlight [colors.neutral_aqua colors.dark1]}} :highlight [colors.neutral_aqua colors.dark1]}}
{ :DiagnosticInfo { :provider (provider-lsp-diag "Info") { :DiagnosticInfo { :provider (make-lsp-diagnostic-provider "Info")
:highlight [colors.dark1 colors.neutral_blue]}} :highlight [colors.dark1 colors.neutral_blue]}}
{ :DiagnosticWarn { :provider (provider-lsp-diag "Warning") { :DiagnosticWarn { :provider (make-lsp-diagnostic-provider "Warning")
:highlight [colors.dark1 colors.neutral_yellow] :highlight [colors.dark1 colors.neutral_yellow]
:separator ""}} :separator ""}}
{ :DiagnosticError { :provider (provider-lsp-diag "Error") { :DiagnosticError { :provider (make-lsp-diagnostic-provider "Error")
:highlight [colors.dark1 colors.bright_red] :highlight [colors.dark1 colors.bright_red]
:separator ""}} :separator ""}}
{ :LineInfo { :provider (fn [] (.. " " (gl-fileinfo.line_column) " ")) { :LineInfo { :provider (fn [] (.. " " (gl-fileinfo.line_column) " "))
:highlight "GalaxyViMode" :highlight "GalaxyViMode"
:separator ""}}]) :separator ""}}])
(do (do
(fn add-segment-defaults [data] (fn add-segment-defaults [data]
(a.merge { :highlight [colors.light0 colors.dark1] (a.merge { :highlight [colors.light0 colors.dark1]

View file

@ -356,6 +356,9 @@ source $VIM_ROOT/whichkeyConfig.vim
let g:aniseed#env = v:true let g:aniseed#env = v:true
let g:lexima_no_default_rules = v:true
call lexima#set_default_rules()
"inoremap <silent><expr> <C-Space> compe#complete() "inoremap <silent><expr> <C-Space> compe#complete()
"inoremap <silent><expr> <CR> compe#confirm('<CR>') "inoremap <silent><expr> <CR> compe#confirm('<CR>')
"inoremap <silent><expr> <esc> compe#close('<esc>') "inoremap <silent><expr> <esc> compe#close('<esc>')

View file

@ -138,7 +138,7 @@ call plug#begin('~/.vim/plugged')
Plug 'bakpakin/fennel.vim' Plug 'bakpakin/fennel.vim'
Plug 'tjdevries/nlua.nvim' Plug 'tjdevries/nlua.nvim'
Plug 'nvim-lua/completion-nvim' "Plug 'nvim-lua/completion-nvim'
"Plug 'mxw/vim-prolog' "Plug 'mxw/vim-prolog'