diff --git a/dotfiles/neovim/lua/my/keymaps.lua b/dotfiles/neovim/lua/my/keymaps.lua index bdf671b..f4471e5 100644 --- a/dotfiles/neovim/lua/my/keymaps.lua +++ b/dotfiles/neovim/lua/my/keymaps.lua @@ -25,6 +25,7 @@ function M.setup() -- Create chords if arpeggio ~= nil then + arpeggio.chord("n", "vs", "v") -- Create vertical split arpeggio.chord("n", "vs", "v") -- Create vertical split arpeggio.chord("n", "ji", ":w") -- Saving arpeggio.chord("i", "jk", "") -- Remap Esc to jk diff --git a/dotfiles/neovim/lua/my/plugins/telescope.lua b/dotfiles/neovim/lua/my/plugins/telescope.lua index 6f84bb0..d3217c6 100644 --- a/dotfiles/neovim/lua/my/plugins/telescope.lua +++ b/dotfiles/neovim/lua/my/plugins/telescope.lua @@ -4,85 +4,86 @@ local arpeggio = require("my.plugins.arpeggio") local M = {} local bindings = { - builtin = { - -- Open files with control + P - find_files = "", + builtin = { + -- Open files with control + P + find_files = "", - -- Search through files with control + F - live_grep = "", + -- Search through files with control + F + live_grep = "", - -- See diagnostics with space + d - diagnostics = "d", + -- See diagnostics with space + d + diagnostics = "d", + lsp_document_symbols = { chord = 1, key = "lds" }, - -- Open a list with all the pickers - builtin = "t", + -- Open a list with all the pickers + builtin = "t", - -- List function, var names etc - treesitter = "s", + -- List function, var names etc + treesitter = "s", - -- Git stuff - git_commits = "gj", - git_branches = "gk" - }, - ["extensions.file_browser.file_browser"] = {chord = 1, key = "jp"}, - extensions = { - unicode = { - picker = {mode = "i", kind = "dropdown", key = "ui", chord = 1} - } + -- Git stuff + git_commits = "gj", + git_branches = "gk" + }, + ["extensions.file_browser.file_browser"] = { chord = 1, key = "jp" }, + extensions = { + unicode = { + picker = { mode = "i", kind = "dropdown", key = "ui", chord = 1 } } + } } 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 + 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 - 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 - end - - -- Maps the keybind to the action - bind(mode, key, - "lua require('telescope" .. path .. "')." .. name .. "(" .. - pickerArgument .. ")") + 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 + end + + -- Maps the keybind to the action + bind(mode, key, + "lua require('telescope" .. path .. "')." .. name .. "(" .. + pickerArgument .. ")") end + end end function M.setup() - setupKeybinds(bindings) + setupKeybinds(bindings) - local settings = { - defaults = {mappings = {i = {[""] = "which_key"}}}, - pickers = {find_files = {hidden = true}}, - extensions = { - file_browser = { - mappings = { - -- Comment so this does not get collapsed - } - } + local settings = { + defaults = { mappings = { i = { [""] = "which_key" } } }, + pickers = { find_files = { hidden = true } }, + extensions = { + file_browser = { + mappings = { + -- Comment so this does not get collapsed } + } } + } - require("telescope").setup(settings) - require("telescope").load_extension "file_browser" + require("telescope").setup(settings) + require("telescope").load_extension "file_browser" end return M diff --git a/dotfiles/vscode-snippets/snippets/purescript/deriving.json b/dotfiles/vscode-snippets/snippets/purescript/deriving.json index ff8d748..0154d85 100644 --- a/dotfiles/vscode-snippets/snippets/purescript/deriving.json +++ b/dotfiles/vscode-snippets/snippets/purescript/deriving.json @@ -1,6 +1,6 @@ { "Derive newtype instance": { - "prefix": "nderive", + "prefix": "gnderive", "description": "Use newtype deriving on any typeclass", "body": "derive newtype instance $0 $3 $2" }, @@ -13,7 +13,7 @@ ] }, "Generic": { - "prefix": "generic", + "prefix": "dgeneric", "description": "Generate the generic instance for a type", "body": "derive instance Generic $1 _" }, @@ -52,8 +52,26 @@ ] }, "Functor": { - "prefix": "functor", + "prefix": "dfunctor", "description": "Derive a Functor instance", "body": "derive instance Functor $1$0" + }, + "Eq": { + "prefix": "deq", + "description": "Derive an Eq instance", + "body": "derive instance Eq $1$0" + }, + "Ord": { + "prefix": "dord", + "description": "Derive an Ord instance", + "body": "derive instance Ord $1$0" + }, + "Eq & Ord": { + "prefix": "deqord", + "description": "Derive an Eq and an Ord instance", + "body": [ + "derive instance Eq $1", + "derive instance Ord $1$0" + ] } } diff --git a/dotfiles/vscode-snippets/snippets/purescript/imports.json b/dotfiles/vscode-snippets/snippets/purescript/imports.json index 19e88a3..0e30856 100644 --- a/dotfiles/vscode-snippets/snippets/purescript/imports.json +++ b/dotfiles/vscode-snippets/snippets/purescript/imports.json @@ -33,5 +33,20 @@ "prefix": "impavar", "description": "import AVar module", "body": "import Effect.Aff.AVar as AV" + }, + "Object": { + "prefix": "impobject", + "description": "import Foreign.Object module", + "body": "import Foreign.Object as Object" + }, + "STObject": { + "prefix": "impstobject", + "description": "import STObject module", + "body": "import Foreign.Object.ST as STObject" + }, + "Ref": { + "prefix": "impref", + "description": "import Effect.Ref module", + "body": "import Effect.Ref as Ref" } } diff --git a/dotfiles/vscode-snippets/snippets/purescript/other.json b/dotfiles/vscode-snippets/snippets/purescript/other.json index d804abf..8002e5d 100644 --- a/dotfiles/vscode-snippets/snippets/purescript/other.json +++ b/dotfiles/vscode-snippets/snippets/purescript/other.json @@ -60,5 +60,15 @@ "-- | $0", "-- | ```" ] + }, + "Section": { + "prefix": "section", + "description": "Delimit a section using 10 dashes", + "body" : "---------- $0" + }, + "Typeclass instances": { + "prefix": "sinstances", + "description": "Delimit a section which declares typeclass instances", + "body" : ["---------- Typeclass instances", "$0"] } }