1
Fork 0

Big backup I guess

This commit is contained in:
Matei Adriel 2022-10-13 01:05:38 +02:00
parent 98e8510ae7
commit a6fb4ffbb2
13 changed files with 130 additions and 58 deletions

View file

@ -0,0 +1,34 @@
local opts = function(desc)
return { desc = desc, buffer = true }
end
vim.keymap.set("n", "<leader>lf", ":source %<cr>", opts("Run current lua file"))
vim.keymap.set("n", "<leader>ls", function()
local path = vim.api.nvim_buf_get_name(0)
local status, M = pcall(dofile, path)
if status then
if M ~= nil then
if type(M.setup) == "function" then
M.setup()
print("M.setup() executed succesfully!")
else
print("Module does not return a setup function")
end
else
print("Module returned nil")
end
else
print("Cannot import current file :(")
end
end, opts("Run .setup() in current file"))
local status, wk = pcall(require, "which-key")
if status then
wk.register({
["<leader>l"] = {
name = "Local commands"
}
})
end

View file

@ -25,6 +25,14 @@ local abbreviations = {
{ "lam", "\\lambda" }, { "lam", "\\lambda" },
{ "nuls", "\\varnothing" }, { "nuls", "\\varnothing" },
-- Other fancy symvols
{ "ints", "\\mathbb{I}" },
{ "nats", "\\mathbb{N}" },
{ "rats", "\\mathbb{Q}" },
{ "rreal", "\\mathbb{R}" },
{ "ffield", "\\mathbb{F}" },
{ "ccom", "\\mathbb{C}" },
-- Exponents -- Exponents
{ "ei", "^{-1}" }, { "ei", "^{-1}" },
{ "e0", "^{0}" }, { "e0", "^{0}" },
@ -38,7 +46,6 @@ local abbreviations = {
{ "tmat", "^{T}" }, -- Tranpose of a matrix { "tmat", "^{T}" }, -- Tranpose of a matrix
{ "etp", "^{+}" }, { "etp", "^{+}" },
-- Subscripts -- Subscripts
{ "s0", "_{0}" }, { "s0", "_{0}" },
{ "s1", "_{1}" }, { "s1", "_{1}" },
@ -80,6 +87,8 @@ local abbreviations = {
{ "lor", "\\lor" }, { "lor", "\\lor" },
{ "ssin", "\\sin" }, { "ssin", "\\sin" },
{ "ccos", "\\cos" }, { "ccos", "\\cos" },
{ "ttan", "\\ttan" },
{ "ssec", "\\sec" },
{ "lln", "\\ln" }, { "lln", "\\ln" },
{ "frl", "\\forall" }, { "frl", "\\forall" },
{ "exs", "\\exists" }, { "exs", "\\exists" },
@ -96,13 +105,16 @@ local abbreviations = {
{ "smul", "\\times" }, { "smul", "\\times" },
{ "texpl", "&& \\text{}" }, { "texpl", "&& \\text{}" },
{ "card", "\\#" }, { "card", "\\#" },
{ "div", "|" },
{ "ndiv", "\\not|\\:" },
-- words -- words
{ "rref", "reduced row echalon form" } { "rref", "reduced row echalon form" }
} }
local abolishAbbreviations = { local abolishAbbreviations = {
{ "egv{a,e}{,s}", "eigenv{alue,ector}{}" } { "egv{a,e}{,s}", "eigenv{alue,ector}{}" },
{ "ib{p,s}", "integration by {parts,substitution}" }
} }
AB.abolishMany(abolishAbbreviations) AB.abolishMany(abolishAbbreviations)

View file

@ -26,6 +26,13 @@ function M.move(from, to, opts)
vim.keymap.set("n", from, "<Nop>") vim.keymap.set("n", from, "<Nop>")
end end
function M.delimitedTextobject(from, to, name, perhapsOpts)
local opts = helpers.mergeTables(perhapsOpts or {}, { desc = name })
vim.keymap.set({ "v", "o" }, "i" .. from, "i" .. to, opts)
vim.keymap.set({ "v", "o" }, "a" .. from, "a" .. to, opts)
end
function M.setup() function M.setup()
M.move("q", "yq", { desc = "Record macro" }) M.move("q", "yq", { desc = "Record macro" })
M.move("Q", "yQ") M.move("Q", "yQ")
@ -36,6 +43,10 @@ function M.setup()
desc = "Replace word in file" desc = "Replace word in file"
}) })
M.delimitedTextobject("q", '"', "quotes")
M.delimitedTextobject("a", "'", "'")
M.delimitedTextobject("r", "[", "square brackets")
-- Create chords -- Create chords
if arpeggio ~= nil then if arpeggio ~= nil then
arpeggio.chordSilent("n", "ji", ":silent :write<cr>") -- Saving arpeggio.chordSilent("n", "ji", ":silent :write<cr>") -- Saving

View file

@ -59,10 +59,13 @@ function M.setup()
"lewis6991/impatient.nvim", -- faster startup times "lewis6991/impatient.nvim", -- faster startup times
"tpope/vim-abolish", -- abbreviations on steroids "tpope/vim-abolish", -- abbreviations on steroids
"mrjones2014/smart-splits.nvim", -- the name says it all "mrjones2014/smart-splits.nvim", -- the name says it all
"phaazon/mind.nvim", -- Organize shit as trees
"bfredl/nvim-luadev", -- lua repl thingy
"akinsho/toggleterm.nvim", -- cool terminal thingy
-- Git stuff -- Git stuff
"ruifm/gitlinker.nvim", -- generate permalinks for code "ruifm/gitlinker.nvim", -- generate permalinks for code
-- "TimUntersberger/neogit" -- magit clone { "TimUntersberger/neogit", opt = true } -- magit clone
} }
table.insert(base, 2, { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) table.insert(base, 2, { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })

View file

@ -11,7 +11,7 @@ end
function M.setup() function M.setup()
local cmp = require("cmp") local cmp = require("cmp")
local lspkind = require('lspkind') local lspkind = require('lspkind')
local luasnip = require("luasnip") -- local luasnip = require("luasnip")
local options = { local options = {
window = { window = {
@ -44,22 +44,18 @@ function M.setup()
end end
}, },
mapping = { mapping = {
["<Tab>"] = cmp.mapping(function(fallback) ["<C-d>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then elseif has_words_before() then
cmp.complete() cmp.complete()
else else
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<C-s>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else else
fallback() fallback()
end end
@ -73,8 +69,6 @@ function M.setup()
}, { { name = 'buffer' } }) }, { { name = 'buffer' } })
} }
cmp.setup(options)
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', { cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),

View file

@ -7,11 +7,10 @@ function M.setup()
silent = true silent = true
} }
end end
-- vim.keymap.set("n", "q", "<Plug>(easymotion-prefix)") vim.keymap.set({ "n", "v", "o" }, "qf", "<Plug>(easymotion-bd-f)", opts("Hop to char"))
vim.keymap.set("n", "qf", "<Plug>(easymotion-bd-f)", opts("Hop to char")) vim.keymap.set({ "n", "v", "o" }, "qj", "<Plug>(easymotion-overwin-f2)", opts("Hop to char pair"))
vim.keymap.set("n", "qj", "<Plug>(easymotion-overwin-f2)", opts("Hop to char pair")) vim.keymap.set({ "n", "v", "o" }, "qw", ":silent <Plug>(easymotion-bd-w)", opts("Hop to word"))
vim.keymap.set("n", "qw", ":silent <Plug>(easymotion-bd-w)", opts("Hop to word")) vim.keymap.set({ "n", "v", "o" }, "qL", "silent <Plug>(easymotion-bd-L)", opts("Hop to line (?)"))
vim.keymap.set("n", "qL", "silent <Plug>(easymotion-bd-L)", opts("Hop to line (?)"))
local status, wk = pcall(require, "which-key") local status, wk = pcall(require, "which-key")

View file

@ -13,11 +13,15 @@ function M.setup()
require("my.plugins.lualine").setup() require("my.plugins.lualine").setup()
require("my.plugins.vimux").setup() require("my.plugins.vimux").setup()
require("my.plugins.whichkey").setup() require("my.plugins.whichkey").setup()
require("toggleterm").setup()
require("my.plugins.neogit").setup()
end) end)
require("my.plugins.dashboard").setup() require("my.plugins.dashboard").setup()
require("my.plugins.treesitter").setup() require("my.plugins.treesitter").setup()
require("my.plugins.cmp").setup() require("my.plugins.cmp").setup()
require("my.plugins.luasnip").setup()
require("my.plugins.lspconfig").setup() require("my.plugins.lspconfig").setup()
require("my.plugins.null-ls").setup() require("my.plugins.null-ls").setup()
require("my.plugins.vimtex").setup() require("my.plugins.vimtex").setup()
@ -28,16 +32,22 @@ function M.setup()
require("my.plugins.firevim").setup() require("my.plugins.firevim").setup()
else else
require("gitlinker").setup() require("gitlinker").setup()
-- require("my.plugins.neogit").setup()
require("my.plugins.paperplanes").setup() require("my.plugins.paperplanes").setup()
end end
require("my.plugins.easymotion").setup() require("my.plugins.easymotion").setup()
require("my.plugins.autopairs").setup() require("my.plugins.autopairs").setup()
require("my.plugins.telescope").setup() require("my.plugins.telescope").setup()
require("my.plugins.surround").setup()
require("my.plugins.hydra").setup() require("my.plugins.hydra").setup()
require("my.plugins.clipboard-image").setup() require("my.plugins.clipboard-image").setup()
require("mind").setup({
persistence = {
state_path = "~/Mind/mind.json",
data_dir = "~/Mind/data"
}
})
-- require("my.plugins.slam").setup() -- require("my.plugins.slam").setup()
end end

View file

@ -0,0 +1,17 @@
local M = {}
local luasnip = require("luasnip")
function M.setup()
vim.keymap.set("i", "<Tab>", function()
if luasnip.jumpable(1) then
return "<cmd>lua require('luasnip').jump(1)<cr>"
else
return "<Tab>"
end
end, { expr = true })
vim.keymap.set("i", "<S-Tab>", function()
luasnip.jump(-1)
end)
end
return M

View file

@ -1,6 +1,9 @@
local M = {} local M = {}
function M.setup() function M.setup()
-- This is here because we do not want to use neogit inside firenvim or vscode!
vim.cmd [[packadd! neogit]]
local neogit = require("neogit") local neogit = require("neogit")
neogit.setup() neogit.setup()

View file

@ -0,0 +1,8 @@
local M = {}
function M.setup()
vim.g.surround_113 = '"\r"'
vim.g.surround_97 = "'\r'"
end
return M

View file

@ -53,8 +53,9 @@ bind -T copy-mode-vi y send-keys -X copy-selection
# Smart pane switching with awareness of Vim splits. # Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator # See: https://github.com/christoomey/vim-tmux-navigator
# Also see: https://github.com/christoomey/vim-tmux-navigator/issues/264
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|\.?n?vim?x?(-wrapped)?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'

View file

@ -178,36 +178,6 @@
"description": "Create a ln call", "description": "Create a ln call",
"body": "\\ln($1)$0" "body": "\\ln($1)$0"
}, },
"Real numbers": {
"prefix": "reals",
"description": "",
"body": "\\mathbb{R}"
},
"Complex numbers": {
"prefix": "complex",
"description": "Fancy C symbol",
"body": "\\mathbb{C}"
},
"Natural numbers": {
"prefix": "nats",
"description": "",
"body": "\\mathbb{N}"
},
"Integers": {
"prefix": "ints",
"description": "",
"body": "\\mathbb{Z}"
},
"Rationals": {
"prefix": "rats",
"description": "",
"body": "\\mathbb{Q}"
},
"Fields": {
"prefix": "fields",
"description": "Fanch F symbol",
"body": "\\mathbb{F}"
},
"Aligned": { "Aligned": {
"prefix": "aligned", "prefix": "aligned",
"description": "Create an aligned environment", "description": "Create an aligned environment",
@ -290,5 +260,15 @@
"\\\\\\ $3 & $4", "\\\\\\ $3 & $4",
"\\end{vmatrix}$0" "\\end{vmatrix}$0"
] ]
},
"Definite integral": {
"prefix": "dintegral",
"description": "Definite integral",
"body": "\\int_{$1}^{$2} $3 d${4:x}$0"
},
"Indefinite integral": {
"prefix": "integral",
"description": "Integral",
"body": "\\int $1 d${2:x}$0"
} }
} }

View file

@ -203,11 +203,11 @@
}, },
"flake-utils_3": { "flake-utils_3": {
"locked": { "locked": {
"lastModified": 1644229661, "lastModified": 1659877975,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -529,11 +529,11 @@
}, },
"locked": { "locked": {
"dir": "contrib", "dir": "contrib",
"lastModified": 1662451801, "lastModified": 1665548414,
"narHash": "sha256-/k86NFXnZEcVXNzDdifxd9cQ5gZzLc0qqNDztYmM+mg=", "narHash": "sha256-MZTZLz4DTGnehY6JCbJzx9EtvNuOPg/dOMvMKawaFBY=",
"owner": "neovim", "owner": "neovim",
"repo": "neovim", "repo": "neovim",
"rev": "5b8d6e0b3200c5cb9d98cbdb4ed0afe2b4edd38d", "rev": "f175ca9f7cc29054b1c6fe1fd1076edd78af5684",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -552,11 +552,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1662452250, "lastModified": 1665562768,
"narHash": "sha256-0qP89RrJ71sj6/oWRuC5oJXZ+q37DovGUworw46O15s=", "narHash": "sha256-/2wag5vXeieg7YRR431tMaZwB9oAnrQ2Hy7zriRWjd4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "neovim-nightly-overlay", "repo": "neovim-nightly-overlay",
"rev": "ffbbedc805ee3e7bf5937dd4f5140bd542de6751", "rev": "e3841a95c1b6bb49ef634ed496c9489c5f48d8cf",
"type": "github" "type": "github"
}, },
"original": { "original": {