ADd vimtex stuff

This commit is contained in:
elkowar 2022-01-13 11:05:31 +01:00
parent eb6337b988
commit c91f0271ef
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F
6 changed files with 80 additions and 28 deletions

View file

@ -66,7 +66,7 @@
:max 100 :max 100
:onchange "pamixer --set-volume $(echo {} | sed 's/\\..*//g')" :onchange "pamixer --set-volume $(echo {} | sed 's/\\..*//g')"
:value volume) :value volume)
(eventbox :onscroll "notify-send test {}; if [ '{}' == 'up' ]; then pamixer -i 5; else pamixer -d 5; fi" (eventbox :onscroll "if [ '{}' == 'up' ]; then pamixer -i 5; else pamixer -d 5; fi"
:vexpand true :vexpand true
:valign "fill" :valign "fill"
(box :orientation "v" (box :orientation "v"

View file

@ -22,6 +22,11 @@
(utils.keymap :n :MN "<cmd>lua require('nvim-gehzu').show_definition()<CR>" {}) (utils.keymap :n :MN "<cmd>lua require('nvim-gehzu').show_definition()<CR>" {})
; Fix keybinds in linewrapped mode
;(utils.keymap [:n] :j "gj")
;(utils.keymap [:n] :k "gk")
(fn cmd [s desc] [(.. "<cmd>" s "<cr>") desc]) (fn cmd [s desc] [(.. "<cmd>" s "<cr>") desc])
(fn sel-cmd [s desc] [(.. "<cmd>'<,'>" s "<cr>") desc]) (fn sel-cmd [s desc] [(.. "<cmd>'<,'>" s "<cr>") desc])
(fn rebind [s desc] [s desc]) (fn rebind [s desc] [s desc])
@ -60,6 +65,7 @@
"i" [#(req dap.step_into) "into"]}} "i" [#(req dap.step_into) "into"]}}
"m" {:name "+Code actions" "m" {:name "+Code actions"
";" [#(set vim.o.spell (not vim.o.spell)) "Toggle spell checking"]
"d" [vim.lsp.buf.hover "Show documentation"] "d" [vim.lsp.buf.hover "Show documentation"]
"x" (cmd "Lspsaga preview_definition" "Preview definition") "x" (cmd "Lspsaga preview_definition" "Preview definition")
"o" (cmd "SymbolsOutline" "Outline") "o" (cmd "SymbolsOutline" "Outline")
@ -94,7 +100,8 @@
"n" (cmd "set relativenumber!" "toggle relative numbers") "n" (cmd "set relativenumber!" "toggle relative numbers")
"m" (cmd "set nonumber! norelativenumber" "toggle numbers") "m" (cmd "set nonumber! norelativenumber" "toggle numbers")
"g" (cmd "ZenMode" "toggle zen mode") "g" (cmd "ZenMode" "toggle zen mode")
"i" (cmd "IndentGuidesToggle" "toggle indent guides")} "i" (cmd "IndentGuidesToggle" "toggle indent guides")
"w" (cmd "set wrap! linebreak!" "toggle linewrapping")}
"b" {:name "+buffers" "b" {:name "+buffers"
"b" (cmd "Buffers" "select open buffer") "b" (cmd "Buffers" "select open buffer")

View file

@ -34,6 +34,10 @@
:github/copilot.vim {:opt true :cmd ["Copilot"]} :github/copilot.vim {:opt true :cmd ["Copilot"]}
:lervag/vimtex (cfg "dots.plugins.vimtex" {:opt true :ft ["tex"]})
:brymer-meneses/grammar-guard.nvim {:opt false
:requires ["williamboman/nvim-lsp-installer"
"neovim/nvim-lspconfig"]}
; sorted from here! ; sorted from here!
:Olical/aniseed {:branch "develop"} :Olical/aniseed {:branch "develop"}

View file

@ -19,13 +19,13 @@
(fn on_attach [client bufnr] (fn on_attach [client bufnr]
(pkg lsp_signature.nvim [lsp_signature (require "lsp_signature")] ;(pkg lsp_signature.nvim [lsp_signature (require "lsp_signature")]
(lsp_signature.on_attach {:bind true ;(lsp_signature.on_attach {:bind true
:hint_scheme "String" ;:hint_scheme "String"
:hint_prefix "ƒ " ;:hint_prefix "ƒ "
:handler_opts {:border "single"} ;:handler_opts {:border "single"}
:use_lspsaga false ;:use_lspsaga false
:decorator ["`" "`"]})) ;:decorator ["`" "`"]}))
;(req dots.utils.highlight :LspDiagnosticsUnderlineError {:gui "underline"}) ;(req dots.utils.highlight :LspDiagnosticsUnderlineError {:gui "underline"})
(if client.resolved_capabilities.document_highlight (if client.resolved_capabilities.document_highlight
@ -71,6 +71,7 @@
(init-lsp :html) (init-lsp :html)
(init-lsp :svelte) (init-lsp :svelte)
(init-lsp :elmls) (init-lsp :elmls)
(init-lsp :texlab)
(init-lsp :powershell_es {:bundle_path "/home/leon/powershell"}) (init-lsp :powershell_es {:bundle_path "/home/leon/powershell"})
@ -83,15 +84,12 @@
;(init-lsp :ccls) ;(init-lsp :ccls)
(let [ewwls-path "/home/leon/coding/projects/ls-eww/crates/ewwls/target/debug/ewwls"]
(when (vim.fn.filereadable ewwls-path) ((. (require "grammar-guard") :init))
(when (not lsp.ewwls) (init-lsp :grammar_guard {:cmd "~/.local/share/nvim/lsp_servers/ltex/ltex-ls/bin/ltex-ls"
(set lsp-configs.ewwls :settings {:ltex {:language "de"
{:default_config {:cmd [ewwls-path] :enabled ["latex" "tex"]}}})
:filetypes ["yuck"]
:root_dir (fn [fname] (or (lsp.util.find_git_ancestor fname) (vim.loop.os_homedir)))
:settings {}}}))
(init-lsp :ewwls)))
(init-lsp :cssls {:filestypes ["css" "scss" "less" "stylus"] (init-lsp :cssls {:filestypes ["css" "scss" "less" "stylus"]
@ -130,14 +128,29 @@
(vim.fn.expand "$VIMRUNTIME/lua/vim/lsp") true}} (vim.fn.expand "$VIMRUNTIME/lua/vim/lsp") true}}
:telemetry false}}})) :telemetry false}}}))
(when (not lsp.prolog_lsp)
(comment
(when (not lsp.prolog_lsp)
(tset lsp-configs :prolog_lsp (tset lsp-configs :prolog_lsp
{:default_config {:cmd ["swipl" "-g" "use_module(library(lsp_server))." "-g" "lsp_server:main" "-t" "halt" "--" "stdio"] {:default_config {:cmd ["swipl" "-g" "use_module(library(lsp_server))." "-g" "lsp_server:main" "-t" "halt" "--" "stdio"]
:filetypes ["prolog"] :filetypes ["prolog"]
:root_dir (fn [fname] (or (lsp.util.find_git_ancestor fname) (vim.loop.os_homedir))) :root_dir (fn [fname] (or (lsp.util.find_git_ancestor fname) (vim.loop.os_homedir)))
:settings {}}})) :settings {}}}))
(lsp.prolog_lsp.setup {}) (lsp.prolog_lsp.setup {}))
(comment
(let [ewwls-path "/home/leon/coding/projects/ls-eww/crates/ewwls/target/debug/ewwls"]
(when (vim.fn.filereadable ewwls-path)
(when (not lsp.ewwls)
(set lsp-configs.ewwls
{:default_config {:cmd [ewwls-path]
:filetypes ["yuck"]
:root_dir (fn [fname] (or (lsp.util.find_git_ancestor fname) (vim.loop.os_homedir)))
:settings {}}}))
(init-lsp :ewwls))))

View file

@ -0,0 +1,3 @@
(module dots.plugins.vimtex)
(set vim.g.vimtex_view_method "general")

View file

@ -561,6 +561,31 @@ main = do
-- }}} -- }}}
-- | for a list of queries, finds the first one that
-- matches the currently focused window and executes that X action,
-- or a fallback if no window is active.
perQueryAction :: X () -> [(Query Bool, X ())] -> X ()
perQueryAction fallback options = withWindowSet $ \ws -> case W.peek ws of
Nothing -> fallback
Just w -> do
matching <- findM (\(q, _) -> runQuery q w) options
maybe fallback snd matching
findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a)
findM _ [] = pure Nothing
findM f (x:xs) = do b <- f x; if b then pure $ Just x else findM f xs
fooElseBar :: X ()
fooElseBar = perQueryAction
(spawn "notify-send no window")
[ ((className =? "Alacritty"), spawn "notify-send kek hehe")
, ((className =? "Google-chrome"), spawn "notify-send chrome user")
]
myActivateManageHook :: ManageHook myActivateManageHook :: ManageHook
myActivateManageHook = pure mempty myActivateManageHook = pure mempty