From b1ff650ae44b1532163db99a5db79933fa0c075c Mon Sep 17 00:00:00 2001 From: Maciej Jur Date: Sun, 24 Dec 2023 22:54:03 +0100 Subject: [PATCH] feat(nvim): neovide update --- bash/.bashrc | 2 +- nvim/lazy-lock.json | 38 +++++++++++++------------- nvim/lua/neovide.lua | 11 +++++++- nvim/lua/options.lua | 7 ++--- nvim/lua/plugins.lua | 41 ++++++++++++---------------- nvim/lua/plugins/haskell-tools.lua | 43 +++++++++++++----------------- nvim/lua/utility.lua | 11 +++++++- 7 files changed, 80 insertions(+), 73 deletions(-) diff --git a/bash/.bashrc b/bash/.bashrc index c776919..5216980 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -32,7 +32,7 @@ export GPG_TTY=$(tty) export VISUAL="$(command -v nvim 2>/dev/null)" export EDITOR="$(command -v nvim 2>/dev/null || command -v vim 2>/dev/null || command -v nano)" [ -x "$(command -v nvim 2> /dev/null)" ] && alias vim='nvim' -[ -x "$(command -v neovide 2> /dev/null)" ] && alias nvim='neovide --maximized --multigrid' +[ -x "$(command -v neovide 2> /dev/null)" ] && alias nvim='neovide' # ghcup (Haskell) [ -f "$HOME/.ghcup/env" ] && source "$HOME/.ghcup/env" # ghcup-env diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 2ab0f6c..b129179 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,34 +1,34 @@ { - "LuaSnip": { "branch": "master", "commit": "1f4ad8bb72bdeb60975e98652636b991a9b7475d" }, - "bufferline.nvim": { "branch": "main", "commit": "6ecd37e0fa8b156099daedd2191130e083fb1490" }, + "LuaSnip": { "branch": "master", "commit": "118263867197a111717b5f13d954cd1ab8124387" }, + "bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "diffview.nvim": { "branch": "main", "commit": "d38c1b5266850f77f75e006bcc26213684e1e141" }, - "gitsigns.nvim": { "branch": "main", "commit": "0ccd5fb2316b3f8d8b2f775bc31cae7bc6a77a55" }, - "haskell-tools.nvim": { "branch": "master", "commit": "a9d4290ff95c65bad11b5117109d8ca19fa6b370" }, + "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, + "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" }, + "haskell-tools.nvim": { "branch": "master", "commit": "06dcb82ea53d6035f1856799710528da0e2d7eaf" }, "kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "ab640b38ca9fa50d25d2d249b6606b9456b628d5" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "f0cd12f7a8a310c58cecebddb6b219ffad1cfd0f" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "9e82ded0515186edd4f69e4ce6b1a5f1b55b47e9" }, "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "f053f09962819c1558cd93639aa80edf7c314c17" }, - "neodev.nvim": { "branch": "main", "commit": "b2881eeb395d2b268de5fe9b5e201a8f1816beb8" }, - "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, - "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, - "nvim-dap": { "branch": "master", "commit": "e154fdb6d70b3765d71f296e718b29d8b7026a63" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "77d9f484b88fd380386b46ed9206e5374d69d9d8" }, + "neodev.nvim": { "branch": "main", "commit": "269051a7093fa481128904a33a6c4e1ca8de4340" }, + "nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-dap": { "branch": "master", "commit": "f0dca670fa059eb89dda8869a6310c804241345c" }, "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, - "nvim-lspconfig": { "branch": "master", "commit": "48347089666d5b77d054088aa72e4e0b58026e6e" }, - "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" }, - "nvim-treesitter": { "branch": "master", "commit": "557561fbc17269cdd4e9e88ef0ca1a9ff0bbf7e6" }, - "nvim-web-devicons": { "branch": "master", "commit": "3523d6e6d40ab11fd66c1b2732b3d6b60affa951" }, - "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, + "nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" }, + "nvim-notify": { "branch": "master", "commit": "27a6649ba6b22828ccc67c913f95a5407a2d8bec" }, + "nvim-treesitter": { "branch": "master", "commit": "27f68c0b6a87cbad900b3d016425450af8268026" }, + "nvim-web-devicons": { "branch": "master", "commit": "43aa2ddf476012a2155f5f969ee55ab17174da7a" }, + "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } } \ No newline at end of file diff --git a/nvim/lua/neovide.lua b/nvim/lua/neovide.lua index 49bd7ee..98c892f 100644 --- a/nvim/lua/neovide.lua +++ b/nvim/lua/neovide.lua @@ -1,4 +1,13 @@ -vim.g.neovide_scale_factor = 0.75 +local options = { + scale_factor = 0.75, + scroll_animation_far_lines = 999, + scroll_animation_length = 0.1, + cursor_animation_length = 0.1, +} + +for key, value in pairs(options) do + vim.g['neovide_' .. key] = value +end -- Japanese IME compat local function set_ime(args) diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua index 7f4c7b1..f9a6a70 100644 --- a/nvim/lua/options.lua +++ b/nvim/lua/options.lua @@ -27,9 +27,10 @@ opt.relativenumber = true -- Show relative line numbers opt.colorcolumn = "80" -- Show soft char limit opt.list = true -- Show punctuation opt.listchars = { -- Punctuation marks - trail = '·', - nbsp = '␣', - tab = '→→', + trail = "·", + nbsp = "␣", + tab = "⇥ ", + leadmultispace = "│ ", } -- Trailing whitespace diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 8114482..3e42686 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -2,16 +2,14 @@ local U = require "utility" local n = U.keymap "n" - - ---@type LazySpec return { - -- Editor theme + -- Theme { "rebelot/kanagawa.nvim", lazy = false, - priority = 1000, + priority = math.huge, config = function() vim.cmd "colorscheme kanagawa" end, @@ -150,16 +148,20 @@ return { sync_install = false, ignore_install = {}, ensure_installed = { - -- nvim - "vim", "vimdoc", "lua", - -- misc - "comment", "dockerfile", "json", "yaml", "toml", "regex", - -- git - "gitcommit", "gitignore", "diff", - -- shell - "bash", + -- neovim + "vimdoc", "lua", "query", + -- data + "json", "xml", "yaml", "toml", "dhall", -- markdown "markdown", "markdown_inline", + -- latex + "latex", "bibtex", + -- git + "gitcommit", "gitignore", "diff", + -- misc + "comment", "dockerfile", "regex", + -- shell + "bash", -- python "python", -- rust @@ -167,25 +169,16 @@ return { -- webdev "html", "css", "scss", "javascript", "jsdoc", "typescript", "tsx", "astro", "svelte", -- haskell - "haskell", - -- nix - "nix", - -- literate - "latex", "bibtex", - }, - highlight = { - enable = true, - }, - indent = { - enable = true, + "haskell", "purescript", "nix", }, + highlight = { enable = true }, + indent = { enable = true }, } end, init = function() local lang = vim.treesitter.language lang.register("markdown", "mdx") - lang.register("haskell", "purescript") end, }, diff --git a/nvim/lua/plugins/haskell-tools.lua b/nvim/lua/plugins/haskell-tools.lua index e49da87..aca6bfa 100644 --- a/nvim/lua/plugins/haskell-tools.lua +++ b/nvim/lua/plugins/haskell-tools.lua @@ -1,30 +1,22 @@ -local nmap = require("utility").keymap('n') -local M = {} +local U = require 'utility' +local n = U.keymap 'n' -function M.init() - vim.g.haskell_tools = { - hls = { - on_attach = function(_, buffer, ht) - nmap "hs" (ht.hoogle.hoogle_signature) {"Hoogle: search", buffer} - nmap "ha" (ht.lsp.buf_eval_all) {"Haskell: eval all", buffer} - end - } - } -end - -function M.config() - local ht = require "haskell-tools" - local buffer = vim.api.nvim_get_current_buf() +---@param buffer number +---@param ht HaskellTools +local function on_attach(_, buffer, ht) + n 'hc' (vim.lsp.codelens.run) {'Run codelens', buffer} + n 'hs' (ht.hoogle.hoogle_signature) {'Hoogle: search', buffer} + n 'he' (ht.lsp.buf_eval_all) {'Haskell: eval all', buffer} local function repl_file() local name = vim.api.nvim_buf_get_name(0) ht.repl.toggle(name) end - nmap "rr" (ht.repl.toggle) {"Repl: Toggle GHCi for the current package", buffer} - nmap "rf" (repl_file) "Repl: Toggle GHCi for the current buffer" - nmap "rq" (ht.repl.quit) {"Repl: Quit", buffer} + n 'rf' (repl_file) 'Repl: Toggle GHCi for the current buffer' + n 'rr' (ht.repl.toggle) {'Repl: Toggle GHCi for the current package', buffer} + n 'rq' (ht.repl.quit) {'Repl: Quit', buffer} -- Detect nvim-dap launch configurations -- (requires nvim-dap and haskell-debug-adapter) @@ -32,8 +24,11 @@ function M.config() end ----@param config table ----@return table -return function(config) - return vim.tbl_extend("keep", config, M) -end +return U.as_extendable { + init = function() + vim.g.haskell_tools = { + ---@type HaskellLspClientOpts` + hls = { on_attach = on_attach } + } + end +} diff --git a/nvim/lua/utility.lua b/nvim/lua/utility.lua index 962f9ce..6ee899c 100644 --- a/nvim/lua/utility.lua +++ b/nvim/lua/utility.lua @@ -1,5 +1,4 @@ local M = {} - local def_opts = {noremap = true, silent = true} @@ -76,4 +75,14 @@ function M.autocmd(event) end end + +---@param config LazyPluginSpec +function M.as_extendable(config) +---@param base LazyPluginSpec +---@return LazyPluginSpec + return function(base) + return vim.tbl_extend("keep", base, config) + end +end + return M