-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:mrjones2014/dotfiles
- Loading branch information
Showing
5 changed files
with
49 additions
and
23 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters