1
Fork 0

Fp abbreviations, kicad and nvim keymap docs

This commit is contained in:
Matei Adriel 2023-03-14 20:57:07 +01:00
parent 1ed61054f7
commit eaebbca5b3
No known key found for this signature in database
17 changed files with 351 additions and 237 deletions

View file

@ -1,8 +1,8 @@
{
# Select your current theme here!
imports = [
# ./rose-pine-dawn.nix
./ai.nix
./rose-pine-dawn.nix
# ./ai.nix
];
# Requires me to manually turn targets on!

View file

@ -10,7 +10,9 @@
"library": {
"enabled": true,
"types": true,
"plugins": false,
"plugins": [
"scrap"
],
"runtime": true
}
}

View file

@ -8,121 +8,219 @@
## Keybinds
Table of my own keybinds. Here as documentation for myself. I am yet to include any of the keybinds for cmp here.
I feel like macro recording is a rare thing, so I moved it to `yq/yQ`. This frees up `q` as a "namespace" of sorts for other default vim keybinds I want to move out. For example, I use `J` for diagnostics, so I moved the default action from `J` to `qj`.
> Things written using italics are chords
> (aka all the keys need to be pressed at the same time)
### Base
| Keybind | Description | Plugins |
| ------------ | ----------------------------------- | ------------------ |
| _vs_ | Create vertical split | |
| _cp_ | Use system clipboard | |
| _jl_ | Save | |
| ----------- | ------------------------------------------------ | ------- |
| \<leader>a | [A]lternate file | |
| \<leader>rw | [R]eplace [w]ord under cursor in the entire file | |
| Q | [Q]uit all buffers | |
| [d | Previous [d]iagnostic | |
| d] | Next [d]iagnostic | |
| J | Hover over diagnostic | |
| qJ | Merge with next line | |
| \<leader>D | [D]iagnostic loclist | |
| _jk_ | Exit insert mode | |
| _rw_ | Rename word under cursor | |
| _\<leader>k_ | Insert digraph | |
| _\<leader>a_ | Swap last 2 used buffers | |
| C-n | Open tree | nvim-tree |
| _vc_ | Clear vimux window | vimux |
| _vl_ | Rerun last vimux command | vimux |
| _vp_ | Run command in another tmux pane | vimux |
| C-hjkl | Navigation between vim & tmux panes | vim-tmux-navigator |
| J | Show line diagnostics | lspconfig |
| K | Show hover info | lspconfig |
| L | Signature help (?) | lspconfig |
| gD | Go to declaration | lspconfig |
| gd | Go to definition | lspconfig |
| gi | Go to implementation | lspconfig |
| \<leader>rn | Rename | lspconfig |
| \<leader>f | format | lspconfig |
| \<leader>ca | code actions | lspconfig |
| _jo_ | Save file | |
| S-Enter | Newline without continuing comment | |
### Textobjects
| Keybinds | Description | Plugins |
| -------- | -------------------------- | ------- |
| aq | [A]round [q]uotes | |
| iq | [I]nside [q]uotes | |
| aa | [A]round [a]phostrophes | |
| ia | [I]nside [a]phostrophes | |
| ar | [A]round squa[r]e brackets | |
| ir | [I]nside squa[r]e brackets | |
### Treesitter
| Keybinds | Description |
| -------- | ------------------------------- |
| ]f | Go to next [f]unction start |
| ]F | Go to next [f]unction end |
| [f | Go to previous [f]unction start |
| [F | Go to previous [f]unction end |
| ]c | Go to next [c]lass start |
| ]C | Go to next [c]lass end |
| [c | Go to previous [c]lass start |
| [C | Go to previous [c]lass end |
#### Textobjects
| Keybinds | Description |
| -------- | ------------------- |
| af | [A]round [f]unction |
| if | [I]nside [f]unction |
| ac | [A]round [c]lass |
| ic | [I]nside [c]lass |
### Telescope
The `<leader>f` workspace contains keybinds which search for a specific filetype.
| Keybind | Description | Plugins |
| ----------- | ------------------------------ | ---------------------- |
| Ctrl-P | Find files | |
| Ctrl-F | Grep in project | |
| ----------- | ------------------------ | ---------------------- |
| C-p | Find files | |
| C-f | Grep in project | |
| C-F | Interactive file broswer | telescope-file-browser |
| \<leader>d | Diagnostics | lspconfig |
| \<leader>ca | Code actions | lspconfig |
| \<leader>t | Show builtin pickers | |
| \<leader>s | Show symbols using tree-sitter | |
| \<leader>gj | List git commits | |
| \<leader>gk | List git branches | |
| _jp_ | Interactive file broswer | telescope-file-browser |
| _ui_ | Insert unicode char | |
| \<leader>ft | Typescript Files | |
| \<leader>fl | Latex Files | |
| \<leader>fp | Purescript Files | |
### Idris
> The idris and arpeggio plugins are implicit here
### Cmp
| Keybind | Description |
| ------- | ------------------- |
| _isc_ | Case split |
| _imc_ | Make case |
| _iml_ | Make lemma |
| _ies_ | Expression search |
| _igd_ | Generate definition |
| _irh_ | Refine hole |
| _iac_ | Add clause |
| ------- | ------------------------ |
| C-d | Scroll completion up |
| C-s | Scroll completion down |
| Enter | Accept current competion |
### Purescript
### Lsp
The lsp configuration introduces the namespace `<leader>w` used for workspace manipulation.
| Keybind | Description |
| ------- | ------------------------------------------- |
| _vb_ | Make tmux run spago build in sepearate pane |
| _vt_ | Make tmux run spago test in separate pane |
| ----------- | --------------------------- |
| gd | [G]o to [d]efinition |
| gr | [G]o to [r]eferences |
| gi | [G]o to [i]mplementation |
| K | Hover |
| L | Signature help |
| \<leader>c | [C]ode actions |
| \<leader>F | [F]ormat file |
| \<leader>li | [l]sp [i]nfo |
| \<leader>rn | [R]e[n]ame |
| \<leader>wa | [W]orkspace [a]dd folder |
| \<leader>wr | [W]orkspace [r]emove folder |
| \<leader>wl | [W]orkspace [l]ist folders |
### Nix
### Vimux
Vimux keybinds live in the `<leader>v` namespace. Most vimux keybinds are filetype specific.
| Keybind | Description |
| ------- | ------------------------------------ |
| _ug_ | Run nix-fetchgit on the current file |
| ----------- | -------------------------- |
| \<leader>vc | [V]imux clear |
| \<leader>vl | [V]imux rerun last |
| \<leader>vp | [V]imux prompt for command |
### Lean
### Luasnip
- Extra brackets: ⟨⟩
| Keybind | Description |
| ----------- | ---------------------------- |
| Tab | Jump to next placeholder |
| S-Tab | Jump to previous placeholder |
| \<leader>rs | [R]eload [s]nippets |
## Some cool vim keybinds I sometimes forget about
### Filetypes
Documentation for myself
General filetype local keybinds reside inside the `<leader>l` namespace.
#### Purescript
| Keybind | Description |
| ----------- | ------------------------- |
| \<leader>vb | [V]imux run spago [b]uild |
| \<leader>vt | [V]imux run spago [t]est |
#### Nix
| Keybind | Description |
| ----------- | ------------------------ |
| \<leader>lg | Update [g]it fetch calls |
#### Idris
Idris keybinds live in the `<leader>I` namespace.
| Keybind | Description |
| ----------- | ------------------- |
| \<leader>IC | Make [c]ase |
| \<leader>IL | Make [l]emma |
| \<leader>Ic | Add [c]lause |
| \<leader>Ie | [E]xpression search |
| \<leader>Id | Generate [d]ef |
| \<leader>Is | [S]plit case |
| \<leader>Ih | Refine [h]ole |
#### Lua
| Keybind | Description |
| ----------- | --------------------------------- |
| \<leader>lf | Run [f]ile |
| \<leader>ls | Import [f]ile and call .[s]etup() |
### Hydra
| Keybind | Description |
| ---------- | ------------------- |
| C-w | Enter [w]indow mode |
| \<leader>v | Enter [v]enn mode |
#### Window mode
| Keybind | Description |
| --------- | ---------------------------------------- |
| h/j/k/l | Move cursor by window in given direction |
| H/J/K/L | Move window in given direction |
| C-h/j/k/l | Resize window in given direction |
| = | Equalize |
| s | Split horizontally |
| v | Split vertically |
| o | Close all other |
| q | Close window |
| w/Esc | Exit window mode |
#### Venn mode
| Keybind | Description |
| ------- | --------------------------------- |
| H/J/K/L | Continue arrow in given direction |
| f | Surround selected region with box |
### Firenvim
The following keybinds are available only when running inside firenvim:
| Keybind | Description |
| ------- | ------------- |
| C-z | Expand window |
### Small plugin keybinds
| Keybind | Description | Plugins |
| ------- | ----------------------- | ------- |
| zz | Center the current line | |
| ----------- | ----------------------------------- | -------------------- |
| gcc | Comment line | nvim-comment |
| gc | Comment selection | nvim-comment |
| C-g | Open neo[g]it | neogit |
| \<leader>yg | [Y]ank remote [g]it url | gitlinker |
| cs[a][b] | Change surrounding pair from a to b | vim-surround |
| ds[a] | Delete surrounding pair of a | vim-surround |
| ys[m][a] | Surround the motion m with a | vim-surround |
| S[a] | Surround selected code with a | vim-surround |
| s | Initialize forward [s]earch | leap |
| S | Initialize backwards [s]earch | leap |
| gs | Initialize other window [s]earch | leap |
| C-n | Open filetree | nvim-tree |
| \<leader>p | [P]aste imge from clipboard | clipboard-image.nvim |
| C-h/j/k/l | Navigate panes | vim-tmux-navigator |
## Important plugins I use the default mappins of
### Undocumented
- paperplanes
#### Iron.nvim
| Keybind | Description |
| ------- | ------------------------- |
| :PP | Create pastebin-like link |
Iron.nvim commands rest in the `<leader>i` namespace. There is a lot of them, and I rarely use this plugin, so I won't document them here just yet.
- nvim-comment
#### Magma
| Keybind | Description |
| ------- | ----------------- |
| gcc | Comment line |
| gc | Comment selection |
- neogit
| Keybind | Description |
| ------- | ----------- |
| C-g | Open neogit |
- gitlinker
| Keybind | Description |
| ---------- | ------------------ |
| <leader>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 |
Magma commands live under the namespace `<leader>M`. I barely use this plugin, so I won't document my keybinds just yet.

View file

@ -15,3 +15,5 @@ vim.keymap.set(
)
vim.opt.expandtab = true -- Use spaces for the tab char
require("my.abbreviations.fp")

View file

@ -93,12 +93,8 @@ local abbreviations = {
{ "rref", "reduced row echalon form" },
}
---@type ExpansionOptions
local no_capitalization = { capitalized = false }
-- Todo: convert exponents and subscripts
-- to use this more concise notation.
---@type ExpansionInput[]
local abolishAbbreviations = {
-- General phrases
{ "thrf", "therefore" },
@ -153,7 +149,7 @@ local abolishAbbreviations = {
{
"gt{{e,E,v,V,L},k,a,w,d,md{,e},c{,e}{,l}}{,s,h,x,y}{,a,1,2}",
"{{},\\kappa,\\alpha,\\omega,\\Delta,\\delta{,'},\\chi{,'}{,_l}}({G,S,H,X,Y}{,',_1,_2})",
options = no_capitalization,
options = A.no_capitalization,
},
-- My own operator syntax:
@ -164,7 +160,7 @@ local abolishAbbreviations = {
{
"{cr,a,}{eq,neq,leq,geq,lt,gt}",
"{\\\\\\&,&,}{=,\\neq,\\leq,\\geq,<,>}",
options = no_capitalization,
options = A.no_capitalization,
},
-- Exponents and subscripts:
@ -179,7 +175,7 @@ local abolishAbbreviations = {
{
"{e,s}{{0,1,2,3,4,5,6,7,8,9,n,i,t,k},t{i,m,p}}",
"{^,_}{{},{\\{-1\\},-,+}}",
options = no_capitalization,
options = A.no_capitalization,
},
-- Set symbols
@ -194,7 +190,7 @@ local abolishAbbreviations = {
{
"{nats,ints,rats,irats,rrea,comp,ppri,ffie}",
"\\mathbb\\{{N,Z,Q,I,R,C,P,F}\\}",
options = no_capitalization,
options = A.no_capitalization,
},
-- Function calls:

View file

@ -0,0 +1,31 @@
local A = require("my.abbreviations")
local scrap = require("scrap")
local M = {}
M.symols = {
{ "mto", ">>=" }, -- [M]onadic [t]o
{ "oalt", "<\\|>" }, -- [O]peration [A]lternative
{ "omono", "<>" }, -- [O]peration [M]onoid
}
M.types = {
{ "tarr", "Array" },
{ "tlis", "List" },
{ "tmay", "Maybe" },
{ "teff", "Effect" },
{ "taff", "Aff" },
{ "tnea", "NonEmptyArray" },
}
M.functions = {
{ "tfold", "toUnfoldable" }, -- [T]o [f]oldable
{ "ffold", "fromFoldable" }, -- [F]rom un[f]oldable
}
function M.setup()
A.manyGlobalAbbr(scrap.expand_many(M.types, A.no_capitalization))
A.manyGlobalAbbr(scrap.expand_many(M.symols, A.no_capitalization))
A.manyGlobalAbbr(scrap.expand_many(M.functions, A.no_capitalization))
end
return M

View file

@ -6,7 +6,7 @@ M.symols = {
-- Unicode:
{ "iin", "" }, -- [I]ncluded [i][n]
{ "mfrl", "" }, -- [M]ath [f]o[r]al[l]
{ "eps", "ε" }, -- Epsilon
{ "eps", "ε" }, -- [E]psilon
-- Ascii stuff:
{ "tto", "->" }, -- [t]o
@ -16,7 +16,7 @@ M.symols = {
{ "leq", "<=" }, -- [l]ess than or [e][q]ual
{ "geq", ">=" }, -- [g]reater than or [e][q]ual
{ "eq", "=" }, -- [e][q]ual
{ "seq", "=" }, -- [s]ingle [e][q]ual
{ "deq", "==" }, -- [d]ouble [e][q]ual
{ "land", "/\\" }, -- [l]ogial [a][n][d]
{ "lor", "\\/" }, -- [l]ogial [o][r]

View file

@ -1,5 +1,7 @@
local M = {}
M.no_capitalization = { capitalized = false }
function M.localAbbr(lhs, rhs)
-- Create abbreviation
vim.cmd(":iabbrev <buffer> " .. lhs .. " " .. rhs)

View file

@ -48,18 +48,7 @@ function M.setup()
-- {{{ Easier access to <C-^>
M.move("<C-^>", "<Leader>a", { desc = "[A]lternate file" })
-- }}}
-- {{{ Quit current buffer / all buffers
vim.keymap.set({ "n", "v" }, "<leader>q", function()
local buf = vim.api.nvim_win_get_buf(0)
-- Only save if file is writable
if vim.bo[buf].modifiable and not vim.bo[buf].readonly then
vim.cmd([[write]])
end
vim.cmd("q")
end, { desc = "[Q]uit current buffer" })
-- {{{ Quit all buffers
M.nmap("Q", ":wqa<cr>", "Save all files and [q]uit")
-- }}}
-- {{{ Replace word in file
@ -73,6 +62,7 @@ function M.setup()
-- {{{Diagnostic keymaps
M.nmap("[d", vim.diagnostic.goto_prev, "Goto previous [d]iagnostic")
M.nmap("]d", vim.diagnostic.goto_next, "Goto next [d]iagnostic")
M.move("J", "qj")
M.nmap("J", vim.diagnostic.open_float, "Open current diagnostic")
M.nmap("<leader>D", vim.diagnostic.setloclist, "[D]iagnostic loclist")
-- }}}
@ -83,6 +73,12 @@ function M.setup()
vim.keymap.set({ "n", "v" }, "<f11>", '"+', { desc = "Use global clipboard" }) -- Use global clipboard with *cp*
M.nmap("<f12>", ":silent write<cr>", "Save current file") -- Save using *ji*
-- }}}
-- {{{ Shift-Enter for not continuing the current comment
-- This does not preserve intendation. Not sure what a better solution would look like.
vim.keymap.set("i", "<S-CR>", function()
vim.paste({ "", "" }, -1)
end, { desc = "Insert newline without continuing the current comment" })
-- }}}
-- {{{ Allow quiting basic buffers with "q"
vim.api.nvim_create_autocmd("FileType", {
pattern = { "help" },
@ -97,12 +93,6 @@ function M.setup()
end,
})
-- }}}
-- {{{ Shift-Enter for not continuing the current comment
-- This does not preserve intendation. Not sure what a better solution would look like.
vim.keymap.set("i", "<S-CR>", function()
vim.paste({ "", "" }, -1)
end, { desc = "Insert newline without continuing the current comment" })
-- }}}
return M
end

View file

@ -14,18 +14,17 @@ function M.setup()
vim.opt.number = true -- Show line numbers
vim.opt.relativenumber = true -- Relative line numbers
-- TODO: only do this for specific filestypes
vim.opt.expandtab = true -- Use spaces for the tab char
vim.opt.scrolloff = 4 -- Lines of context
vim.opt.shiftround = true -- Round indent
vim.opt.shiftwidth = 2 -- Size of an indent
vim.opt.shiftround = true -- When using < or >, rounds to closest multiple of shiftwidth
vim.opt.smartindent = true -- Insert indents automatically
vim.opt.scrolloff = 4 -- Starts scrolling 4 lines from the edge of the screen
vim.opt.termguicolors = true -- True color support
vim.opt.ignorecase = true -- Ignore case
vim.opt.smartcase = true -- Do not ignore case with capitals
vim.opt.smartindent = true -- Insert indents automatically
vim.opt.splitbelow = true -- Put new windows below current
vim.opt.splitright = true -- Put new windows right of current

View file

@ -6,6 +6,7 @@ local M = {
"mrjones2014/smart-splits.nvim", -- the name says it all
},
keys = { "<C-w>", "<leader>v" },
event = "VeryLazy",
}
local venn_hint = [[

View file

@ -22,10 +22,10 @@ function M.config()
end, { desc = desc, bufnr = true })
end
nmap("C", "make_case", "Make [c]plit")
nmap("C", "make_case", "Make [c]ase")
nmap("L", "make_lemma", "Make [l]emma")
nmap("c", "add_clause", "Add [c]lause")
nmap("s", "expr_search", "Expression [s]earch")
nmap("e", "expr_search", "[E]xpression search")
nmap("d", "generate_def", "Generate [d]efinition")
nmap("s", "case_split", "Case [s]plit")
nmap("h", "refine_hole", "Refine [h]ole")

View file

@ -119,14 +119,6 @@ return {
event = "VeryLazy",
},
{
-- show context on closing parenthesis
-- TODO: move this to treesitter file
"haringsrob/nvim_context_vt",
event = "BufReadPost",
cond = env.vscode.not_active(),
},
{
-- show progress for lsp stuff
"j-hui/fidget.nvim",

View file

@ -53,7 +53,7 @@ function M.on_attach(client, bufnr)
vim.keymap.set("n", from, to, opts(desc))
end
-- }}}
-- {{{ Go to declaration / definition / implementation
-- {{{ Go to declaration / references / implementation
nmap("gd", vim.lsp.buf.definition, "[G]o to [d]efinition")
nmap("gi", vim.lsp.buf.implementation, "[G]o to [i]mplementation")
nmap("gr", vim.lsp.buf.references, "[G]o to [r]eferences")

View file

@ -1,4 +1,7 @@
local env = require("my.helpers.env")
local M = {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufReadPost",
@ -40,26 +43,6 @@ local M = {
additional_vim_regex_highlighting = false,
},
--}}}
--{{{ Incremental selection
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = "<C-s>",
node_decremental = "<C-b>",
},
},
--}}}
--{{{ Textsubjects
textsubjects = {
enable = true,
keymaps = {
["."] = "textsubjects-smart",
[";"] = "textsubjects-container-outer",
},
},
--}}}
textobjects = {
--{{{ Select
select = {
@ -100,6 +83,13 @@ local M = {
indent = { enable = true },
})
end,
},
{
-- show context on closing parenthesis
"haringsrob/nvim_context_vt",
event = "BufReadPost",
cond = env.vscode.not_active(),
},
}
return M

View file

@ -40,21 +40,31 @@ in
search.default = "Google";
extensions = with inputs.firefox-addons.packages.${pkgs.system}; [
buster-captcha-solver
bypass-paywalls-clean
clearurls # removes ugly args from urls
don-t-fuck-with-paste # disallows certain websites from disabling pasting
firenvim # summon a nvim instance inside the browser
gesturefy # mouse gestures
i-dont-care-about-cookies
localcdn # caches libraries locally
lovely-forks # displays forks on github
octolinker # github import to link thingy
octotree # github file tree
privacy-badger # blocks some trackers
privacy-pass # captcha stuff
refined-github # a bunch of github modifications
return-youtube-dislikes
ublock-origin # ad blocker
vimium-c # vim keybinds
steam-database # adds info from steamdb on storepages
sponsorblock # skip youtube sponsors
skip-redirect # attempts to skip to the final reddirect for certain urls
terms-of-service-didnt-read
translate-web-pages
ublock-origin
unpaywall
user-agent-string-switcher
vimium-c # vim keybinds
youtube-shorts-block
];
# Specify custom search engines

View file

@ -18,6 +18,7 @@
gimp # Image editing
libreoffice # Free office suite
lmms # Music software
kicad # PCB editing
# obs-studio # video recorder
# Clis