From 67fc636397f8d187ca0b24d08a69c6a6d0bfa444 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Mon, 12 Sep 2022 13:50:02 +0200 Subject: [PATCH] A ton of changes I forgot to commit --- dotfiles/neovim/README.md | 44 ++++++++++++++++--- dotfiles/neovim/ftplugin/hkf.lua | 1 - dotfiles/neovim/ftplugin/tex.lua | 8 ++++ dotfiles/neovim/lua/my/keymaps.lua | 11 ++++- dotfiles/neovim/lua/my/paq.lua | 2 + dotfiles/neovim/lua/my/plugins/arpeggio.lua | 28 ++++++------ .../neovim/lua/my/plugins/clipboard-image.lua | 1 - dotfiles/neovim/lua/my/plugins/init.lua | 2 + dotfiles/neovim/lua/my/plugins/lspconfig.lua | 2 +- dotfiles/neovim/lua/my/plugins/treesitter.lua | 2 +- dotfiles/neovim/syntax/hkf.vim | 4 +- dotfiles/tmux/tmux.conf | 3 ++ .../vscode-snippets/snippets/latex/core.json | 5 +++ modules/applications/neovim.nix | 2 +- 14 files changed, 87 insertions(+), 28 deletions(-) diff --git a/dotfiles/neovim/README.md b/dotfiles/neovim/README.md index 4af10a5..818970d 100644 --- a/dotfiles/neovim/README.md +++ b/dotfiles/neovim/README.md @@ -87,8 +87,42 @@ Table of my own keybinds. Here as documentation for myself. I am yet to include Documentation for myself -| Keybind | Description | Plugins | -| ------- | ----------------------- | ------------ | -| zz | Center the current line | | -| gcc | Comment line | nvim-comment | -| gc | Comment selection | nvim-comment | +| Keybind | Description | Plugins | +| ------- | ----------------------- | ------- | +| zz | Center the current line | | + +## Important plugins I use the default mappins of + +- paperplanes + +| Keybind | Description | +| ------- | ------------------------- | +| :PP | Create pastebin-like link | + +- nvim-comment + +| Keybind | Description | +| ------- | ----------------- | +| gcc | Comment line | +| gc | Comment selection | + +- neogit + +| Keybind | Description | +| ------- | ----------- | +| C-g | Open neogit | + +- gitlinker + +| Keybind | Description | +| ---------- | ------------------ | +| gy | Create remote link | + +- nvim-surround + +| Keybind | Description | Mode | +| -------- | ----------------------------------- | ---- | +| cs[a][b] | Change surrounding pair from a to b | n | +| ds[a] | Delete surrounding pair of a | n | +| ys[m][a] | Surround the motion m with a | n | +| S[a] | Surround selected code with a | v | diff --git a/dotfiles/neovim/ftplugin/hkf.lua b/dotfiles/neovim/ftplugin/hkf.lua index 009ffd2..c8e8ccc 100644 --- a/dotfiles/neovim/ftplugin/hkf.lua +++ b/dotfiles/neovim/ftplugin/hkf.lua @@ -1,2 +1 @@ -vim.cmd("syntax hkf") vim.api.nvim_buf_set_option(0, "commentstring", "-- %s") diff --git a/dotfiles/neovim/ftplugin/tex.lua b/dotfiles/neovim/ftplugin/tex.lua index 6a3789e..d22a1c5 100644 --- a/dotfiles/neovim/ftplugin/tex.lua +++ b/dotfiles/neovim/ftplugin/tex.lua @@ -1,5 +1,7 @@ local A = require("my.abbreviations") +require("my.helpers.wrapMovement").setup() + vim.opt.conceallevel = 1 vim.opt.wrap = true @@ -9,6 +11,7 @@ local abbreviations = { -- Greek chars { "eps", "\\epsilon" }, { "delta", "\\delta" }, + { "nuls", "\\varnothing" }, -- Exponents { "en1", "^{-1}" }, @@ -18,6 +21,8 @@ local abbreviations = { { "e3", "^{3}" }, { "e4", "^{4}" }, { "en", "^{n}" }, + { "enn", "^{-}" }, + { "epp", "^{+}" }, -- Subscripts { "s0", "_{0}" }, @@ -35,10 +40,13 @@ local abbreviations = { -- Basic commands { "leq", "\\leq" }, + { "sst", "\\subset" }, + { "sseq", "\\subseteq" }, { "neq", "\\neq" }, { "nin", "\\not\\in" }, { "iin", "\\in" }, { "tto", "\\to" }, + { "iip", "\\implies" }, { "iff", "\\iff" }, { "land", "\\land" }, { "lor", "\\lor" }, diff --git a/dotfiles/neovim/lua/my/keymaps.lua b/dotfiles/neovim/lua/my/keymaps.lua index dc92977..ac513c6 100644 --- a/dotfiles/neovim/lua/my/keymaps.lua +++ b/dotfiles/neovim/lua/my/keymaps.lua @@ -20,8 +20,17 @@ function M.mapSilent(mode, lhs, rhs, opts) map(mode, lhs, rhs, options) end +-- Performs a basic move operation +function M.move(from, to) + vim.keymap.set("n", to, from) + vim.keymap.set("n", from, "") +end + function M.setup() - vim.keymap.set("n", "qq", ":wq") -- Save and quit + M.move("q", "yq") + M.move("Q", "yQ") + + vim.keymap.set("n", "Q", ":wqa") -- Save and quit -- Create chords if arpeggio ~= nil then diff --git a/dotfiles/neovim/lua/my/paq.lua b/dotfiles/neovim/lua/my/paq.lua index 34815e1..80f0b6a 100644 --- a/dotfiles/neovim/lua/my/paq.lua +++ b/dotfiles/neovim/lua/my/paq.lua @@ -54,6 +54,7 @@ function M.setup() "anuvyklack/hydra.nvim", -- keybinds where you only hit the head once "jbyuki/venn.nvim", -- draw ascii diagrams "hrsh7th/cmp-omni", -- omnifunc source for cmp + "ekickx/clipboard-image.nvim", -- paste images from clipbaord -- Git stuff "ruifm/gitlinker.nvim", -- generate permalinks for code @@ -64,6 +65,7 @@ function M.setup() if os.getenv("NVIM_INSTALL_TREESITTER") then table.insert(base, 2, { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) end + table.insert(base, 2, { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) for _, v in ipairs(themePackages) do -- append package in the base list diff --git a/dotfiles/neovim/lua/my/plugins/arpeggio.lua b/dotfiles/neovim/lua/my/plugins/arpeggio.lua index 06d2336..ba081ca 100644 --- a/dotfiles/neovim/lua/my/plugins/arpeggio.lua +++ b/dotfiles/neovim/lua/my/plugins/arpeggio.lua @@ -4,24 +4,24 @@ local arpeggio = vim.fn["arpeggio#map"] local M = {} function M.chord(mode, lhs, rhs, opts) - if string.len(mode) > 1 then - for i = 1, #mode do - local c = mode:sub(i, i) - M.chord(c, lhs, rhs, opts) - end - else - local options = helpers.mergeTables(opts, {noremap = true}) - local settings = options.settings or "" - - if options.silent then settings = settings .. "s" end - - arpeggio(mode, settings, options.noremap, lhs, rhs) + if string.len(mode) > 1 then + for i = 1, #mode do + local c = mode:sub(i, i) + M.chord(c, lhs, rhs, opts) end + else + local options = helpers.mergeTables(opts, { noremap = true }) + local settings = options.settings or "" + + if options.silent then settings = settings .. "s" end + + arpeggio(mode, settings, options.noremap, lhs, rhs) + end end function M.chordSilent(mode, lhs, rhs, opts) - local options = helpers.mergeTables(opts, {silent = true}) - M.chord(mode, lhs, rhs, options) + local options = helpers.mergeTables(opts, { silent = true }) + M.chord(mode, lhs, rhs, options) end return M diff --git a/dotfiles/neovim/lua/my/plugins/clipboard-image.lua b/dotfiles/neovim/lua/my/plugins/clipboard-image.lua index e26ae69..a212a9e 100644 --- a/dotfiles/neovim/lua/my/plugins/clipboard-image.lua +++ b/dotfiles/neovim/lua/my/plugins/clipboard-image.lua @@ -13,7 +13,6 @@ end function M.setup() require 'clipboard-image'.setup { - default = { img_name = img_name }, diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index e3988ad..38e48f9 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -21,11 +21,13 @@ function M.setup() require("my.plugins.vimux").setup() end) + require("my.plugins.easymotion").setup() require("my.plugins.autopairs").setup() require("my.plugins.paperplanes").setup() require("my.plugins.neogit").setup() require("my.plugins.telescope").setup() require("my.plugins.venn").setup() + require("my.plugins.clipboard-image").setup() -- require("my.plugins.idris").setup() -- require("which-key").setup() diff --git a/dotfiles/neovim/lua/my/plugins/lspconfig.lua b/dotfiles/neovim/lua/my/plugins/lspconfig.lua index 50c26b7..35c8915 100644 --- a/dotfiles/neovim/lua/my/plugins/lspconfig.lua +++ b/dotfiles/neovim/lua/my/plugins/lspconfig.lua @@ -16,7 +16,7 @@ function M.on_attach(client, bufnr) vim.api.nvim_create_autocmd("BufWritePre", { group = vim.api.nvim_create_augroup("LspFormatting", {}), - callback = vim.lsp.buf.formatting_sync + callback = vim.lsp.buf.format }) end diff --git a/dotfiles/neovim/lua/my/plugins/treesitter.lua b/dotfiles/neovim/lua/my/plugins/treesitter.lua index 423a7db..e63a6d3 100644 --- a/dotfiles/neovim/lua/my/plugins/treesitter.lua +++ b/dotfiles/neovim/lua/my/plugins/treesitter.lua @@ -10,7 +10,7 @@ function M.setup() sync_install = false, indent = { enable = true }, highlight = { - enable = false, + enable = true, disable = { "kotlin", "tex" }, diff --git a/dotfiles/neovim/syntax/hkf.vim b/dotfiles/neovim/syntax/hkf.vim index 13dbff3..8ed4297 100644 --- a/dotfiles/neovim/syntax/hkf.vim +++ b/dotfiles/neovim/syntax/hkf.vim @@ -2,8 +2,6 @@ if exists("b:current_syntax") finish endif -echom "Our syntax highlighting code will go here." - syntax keyword kfKeyword alias template layer using path name input output assume fun as import exporting module unsafe def syntax keyword kfFunction LayerTemplate Sequence Chord Keycode Layer Broken @@ -31,4 +29,4 @@ highlight link kfComment Comment highlight link kfOperator Operator highlight link kfString String -let b:current_syntax = "kf" +let b:current_syntax = "hkf" diff --git a/dotfiles/tmux/tmux.conf b/dotfiles/tmux/tmux.conf index f660e2c..f302b64 100644 --- a/dotfiles/tmux/tmux.conf +++ b/dotfiles/tmux/tmux.conf @@ -6,6 +6,9 @@ bind C-a send-prefix # don't rename windows automatically set-option -g allow-rename off +# Fix slow esc +set -sg escape-time 10 + # Visual stuff set -g default-terminal "screen-256color" # set -ga terminal-overrides ",screen-256color:Tc" diff --git a/dotfiles/vscode-snippets/snippets/latex/core.json b/dotfiles/vscode-snippets/snippets/latex/core.json index 01fca44..d77346c 100644 --- a/dotfiles/vscode-snippets/snippets/latex/core.json +++ b/dotfiles/vscode-snippets/snippets/latex/core.json @@ -48,6 +48,11 @@ "description": "Subscript", "body": "_{$1}$0" }, + "Exponent": { + "prefix": "ee", + "description": "Exponent", + "body": "^{$1}$0" + }, "Section": { "prefix": "section", "description": "Add section", diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index 581c822..606cd2d 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -67,7 +67,7 @@ in home-manager.users.adrielus = { home.file.".local/share/nvim/site/pack/paqs/start/paq-nvim".source = paq; - home.file.".local/share/nvim/site/pack/treesitter/start/nvim-treesitter".source = nvim-treesitter; + # home.file.".local/share/nvim/site/pack/treesitter/start/nvim-treesitter".source = nvim-treesitter; xdg.configFile."nvim/init.lua".text = myConfig; xdg.configFile."nvim/lua/my/theme.lua".source = theme.neovim.theme;