fennel stuff

This commit is contained in:
elkowar 2021-04-03 16:14:56 +02:00
parent 8288adf664
commit b8f7b2909e
6 changed files with 162 additions and 85 deletions

View file

@ -1,33 +1,33 @@
(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 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! * <buffer>
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> 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! * <buffer> autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight() autocmd CursorMoved <buffer> 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,17 +37,14 @@
(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
:autocomplete false
:debug false
:min_length 1
:preselect "enable"
@ -70,14 +67,51 @@
{ :border_style 1
:code_action_keys { :quit "<esc>" :exec "<CR>"}
:rename_action_keys { :quit "<esc>" :exec "<CR>"}
:finder_action_keys
{ :quit "<esc>"
:open "<CR>"
:vsplit "v"
:split "b"
:scroll_up "<C-u>"
:scroll_down "<C-d>"}})
:finder_action_keys { :quit "<esc>"
:open "<CR>"
:vsplit "v"
:split "b"
:scroll_up "<C-u>"
:scroll_down "<C-d>"}}
(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"}})

View file

@ -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 :<leader> ":<c-u>WhichKey '<Space>'<CR>")
(utils.noremap :v :<leader> ":<c-u>WhichKeyVisual '<Space>'<CR>")
(util.noremap :n :<leader> ":<c-u>WhichKey '<Space>'<CR>")
(util.noremap :v :<leader> ":<c-u>WhichKeyVisual '<Space>'<CR>")
(utils.mapexpr :i :<C-Space> "compe#complete()")
(utils.mapexpr :i :<CR> "compe#confirm('<CR>')")
(utils.mapexpr :i :<esc> "compe#complete('<esc>')")
(util.mapexpr :i :<C-Space> "compe#complete()")
(util.mapexpr :i :<CR> "compe#confirm('<CR>')")
(util.mapexpr :i :<esc> "compe#complete('<esc>')")
(fn le [s] (.. ":call luaeval \"" s "\")"))
(fn le [s] (.. ":call luaeval(\"" s "\")"))
(set nvim.g.which_key_map {})
(nvim.command "call which_key#register('<Space>', \"g:which_key_map\")")
@ -68,11 +65,9 @@
(set nvim.o.timeoutlen 200)
; TODO
; autocmd! VimEnter * :unmap <space>ig
; autocmd! FileType which_key)

View file

@ -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}))

56
fnl/utils.fnl Normal file
View file

@ -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 "'")))

View file

@ -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 <silent><expr> <C-Space> compe#complete()
"inoremap <silent><expr> <CR> compe#confirm('<CR>')
"inoremap <silent><expr> <esc> compe#close('<esc>')
@ -364,3 +363,7 @@ let g:aniseed#env = v:true
"nnoremap <silent> <C-d> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>
"nnoremap <silent> <C-u> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>

View file

@ -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')