This commit is contained in:
ElKowar 2023-03-13 13:03:03 +01:00 committed by elkowar
parent 29ad561a5b
commit ee3e5be43c
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F
10 changed files with 35 additions and 285 deletions

View file

@ -23,7 +23,7 @@
grv 1 2 3 4 5 6 7 8 9 0 - = bspc ins home pgup
tab q w e r t y u i o p [ ] ret del end pgdn
caps a s d f g h j k l ; ' \
lsft 102d z x c v b n m , . / rsft up
lsft 102d z x c v b n m , . - rsft up
lctl lmet lalt spc ralt rctl cmp rctl left down rght
)

View file

@ -1,257 +0,0 @@
if exists("b:did_ftplugin")
finish
endif
setlocal shiftwidth=2
setlocal tabstop=2
setlocal expandtab
setlocal comments=s1:(*,mb:*,ex:*)
setlocal commentstring=(*\ %s\ *)
let b:did_ftplugin = 1
if has('nvim-0.3.2')
let s:vtext_ns = nvim_create_namespace('amulet')
endif
let b:autostart_amc = has('nvim') ? 1 : 0
let b:amc_deps = []
hi! AmuletError cterm=underline ctermfg=red
hi! AmuletWarn cterm=underline ctermfg=yellow
hi! AmuletNote cterm=underline ctermfg=cyan
hi! AmuletErrorVtxt ctermfg=red cterm=italic
hi! AmuletWarnVtxt ctermfg=yellow cterm=italic
hi! AmuletNoteVtxt ctermfg=cyan cterm=italic
sign define amuletError text=! texthl=AmuletError
sign define amuletWarning text=* texthl=AmuletWarn
sign define amuletNote text=* texthl=AmuletNote
function! s:HighlightRange(group, line, start_col, length)
" Vim columns are 1-indexed, but nvim's are 0-indexed
if has('nvim-0.3.2')
let start_col = str2nr(a:start_col) - 1
let end_col = str2nr(a:length) + start_col
let line = str2nr(a:line) - 1
call nvim_buf_add_highlight(bufnr(''), s:vtext_ns, a:group, line, start_col, end_col)
else
call matchaddpos(a:group, [ [a:line, a:start_col, a:length] ])
end
endfunction
function! AmuletStart(...)
if has('nvim')
if exists("b:amulet_pid")
return 0
end
let b:amulet_pid = jobstart(["amc", "repl", "--port", a:0 == 1 ? a:1 : 6000])
let b:amulet_port = a:0 == 1 ? a:1 : 6000
else
echo "Having vim manage the compiler is only supported on nvim"
end
endfunction
function! AmuletStop()
if has('nvim')
if exists("b:amulet_pid")
call jobstop(b:amulet_pid)
unlet b:amulet_pid b:amulet_port
end
else
echo "Having vim manage the compiler is only supported on nvim"
end
endfunction
function! s:CallAmc(...)
let cmd = shellescape(join(a:000))
if exists("b:amulet_pid")
let cmd = cmd . " --port " . b:amulet_port
endif
let res = system('amc connect ' . cmd)
if res =~ "Failed to connect to server on port"
throw "Couldn't connect to a running amc"
elseif res =~ "Invalid option `--client`"
throw "Installed version of amc doesn't have client/server support"
else
return res
endif
endfunction
" Trashes both qflist and matches
function! AmuletLoad(verbose, qf)
let our_bufnr = bufnr('')
let ourpos = getpos('.')
silent write
call clearmatches()
call setqflist([])
let file = expand("%:p")
try
let out = split(call("s:CallAmc", [":l", file]), '\n')
catch /version/
echo "Your version of amc is too old to have client/server support"
catch /amc/
echo "Failed to connect to a running amc"
return -1
endtry
let err_msg_pat = "\\v(error|warning|note)( \\([EWN][0-9]{4}\\))?$"
let nerrors = 0
let nwarns = 0
execute "sign unplace * file=" . expand("%p")
if has('nvim-0.3.2')
call nvim_buf_clear_namespace(0, s:vtext_ns, 0, -1)
endif
if len(out) > 1
let idx = 0
while idx < len(out)
let line = out[idx]
if line =~ err_msg_pat
let err_msg_idx = idx + 1
while match(out[err_msg_idx], "\\v([0-9]+)?\\s*\u2502") == 0
let err_msg_idx += 1
endwhile
let next = match(out[err_msg_idx:], err_msg_pat)
if next == -1
let next = len(out)
else
let next += err_msg_idx
endif
let range = matchlist(line, "\\v\\[([0-9]+):([0-9]+) ..([0-9]+):([0-9]+)")
let lineno = range[1]
let err_msg = out[err_msg_idx]
if err_msg_idx == idx + 1
let idx += 1
else
let err_msg = join(map(out[err_msg_idx:next - 1], "trim(v:val)"))
let idx = next
endif
caddexpr expand("%:p") . ":" . lineno . ":" . err_msg
let group = (match(line, "warning") != -1) ? "AmuletWarn" : (match(line, "note$") != -1) ? "AmuletNote" : "AmuletError"
let sign = (match(line, "warning") != -1) ? "amuletWarning" : (match(line, "note$") != -1) ? "amuletNote" : "amuletError"
for l in range(range[1], range[3])
execute "sign place " . (idx + l) . " line=" . l . " name=" . sign
endfor
if range[1] == range[3]
call s:HighlightRange(group, lineno, range[2], range[4] - range[2] + 1)
if has('nvim-0.3.2')
call nvim_buf_set_virtual_text(0, s:vtext_ns, str2nr(lineno - 1), [[err_msg, group . "Vtxt"]], {})
endif
endif
if match(line, "warning$") != -1
let nwarns += 1
else
let nerrors += 1
end
else
let idx += 1
endif
endwhile
let errs = (nerrors == 1) ? "error" : "errors"
let warns = (nwarns == 1) ? "warning" : "warnings"
if (nerrors == 0) && a:verbose
echo "Beware: " . nwarns . " " . warns
elseif nerrors != 0
echo "Compilation failed with " . nerrors . " " . errs . " and " . nwarns . " " . warns
end
if (nerrors != 0 || nwarns != 0) && a:qf == 'qf'
copen
end
call setpos('.', ourpos)
return nerrors
else
if a:verbose
echo "Loaded " . expand("%p") . " successfully."
end
call setpos('.', ourpos)
return 0
endif
endfunction
function! AmuletType()
let ourpos = getpos('.')
echo trim(s:CallAmc(":t", expand("<cword>")))
call setpos('.', ourpos)
endfunction
function! AmuletEval(mode)
let ourpos = getpos('.')
if a:mode == 'v'
let [line_start, column_start] = getpos("'<")[1:2]
let [line_end, column_end] = getpos("'>")[1:2]
if line_start != line_end
return
endif
let expr = getline(line_start)[column_start - 1 : column_end - 1]
echo trim(s:CallAmc(expr))
else
let expr = input("Evaluate: ")
redraw
echo trim(s:CallAmc(expr))
end
call setpos('.', ourpos)
endfunction
function! AmuletDep(...)
for path in a:000
if filereadable(path)
call add(b:amc_deps, path)
else
echo "File " . file . " not readable by current user"
endif
endfor
call AmuletLoad(1, '')
endfunction
function! AmuletParseDeps()
let b:amc_deps = []
let deplist = []
silent keeppatterns %s/(\* amulet\.vim: \(.*\) \*)/\=add(deplist,submatch(1))/gne
call call('AmuletDep', deplist)
endfunction
function! AmuletComplete(findstart, base)
if a:findstart
" locate the start of the word
let line = getline('.')
let start = col('.') - 1
while start > 0 && !(line[start - 1] =~ ' ')
echo line[start - 1]
let start -= 1
endwhile
return start
else
return split(s:CallAmc(":complete", a:base), "\n")
endif
endfunction
set omnifunc=AmuletComplete
nnoremap <buffer> <silent> <LocalLeader>t :call AmuletType()<ENTER>
nnoremap <buffer> <silent> <LocalLeader>l :call AmuletLoad(1,'')<ENTER>
nnoremap <buffer> <silent> <LocalLeader>L :call AmuletLoad(0,'qf')<ENTER>
vnoremap <buffer> <silent> <LocalLeader>e :call AmuletEval('v')<ENTER>
nnoremap <buffer> <silent> <LocalLeader>e :call AmuletEval('n')<ENTER>
command! -nargs=? AmuletStartServer :call AmuletStart(<args>)
command! -complete=file -nargs=+ AmuletDepend :call AmuletDep(<f-args>)
command! -nargs=0 AmuletFindDepends :call AmuletParseDeps()
cnoreabbr amcdep AmuletDepend

View file

@ -37,7 +37,7 @@
; sorted from here!
:Olical/aniseed {:branch "develop"}
:lewis6991/impatient.nvim {}
; :lewis6991/impatient.nvim {}
:nvim-lua/plenary.nvim {}
:norcalli/nvim.lua {}
:lifepillar/vim-gruvbox8 {:lazy false :priority 1000 :config #(require "dots.plugins.gruvbox8")}
@ -109,7 +109,6 @@
:lazy true
:event ["VeryLazy"]}
:JoosepAlviste/nvim-ts-context-commentstring {:event ["VeryLazy"]
:lazy true
:dependencies [:nvim-treesitter/nvim-treesitter]}

View file

@ -7,8 +7,8 @@
require-macros [macros]})
; :h bufferline-lua-highlights
(let [selected {:gui "" :guibg colors.neutral_aqua :guifg colors.dark0}
visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_aqua}]
(let [selected {:bg colors.neutral_aqua :fg colors.dark0}
visible {:bg colors.dark1 :fg colors.neutral_aqua}]
(bufferline.setup
{:options
{:diagnostics "nvim_lsp"
@ -22,7 +22,7 @@
; https://github.com/akinsho/nvim-bufferline.lua/blob/4ebab39af2376b850724dd29c29579c8e024abe6/lua/bufferline/config.lua#L74
:highlights
{:fill {:guibg colors.dark0 :guifg colors.light0}
{:fill {:bg colors.dark0 :fg colors.light0}
:background visible
:buffer_visible visible
:buffer_selected selected
@ -32,26 +32,26 @@
:error visible :error_selected selected :error_visible visible
:duplicate visible :duplicate_selected selected :duplicate_visible visible
:diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_red}
:diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_red}
:diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.faded_red}
:diagnostic {:bg colors.dark1 :fg colors.neutral_red}
:diagnostic_visible {:bg colors.dark1 :fg colors.neutral_red}
:diagnostic_selected {:bg colors.neutral_aqua :fg colors.faded_red}
:info_diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_blue}
:info_diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_blue}
:info_diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.faded_blue}
:info_diagnostic {:bg colors.dark1 :fg colors.neutral_blue}
:info_diagnostic_visible {:bg colors.dark1 :fg colors.neutral_blue}
:info_diagnostic_selected {:bg colors.neutral_aqua :fg colors.faded_blue}
:warning_diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_yellow}
:warning_diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_yellow}
:warning_diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.faded_yellow}
:warning_diagnostic {:bg colors.dark1 :fg colors.neutral_yellow}
:warning_diagnostic_visible {:bg colors.dark1 :fg colors.neutral_yellow}
:warning_diagnostic_selected {:bg colors.neutral_aqua :fg colors.faded_yellow}
:error_diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_red}
:error_diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_red}
:error_diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.red}
:error_diagnostic {:bg colors.dark1 :fg colors.neutral_red}
:error_diagnostic_visible {:bg colors.dark1 :fg colors.neutral_red}
:error_diagnostic_selected {:bg colors.neutral_aqua :fg colors.red}
:separator visible
:indicator_selected {:guibg colors.neutral_aqua :guifg colors.neutral_aqua}
:indicator_selected {:bg colors.neutral_aqua :fg colors.neutral_aqua}
; stuff I've never seen before :thonk:
:pick_selected {:guibg colors.bright_red :guifg colors.bright_red}
:tab_selected {:guibg colors.bright_green :guifg colors.bright_green}
:tab {:guibg colors.bright_yellow :guifg colors.bright_yellow}}}))
:pick_selected {:bg colors.bright_red :fg colors.bright_red}
:tab_selected {:bg colors.bright_green :fg colors.bright_green}
:tab {:bg colors.bright_yellow :fg colors.bright_yellow}}}))

View file

@ -1,6 +1,7 @@
(module dots.plugins.gruvbox8
{autoload {utils dots.utils
colors dots.colors}})
colors dots.colors}
require-macros [macros]})
(set vim.g.gruvbox_italics 0)
(set vim.g.gruvbox_italicise_strings 0)
@ -11,7 +12,12 @@
(vim.cmd "colorscheme gruvbox8_hard")
(vim.cmd "colorscheme gruvbox8"))
(utils.highlight :SignColumn {:bg colors.dark0})
(defer
(if (= "epix" (vim.fn.hostname))
(utils.highlight :SignColumn {:bg colors.dark0_hard})
(utils.highlight :SignColumn {:bg colors.dark0})))
;(utils.highlight :SignColumn {:bg (. (require :dots.colors) :dark0)}))}
;(utils.highlight :LspDiagnosticsUnderlineError {:gui "underline"}))}

View file

@ -114,6 +114,7 @@
liblldb-path (.. extension-path "lldb/lib/liblldb.so")
features nil]
(rust-tools.setup {:tools {:inlay_hints {:show_parameter_hints false}
;:auto false}
:autoSetHints false}
:dap {:adapter (rust-tools-dap.get_codelldb_adapter codelldb-path liblldb-path)}
:server {:on_attach on_attach

View file

@ -7,7 +7,7 @@
(configs.setup
{:ensure_installed ["rust" "fennel" "commonlisp" "vim" "regex" "lua" "bash" "markdown" "markdown_inline"]
; :ensure_installed "maintained"
:highlight {:enable true
:highlight {:enable false
:disable ["fennel" "rust" "haskell"]}
:incremental_selection {:enable false

View file

@ -16,7 +16,7 @@
(make-errors-epic (require "dots.plugins"))
(require "impatient")
; (require "impatient")
(make-errors-epic (require "dots.plugins.lsp"))
(make-errors-epic (require "dots.keybinds"))
@ -179,7 +179,7 @@
(vim.api.nvim_buf_is_loaded $1)
(= "" (str.join (utils.buffer-content $1)))
(vim.api.nvim_buf_get_option $1 "buflisted"))
(vim.fn.range 1 "$"))]
(vim.fn.range 1 (vim.fn.bufnr "$")))]
(when (not (a.empty? bufs))
(vim.cmd (.. "bdelete " (str.join " " bufs))))))

View file

@ -107,7 +107,7 @@ input "type:keyboard" {
bindsym $mod+Return exec $term
# Kill focused window
bindsym $mod+Shift+q kill
bindsym $mod+q kill
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.

View file

@ -1,6 +1,7 @@
set default-bg "#1d2021"
set recolor true
set recolor-lightcolor "#282828"
set recolor-lightcolor "#1d2021"
set recolor-darkcolor "#ebdbb2"
set recolor-keephue
set inputbar-bg "#1d2021"