add undotree mapping, format

This commit is contained in:
2023-06-04 12:13:11 +03:00
parent b424ac2685
commit 64d948cdf3
8 changed files with 99 additions and 80 deletions

View File

@@ -61,4 +61,3 @@ vim.cmd("ab thursday Thursday")
vim.cmd("ab friday Friday") vim.cmd("ab friday Friday")
vim.cmd("ab saturday Saturday") vim.cmd("ab saturday Saturday")
vim.cmd("ab sunday Sunday") vim.cmd("ab sunday Sunday")

View File

@@ -8,11 +8,14 @@ M.config = function()
-- we fall back to the various language tools installed with pwnvim using this hack -- we fall back to the various language tools installed with pwnvim using this hack
local initial_path = vim.env.PATH local initial_path = vim.env.PATH
autocmd("User DirenvLoaded", autocmd("User DirenvLoaded",
{ callback = function() {
callback = function()
if not string.find(vim.env.PATH, initial_path, 0, true) then if not string.find(vim.env.PATH, initial_path, 0, true) then
vim.env.PATH = vim.env.PATH .. ":" .. initial_path vim.env.PATH = vim.env.PATH .. ":" .. initial_path
end end
end, group = filetypes }) end,
group = filetypes
})
autocmd("BufRead", { pattern = { "*.markdown", "*.md" }, command = "setlocal filetype=markdown", group = filetypes }) autocmd("BufRead", { pattern = { "*.markdown", "*.md" }, command = "setlocal filetype=markdown", group = filetypes })
autocmd("BufRead", { pattern = { "*.sbt" }, command = "setlocal filetype=scala", group = filetypes }) autocmd("BufRead", { pattern = { "*.sbt" }, command = "setlocal filetype=scala", group = filetypes })
@@ -25,28 +28,39 @@ M.config = function()
autocmd("BufRead", { pattern = { "flake.lock" }, command = "setlocal filetype=json", group = filetypes }) autocmd("BufRead", { pattern = { "flake.lock" }, command = "setlocal filetype=json", group = filetypes })
autocmd("FileType", autocmd("FileType",
{ pattern = { "sql", "mysql", "plsql" }, {
pattern = { "sql", "mysql", "plsql" },
callback = function() require('cmp').setup.buffer({ sources = { { name = 'vim-dadbod-completion' } } }) end, callback = function() require('cmp').setup.buffer({ sources = { { name = 'vim-dadbod-completion' } } }) end,
group = filetypes }) group = filetypes
})
autocmd("FileType", autocmd("FileType",
{ pattern = { "c", "ruby", "php", "php3", "perl", "python", "mason", "vim", "sh", "zsh", "scala", "javascript", {
pattern = { "c", "ruby", "php", "php3", "perl", "python", "mason", "vim", "sh", "zsh", "scala", "javascript",
"javascriptreact", "typescript", "typescriptreact", "html", "svelte", "css", "nix", "terraform" }, "javascriptreact", "typescript", "typescriptreact", "html", "svelte", "css", "nix", "terraform" },
callback = function() require('pwnvim.options').programming() end, group = filetypes }) callback = function() require('pwnvim.options').programming() end,
group = filetypes
})
autocmd("FileType", autocmd("FileType",
{ pattern = { "lua", "xml" }, callback = function() require('pwnvim.filetypes').lua() end, group = filetypes }) { pattern = { "lua", "xml" }, callback = function() require('pwnvim.filetypes').lua() end, group = filetypes })
autocmd("FileType", autocmd("FileType",
{ pattern = { "md", "markdown", "vimwiki" }, callback = function() require('pwnvim.markdown').setup() end, {
group = filetypes }) pattern = { "md", "markdown", "vimwiki" },
-- autocmd("FileType", callback = function() require('pwnvim.markdown').setup() end,
-- { pattern = { "rust" }, callback = function() require('pwnvim.filetypes').rust() end, group = filetypes }) group = filetypes
})
-- autocmd("FileType",
-- { pattern = { "rust" }, callback = function() require('pwnvim.filetypes').rust() end, group = filetypes })
autocmd("FileType", autocmd("FileType",
{ pattern = { "Outline" }, command = "setlocal nospell", group = filetypes }) { pattern = { "Outline" }, command = "setlocal nospell", group = filetypes })
autocmd("TermOpen", { pattern = { "*" }, command = "setlocal nospell", group = filetypes }) autocmd("TermOpen", { pattern = { "*" }, command = "setlocal nospell", group = filetypes })
-- Run when page pager is invoked -- Run when page pager is invoked
autocmd('User', autocmd('User',
{ pattern = { 'PageOpen', 'PageOpenFile' }, group = filetypes, {
callback = function() require('pwnvim.filetypes').page() end }) pattern = { 'PageOpen', 'PageOpenFile' },
group = filetypes,
callback = function() require('pwnvim.filetypes').page() end
})
end end
-- M.rust = function() -- M.rust = function()

View File

@@ -153,7 +153,8 @@ local leader_mappings = {
l = { "<cmd>lua require('telescope.builtin').loclist()<cr>", "Loclist" }, l = { "<cmd>lua require('telescope.builtin').loclist()<cr>", "Loclist" },
p = { "<cmd>Telescope projects<cr>", "Projects" }, p = { "<cmd>Telescope projects<cr>", "Projects" },
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" }, k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
t = { "<cmd>lua require('telescope.builtin').grep_string{search = \"^\\\\s*[*-] \\\\[ \\\\]\", previewer = false, glob_pattern = \"*.md\", use_regex = true, disable_coordinates=true}<cr>", t = {
"<cmd>lua require('telescope.builtin').grep_string{search = \"^\\\\s*[*-] \\\\[ \\\\]\", previewer = false, glob_pattern = \"*.md\", use_regex = true, disable_coordinates=true}<cr>",
"Todos" }, "Todos" },
n = { "<Cmd>ZkNotes { match = {vim.fn.input('Search: ')} }<CR>", "Find" }, n = { "<Cmd>ZkNotes { match = {vim.fn.input('Search: ')} }<CR>", "Find" },
}, },
@@ -198,10 +199,12 @@ local leader_mappings = {
}, },
h = { "<cmd>edit ~/Notes/Notes/HotSheet.md<CR>", "Open HotSheet" }, h = { "<cmd>edit ~/Notes/Notes/HotSheet.md<CR>", "Open HotSheet" },
i = { i = {
c = { "<cmd>r!/opt/homebrew/bin/icalBuddy --bullet '* ' --timeFormat '\\%H:\\%M' --dateFormat '' --noPropNames --noCalendarNames --excludeAllDayEvents --includeCals 'IC - Work' --includeEventProps datetime,title,attendees,location --propertyOrder datetime,title,attendees,location --propertySeparators '| |\\n * |\\n * | |' eventsToday<cr>", c = {
"<cmd>r!/opt/homebrew/bin/icalBuddy --bullet '* ' --timeFormat '\\%H:\\%M' --dateFormat '' --noPropNames --noCalendarNames --excludeAllDayEvents --includeCals 'IC - Work' --includeEventProps datetime,title,attendees,location --propertyOrder datetime,title,attendees,location --propertySeparators '| |\\n * |\\n * | |' eventsToday<cr>",
"Insert today's calendar" }, "Insert today's calendar" },
o = { "<cmd>r!gtm-okr goals<cr>", "Insert OKRs" }, o = { "<cmd>r!gtm-okr goals<cr>", "Insert OKRs" },
j = { "<cmd>r!( (curl -s https://icanhazdadjoke.com/ | grep '\\\"subtitle\\\"') || curl -s https://icanhazdadjoke.com/ ) | sed 's/<[^>]*>//g' | sed -z 's/\\n/ /'<cr>", j = {
"<cmd>r!( (curl -s https://icanhazdadjoke.com/ | grep '\\\"subtitle\\\"') || curl -s https://icanhazdadjoke.com/ ) | sed 's/<[^>]*>//g' | sed -z 's/\\n/ /'<cr>",
"Insert joke" }, "Insert joke" },
}, },
m = { m = {
@@ -456,6 +459,9 @@ which_key.register({
}, { mode = 'n', silent = true }) }, { mode = 'n', silent = true })
-- Undotree
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
-- Close buffer -- Close buffer
vim.api.nvim_set_keymap('', '<D-w>', ':Bdelete<CR>', options) vim.api.nvim_set_keymap('', '<D-w>', ':Bdelete<CR>', options)
vim.api.nvim_set_keymap('!', '<D-w>', '<ESC>:Bdelete<CR>', options) vim.api.nvim_set_keymap('!', '<D-w>', '<ESC>:Bdelete<CR>', options)