Skip to content

Commit

Permalink
randomm
Browse files Browse the repository at this point in the history
  • Loading branch information
mosheavni committed Nov 28, 2024
1 parent ba1aef9 commit 3ce01a4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
12 changes: 12 additions & 0 deletions .config/nvim/ftplugin/json.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- When creating a new line with o, make sure there is a trailing comma on the
-- current line
vim.keymap.set('n', 'o', function()
local line = vim.api.nvim_get_current_line()

local should_add_comma = string.find(line, '[^,{[]$')
if should_add_comma then
return 'A,<cr>'
else
return 'o'
end
end, { buffer = true, expr = true })
1 change: 1 addition & 0 deletions .config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"nvim-tree.lua": { "branch": "master", "commit": "ca7c4c33cac2ad66ec69d45e465379716ef0cc97" },
"nvim-treesitter": { "branch": "master", "commit": "02f8777252fe089c9ea19aa8e19745b505512655" },
"nvim-treesitter-context": { "branch": "master", "commit": "6b081ea63a3711243d11540ce28ccdb6f35ecd33" },
"nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
"nvim-ufo": { "branch": "main", "commit": "1ebb9ea3507f3a40ce8b0489fb259ab32b1b5877" },
Expand Down
4 changes: 4 additions & 0 deletions .config/nvim/lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local M = {
end,
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
'RRethy/nvim-treesitter-endwise',
'Afourcat/treesitter-terraform-doc.nvim',
'nvim-treesitter/nvim-treesitter-context',
{ 'folke/ts-comments.nvim', opts = {} },
Expand Down Expand Up @@ -88,6 +89,9 @@ M.opts = {
enable = true,
disable = { 'yaml' },
},
endwise = {
enable = true,
},
}

M.config = function(_, opts)
Expand Down
14 changes: 7 additions & 7 deletions .config/nvim/lua/user/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -282,18 +282,18 @@ map('v', '<leader>yaa', [["hymmqeq:g?\V<c-r>h?yank E<cr>:let @"=@e<cr>`m:noh<cr>
map('v', '<leader>64', [[c<c-r>=substitute(system('base64', @"), '\n$', '', 'g')<cr><esc>]], { remap = false, silent = true, desc = 'Base64 encode' })
map('v', '<leader>46', [[c<c-r>=substitute(system('base64 --decode', @"), '\n$', '', 'g')<cr><esc>]], { remap = false, silent = true, desc = 'Base64 decode' })

-- Vimrc edit mappings
map('n', '<leader>ev', [[:execute("vsplit " . '~/.config/nvim/lua/user/options.lua')<cr>]], { silent = true })
map('n', '<leader>ep', [[:execute("vsplit " . '~/.config/nvim/lua/plugins/init.lua')<cr>]], { silent = true })
map('n', '<leader>el', [[:execute("vsplit " . '~/.config/nvim/lua/user/lsp/config.lua')<cr>]], { silent = true })
map('n', '<leader>em', [[:execute("vsplit " . '~/.config/nvim/lua/user/mappings.lua')<cr>]], { silent = true })

-- Close current buffer
map('n', '<leader>bc', ':close<cr>', { silent = true, desc = 'Close this buffer' })

-- Abbreviations
map('!a', 'dont', [[don't]], { remap = false })
map('!a', 'seperate', [[separate]], { remap = false })
map('!a', 'seperate', 'separate', { remap = false })
map('!a', 'adn', 'and', { remap = false })
map('!a', 'waht', 'what', { remap = false })
map('!a', 'tehn', 'then', { remap = false })
map('!a', 'taht', 'that', { remap = false })
map('!a', 'cehck', 'check', { remap = false })

map('!a', 'rbm', [[# TODO: remove before merging]], { remap = false })
map('!a', 'cbm', [[# TODO: change before merging]], { remap = false })
map('!a', 'ubm', [[# TODO: uncomment before merging]], { remap = false })
Expand Down

0 comments on commit 3ce01a4

Please sign in to comment.