Better telescope setup
This commit is contained in:
parent
8e89a53a31
commit
7ada064c93
|
@ -81,6 +81,7 @@
|
|||
sft (tap-macro lsft (layer-toggle shiftedQwerty)) ;; make this work differently based on the next key pressed
|
||||
j (tap-macro 7 lsft)
|
||||
;; spc (spc) ;; (tap-hold-next-release 130 spc lsft)
|
||||
tab (tap-hold-next 150 tab rctl)
|
||||
)
|
||||
|
||||
;; more "special" stuff
|
||||
|
@ -102,7 +103,7 @@
|
|||
(deflayer qwerty
|
||||
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 del
|
||||
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
|
||||
tab q w e r t y u i o p [ ] \
|
||||
@tab q w e r t y u i o p [ ] \
|
||||
@mth a s d f g h j k l ; ' ret
|
||||
@sft z x c v b n m , . / rsft
|
||||
@mov lsgt lmet lalt spc ralt rctl
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
local arpeggio = require("my.plugins.arpeggio")
|
||||
local A = require("my.abbreviations")
|
||||
|
||||
print("Initializing nix keybinds...")
|
||||
|
||||
|
@ -11,3 +12,14 @@ arpeggio.chordSilent("n", "vb", ":VimuxRunCommand \"clear && spago build\"<CR>",
|
|||
{ settings = "b" })
|
||||
|
||||
vim.opt.expandtab = true -- Use spaces for the tab char
|
||||
|
||||
local abbreviations = {
|
||||
{ "land", "/\\" },
|
||||
{ "lor", "\\/" },
|
||||
{ "tto", "->" },
|
||||
{ "iip", "=>" },
|
||||
{ "frl", "forall" },
|
||||
{ "ott", "<-" } -- opposite of tto
|
||||
}
|
||||
|
||||
A.manyLocalAbbr(abbreviations)
|
||||
|
|
|
@ -12,6 +12,11 @@ local abbreviations = {
|
|||
{ "eps", "\\epsilon" },
|
||||
{ "delta", "\\delta" },
|
||||
{ "pi", "\\pi" },
|
||||
{ "psi", "\\psi" },
|
||||
{ "psi", "\\psi" },
|
||||
{ "alpha", "\\alpha" },
|
||||
{ "beta", "\\beta" },
|
||||
{ "gamma", "\\gamma" },
|
||||
{ "nuls", "\\varnothing" },
|
||||
|
||||
-- Exponents
|
||||
|
@ -23,6 +28,7 @@ local abbreviations = {
|
|||
{ "e4", "^{4}" },
|
||||
{ "en", "^{n}" },
|
||||
{ "etn", "^{-}" },
|
||||
{ "ett", "^{t}" },
|
||||
{ "etp", "^{+}" },
|
||||
|
||||
-- Subscripts
|
||||
|
@ -60,6 +66,9 @@ local abbreviations = {
|
|||
{ "iff", "\\iff" },
|
||||
{ "land", "\\land" },
|
||||
{ "lor", "\\lor" },
|
||||
{ "ssin", "\\sin" },
|
||||
{ "ccos", "\\cos" },
|
||||
{ "lln", "\\ln" },
|
||||
{ "frl", "\\forall" },
|
||||
{ "exs", "\\exists" },
|
||||
{ "iinf", "\\infty" },
|
||||
|
@ -69,6 +78,7 @@ local abbreviations = {
|
|||
{ "ccap", "\\cap" },
|
||||
{ "nope", "\\bot" },
|
||||
{ "yee", "\\top" },
|
||||
{ "ccan", "\\cancel" },
|
||||
{ "mul", "\\cdot" },
|
||||
{ "smul", "\\times" },
|
||||
{ "texpl", "&& \\text{}" },
|
||||
|
|
|
@ -18,7 +18,7 @@ function M.setup()
|
|||
},
|
||||
tex = {
|
||||
img_dir = { "%:p:h", "img" },
|
||||
affix = "\\includegraphics[]{%s}",
|
||||
affix = "\\includegraphics[width=\\textwidth]{%s}",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,83 +1,46 @@
|
|||
local mapSilent = require("my.keymaps").mapSilent
|
||||
local arpeggio = require("my.plugins.arpeggio")
|
||||
|
||||
local M = {}
|
||||
|
||||
local bindings = {
|
||||
builtin = {
|
||||
-- Open files with control + P
|
||||
find_files = "<c-P>",
|
||||
local function find_files_by_extension(extension)
|
||||
return "find_files find_command=rg,--files,--glob=**/*." .. extension
|
||||
end
|
||||
|
||||
-- Search through files with control + F
|
||||
live_grep = "<c-F>",
|
||||
|
||||
-- See diagnostics with space + d
|
||||
diagnostics = "<Leader>d",
|
||||
lsp_document_symbols = { chord = 1, key = "lds" },
|
||||
|
||||
-- Open a list with all the pickers
|
||||
builtin = "<Leader>t",
|
||||
|
||||
-- List function, var names etc
|
||||
treesitter = "<Leader>s",
|
||||
|
||||
-- Git stuff
|
||||
git_commits = "<Leader>gj",
|
||||
git_branches = "<Leader>gk"
|
||||
},
|
||||
["extensions.file_browser.file_browser"] = { chord = 1, key = "jp" },
|
||||
extensions = {
|
||||
unicode = {
|
||||
picker = { mode = "i", kind = "dropdown", key = "ui", chord = 1 }
|
||||
}
|
||||
}
|
||||
local keybinds = {
|
||||
{ "<C-P>", "find_files" },
|
||||
{ "<Leader>ft", find_files_by_extension("tex") },
|
||||
{ "<Leader>fl", find_files_by_extension("lua") },
|
||||
{ "<C-F>", "live_grep" },
|
||||
{ "<Leader>t", "builtin" },
|
||||
}
|
||||
|
||||
local function setupKeybinds(obj, path)
|
||||
if path == nil then path = "" end
|
||||
for name, keybinds in pairs(obj) do
|
||||
if (type(keybinds) == "table") and keybinds.key == nil then
|
||||
-- This means we found a table of keybinds, so we go deeper
|
||||
setupKeybinds(keybinds, path .. "." .. name)
|
||||
else
|
||||
local config = keybinds
|
||||
local pickerArgument = ""
|
||||
local key = config
|
||||
local mode = "n"
|
||||
local bind = mapSilent
|
||||
local chords = {
|
||||
{ "jp", "file_browser" }
|
||||
}
|
||||
|
||||
if type(config) == "table" then
|
||||
key = config.key
|
||||
if config.mode ~= nil then mode = config.mode end
|
||||
if config.kind ~= nil then
|
||||
pickerArgument = "require('telescope.themes').get_" ..
|
||||
config.kind .. "({})"
|
||||
end
|
||||
if config.chord then
|
||||
-- Useful for insert mode bindings
|
||||
bind = arpeggio.chordSilent
|
||||
end
|
||||
local function mkAction(action)
|
||||
return ":Telescope " .. action .. "<cr>"
|
||||
end
|
||||
|
||||
-- Maps the keybind to the action
|
||||
bind(mode, key,
|
||||
"<cmd>lua require('telescope" .. path .. "')." .. name .. "(" ..
|
||||
pickerArgument .. ")<CR>")
|
||||
local function setupKeybinds()
|
||||
for _, mapping in pairs(keybinds) do
|
||||
vim.keymap.set("n", mapping[1], mkAction(mapping[2]))
|
||||
end
|
||||
|
||||
for _, mapping in pairs(chords) do
|
||||
arpeggio.chord("n", mapping[1], mkAction(mapping[2]))
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
setupKeybinds(bindings)
|
||||
setupKeybinds()
|
||||
|
||||
local settings = {
|
||||
defaults = { mappings = { i = { ["<C-h>"] = "which_key" } } },
|
||||
pickers = { find_files = { hidden = true } },
|
||||
extensions = {
|
||||
file_browser = {
|
||||
mappings = {
|
||||
-- Comment so this does not get collapsed
|
||||
}
|
||||
path = "%:p:h"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,16 @@
|
|||
"description": "Create a lemma",
|
||||
"body": ["\\begin{lemma}[$1] \\label{lem:$1}", "\t$0", "\\end{lemma}"]
|
||||
},
|
||||
"Example*": {
|
||||
"prefix": "example*",
|
||||
"description": "Create an example*",
|
||||
"body": ["\\begin{example*}", "\t$0", "\\end{example*}"]
|
||||
},
|
||||
"Example": {
|
||||
"prefix": "example",
|
||||
"description": "Create an example",
|
||||
"body": ["\\begin{example}[$1] \\label{exp:$1}", "\t$0", "\\end{example}"]
|
||||
},
|
||||
"Theorem": {
|
||||
"prefix": "theorem",
|
||||
"description": "Create a theorem",
|
||||
|
@ -53,6 +63,11 @@
|
|||
"description": "Exponent",
|
||||
"body": "^{$1}$0"
|
||||
},
|
||||
"Nth derivative": {
|
||||
"prefix": "dd",
|
||||
"description": "Nth derivative",
|
||||
"body": "^{($1)}$0"
|
||||
},
|
||||
"Section": {
|
||||
"prefix": "section",
|
||||
"description": "Add section",
|
||||
|
@ -81,7 +96,12 @@
|
|||
"Itemize": {
|
||||
"prefix": "item",
|
||||
"body": ["\\\\begin{itemize}", "\t\\item $0", "\\\\end{itemize}"],
|
||||
"description": "Itemize"
|
||||
"description": "Itemize env"
|
||||
},
|
||||
"Enumerate": {
|
||||
"prefix": "enum",
|
||||
"body": ["\\\\begin{enumerate}", "\t\\item $0", "\\\\end{enumerate}"],
|
||||
"description": "Enumerate env"
|
||||
},
|
||||
"Reference definition": {
|
||||
"prefix": "rdef",
|
||||
|
@ -98,11 +118,26 @@
|
|||
"description": "Reference a theorem",
|
||||
"body": "\\ref{thm:$1}$0"
|
||||
},
|
||||
"Sigma sum": {
|
||||
"prefix": "bsum",
|
||||
"description": "Create a sum using sigma notation",
|
||||
"body": "\\sum_{$1 = $2}^{$3}$0"
|
||||
},
|
||||
"Pi product": {
|
||||
"prefix": "bproduct",
|
||||
"description": "Create a produt using pi notation",
|
||||
"body": "\\product_{$1 = $2}^{$3}$0"
|
||||
},
|
||||
"Fraction": {
|
||||
"prefix": "frac",
|
||||
"description": "Create a fraction",
|
||||
"body": "\\frac{$1}{$2}$0"
|
||||
},
|
||||
"Choose": {
|
||||
"prefix": "binom",
|
||||
"description": "Create a (n choose k) thingy",
|
||||
"body": "\\binom{$1}{$2}$0"
|
||||
},
|
||||
"Limit": {
|
||||
"prefix": "lim",
|
||||
"description": "Create a limit",
|
||||
|
@ -123,6 +158,21 @@
|
|||
"description": "Create a sqrt",
|
||||
"body": "\\sqrt[$1]{$2}$0"
|
||||
},
|
||||
"Sin": {
|
||||
"prefix": "sin",
|
||||
"description": "Create a sin call",
|
||||
"body": "\\sin($1)$0"
|
||||
},
|
||||
"Cos": {
|
||||
"prefix": "cos",
|
||||
"description": "Create a cos call",
|
||||
"body": "\\cos($1)$0"
|
||||
},
|
||||
"Ln": {
|
||||
"prefix": "ln",
|
||||
"description": "Create a ln call",
|
||||
"body": "\\ln($1)$0"
|
||||
},
|
||||
"Real numbers": {
|
||||
"prefix": "reals",
|
||||
"description": "ℝ",
|
||||
|
@ -171,7 +221,7 @@
|
|||
"Force newline": {
|
||||
"prefix": "cr",
|
||||
"description": "Force newline in math mode",
|
||||
"body": "{\\ \\\\}"
|
||||
"body": "{\\ \\\\\\\\}"
|
||||
},
|
||||
"Aligned display math": {
|
||||
"prefix": "maligned",
|
||||
|
|
|
@ -2,34 +2,22 @@
|
|||
"Definition": {
|
||||
"prefix": "definition",
|
||||
"description": "Basic purescript definition",
|
||||
"body": [
|
||||
"$1 :: $2",
|
||||
"$1 = $3"
|
||||
]
|
||||
"body": ["$1 :: $2", "$1 = $3"]
|
||||
},
|
||||
"SProxy": {
|
||||
"prefix": "sproxy",
|
||||
"description": "Generate a proxy constant",
|
||||
"body": [
|
||||
"_$1 :: Proxy \"$1\"",
|
||||
"_$1 = Proxy"
|
||||
]
|
||||
"body": ["_$1 :: Proxy \"$1\"", "_$1 = Proxy"]
|
||||
},
|
||||
"Proxy": {
|
||||
"prefix": "proxy",
|
||||
"description": "Generate a proxy constant",
|
||||
"body": [
|
||||
"_$1 :: Proxy $1",
|
||||
"_$1 = Proxy"
|
||||
]
|
||||
"body": ["_$1 :: Proxy $1", "_$1 = Proxy"]
|
||||
},
|
||||
"Prop": {
|
||||
"prefix": "prop",
|
||||
"description": "Prop lens",
|
||||
"body": [
|
||||
"_$1 :: Lens' $2 $3",
|
||||
"_$1 = prop (Proxy :: _ \"$1\")"
|
||||
]
|
||||
"body": ["_$1 :: Lens' $2 $3", "_$1 = prop (Proxy :: _ \"$1\")"]
|
||||
},
|
||||
"Variant constructor": {
|
||||
"prefix": "inj",
|
||||
|
@ -53,13 +41,7 @@
|
|||
"Example code": {
|
||||
"prefix": "ex",
|
||||
"description": "Provide example usage for some piece of code",
|
||||
"body" : [
|
||||
"-- |",
|
||||
"-- | Ex:",
|
||||
"-- | ```purs",
|
||||
"-- | $0",
|
||||
"-- | ```"
|
||||
]
|
||||
"body": ["-- |", "-- | Ex:", "-- | ```purs", "-- | $0", "-- | ```"]
|
||||
},
|
||||
"Section": {
|
||||
"prefix": "section",
|
||||
|
@ -70,5 +52,10 @@
|
|||
"prefix": "sinstances",
|
||||
"description": "Delimit a section which declares typeclass instances",
|
||||
"body": ["---------- Typeclass instances", "$0"]
|
||||
},
|
||||
"If": {
|
||||
"prefix": "if",
|
||||
"description": "If then else expression",
|
||||
"body": ["if $1", "\tthen $2", "\telse $3"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,6 +88,9 @@ main =
|
|||
("M-g", spawn myBrowser),
|
||||
("M-d", spawn "Discord"),
|
||||
("M-v", spawn "alacritty -e vimclip"),
|
||||
("M-s", spawn "spectacle -rcb"),
|
||||
("M-S-s", spawn "spectacle -mcb"),
|
||||
("M-C-s", spawn "spectacle -ucb"),
|
||||
("M-c", kill)
|
||||
]
|
||||
|
||||
|
|
|
@ -7,33 +7,6 @@
|
|||
sha256 = "13p3i0b8azkmhafyv8hc4hav1pmgqg52xzvk2a3gp3ppqqx9bwpc";
|
||||
};
|
||||
|
||||
arpeggio = fetchFromGitHub {
|
||||
owner = "kana";
|
||||
repo = "vim-arpeggio";
|
||||
rev = "01c8fc1a72ef58e490ee0490c65ee313b1b6e843";
|
||||
sha256 = "0405yp1273kzsr3g5j6mj2dfs73qvw716474phkdr67md8ln12dy";
|
||||
};
|
||||
|
||||
agda-nvim = fetchFromGitHub {
|
||||
owner = "Isti115";
|
||||
repo = "agda.nvim";
|
||||
rev = "c7da627547e978b4ac3780af1b8f418c8b12ff98";
|
||||
sha256 = "0k9g0bqm1a4ivl4cs6f780nnjnc8svc1kqif4l4ahsfzasnj7dbk";
|
||||
};
|
||||
|
||||
idris2-nvim = fetchFromGitHub {
|
||||
owner = "ShinKage";
|
||||
repo = "idris2-nvim";
|
||||
rev = "fdc47ba6f0e9d15c2754ee98b6455acad0fa7c95";
|
||||
sha256 = "1kzbgmxpywpinrjdrb4crxwlk3jlck3yia2wbl0rq7xwfga663g4";
|
||||
};
|
||||
|
||||
telescope-file-browser-nvim = fetchFromGitHub {
|
||||
owner = "nvim-telescope";
|
||||
repo = "telescope-file-browser.nvim";
|
||||
rev = "ee355b83e00475e11dec82e3ea166f846a392018";
|
||||
sha256 = "1s39si5fifv6bvjk8kzs2zy18ap5q22pfqg68wn5icnp588498hz";
|
||||
};
|
||||
};
|
||||
fishPlugins = {
|
||||
z = fetchFromGitHub {
|
||||
|
@ -47,8 +20,8 @@
|
|||
agnoster = fetchFromGitHub {
|
||||
owner = "oh-my-fish";
|
||||
repo = "theme-agnoster";
|
||||
rev = "1ffca413bfbc8941c28982eea97c1e1fa3612d57";
|
||||
sha256 = "1dvws7mrz8shca6lmnanz72zm7b2cnhg549in655inw0rk9hcbma";
|
||||
rev = "c142e802983bd1b34b4d91efac2126fc5913126d";
|
||||
sha256 = "060yydkxmvmlzq2236pjqfmpgvm3g1085c5yzilq0nl1dvmz3wnh";
|
||||
};
|
||||
|
||||
harleen = fetchFromGitHub {
|
||||
|
@ -91,14 +64,14 @@
|
|||
easy-purescript-nix = fetchFromGitHub {
|
||||
owner = "justinwoo";
|
||||
repo = "easy-purescript-nix";
|
||||
rev = "0ad5775c1e80cdd952527db2da969982e39ff592";
|
||||
sha256 = "0x53ads5v8zqsk4r1mfpzf5913byifdpv5shnvxpgw634ifyj1kg";
|
||||
rev = "3d8b602e80c0fa7d97d7f03cb8e2f8b06967d509";
|
||||
sha256 = "0kvnsc4j0h8qvv69613781i2qy51rcbmv5ga8j21nsqzy3l8fd9w";
|
||||
};
|
||||
|
||||
githubNvimTheme = fetchFromGitHub {
|
||||
owner = "projekt0n";
|
||||
repo = "github-nvim-theme";
|
||||
rev = "eeac2e7b2832d8de9a21cfa8627835304c96bb44";
|
||||
sha256 = "1rfxif39y42amkz772976l14dnsa9ybi2dpkaqbdz7zvwgwm545m";
|
||||
rev = "b3f15193d1733cc4e9c9fe65fbfec329af4bdc2a";
|
||||
sha256 = "0vnizbmzf42h3idm35nrcv4g2aigvgmgb80qk5s4xq1513bzrdf0";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue