Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mrjones2014/dotfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Jun 11, 2024
2 parents fec9c96 + b42a407 commit e368a10
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 23 deletions.
7 changes: 0 additions & 7 deletions nvim/after/ftplugin/rust.lua

This file was deleted.

38 changes: 38 additions & 0 deletions nvim/lua/my/configure/autopairs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
local function is_not_inside_nix_list()
local node = require('nvim-treesitter.ts_utils').get_node_at_cursor(0)
if not node then
return false
end
if node:type() == 'list_expression' then
return false
end
-- if top-level, then don't add `;`
local parent = node:parent()
if not parent then
return false
end
-- check a maximum of 2 parents
for _ = 1, 2 do
if not parent then
return true
end
if parent:type() == 'list_expression' then
return false
end
parent = parent:parent()
end
return true
end
return {
'windwp/nvim-autopairs',
event = { 'InsertEnter' },
config = function()
local Rule = require('nvim-autopairs.rule')
local npairs = require('nvim-autopairs')
npairs.setup({})
npairs.add_rules({
Rule('{', '};', 'nix'):with_pair(is_not_inside_nix_list),
Rule('[', '];', 'nix'):with_pair(is_not_inside_nix_list),
})
end,
}
15 changes: 0 additions & 15 deletions nvim/lua/my/configure/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,6 @@ return {
},
{ 'mrjones2014/iconpicker.nvim' },
{ 'mrjones2014/lua-gf.nvim', dev = true, ft = 'lua' },
{
'echasnovski/mini.pairs',
event = 'InsertEnter',
opts = {
mappings = {
-- https://old.reddit.com/r/neovim/comments/163rzex/how_to_avoid_autocompleting_right_parentheses/jy4zwp8/
-- disable if a matching character is in an adjacent position (eg. fixes
-- markdown triple ticks) neigh_pattern: a pattern for *two* neighboring
-- characters (before and after). Use dot `.` to allow any character.
-- Here, we disable the functionality instead of inserting a matching quote
-- if there is an adjacent non-space character
['`'] = { action = 'closeopen', pair = '``', neigh_pattern = '[^%S][^%S]', register = { cr = false } },
},
},
},
{
'echasnovski/mini.splitjoin',
keys = {
Expand Down
2 changes: 1 addition & 1 deletion nvim/lua/my/configure/language-support.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ return {
'mfussenegger/nvim-lint',
ft = vim.tbl_keys(linters_by_ft),
init = function()
vim.api.nvim_create_autocmd('BufWritePost', {
vim.api.nvim_create_autocmd({ 'BufWritePost', 'BufEnter' }, {
callback = function()
require('lint').try_lint()
end,
Expand Down
10 changes: 10 additions & 0 deletions nvim/lua/my/legendary/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ function M.default_keymaps()
end,
description = 'Toggle spellcheck',
},

{
'<C-;>',
function()
local line = vim.api.nvim_get_current_line()
vim.api.nvim_set_current_line(string.format('%s;', line))
end,
mode = 'i',
description = 'Add semicolon to end of line from insert mode',
},
}
end

Expand Down

0 comments on commit e368a10

Please sign in to comment.