Skip to content

Commit

Permalink
Merge pull request #81 from redyf/dev
Browse files Browse the repository at this point in the history
fix: error breaking neve
  • Loading branch information
redyf authored Apr 8, 2024
2 parents e6df8ef + 1e8f0ca commit 7d692c8
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 145 deletions.
154 changes: 58 additions & 96 deletions config/completion/cmp.nix
Original file line number Diff line number Diff line change
@@ -1,115 +1,77 @@
{
plugins = {
nvim-cmp = {
cmp-nvim-lsp = {enable = true;}; # lsp
cmp-buffer = {enable = true;};
copilot-cmp = {enable = true;}; # copilot suggestions
cmp-path = {enable = true;}; # file system paths
cmp_luasnip = {enable = true;}; # snippets
cmp-cmdline = {enable = false;}; # autocomplete for cmdline
cmp = {
enable = true;
autoEnableSources = true;
experimental = {
ghost_text = true;
};
performance = {
debounce = 60;
fetchingTimeout = 200;
maxViewEntries = 30;
};
snippet = {
expand = "luasnip";
};
formatting = {
fields = ["kind" "abbr" "menu"];
expandableIndicator = true;
};
window = {
completion = {
border = "rounded";
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
};
documentation = {
border = "rounded";
extraOptions = {
experimental = {
ghost_text = true;
};
};
sources = [
{
name = "nvim_lsp"; # lsp
}
{
name = "buffer"; # text within current buffer
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
keywordLength = 3;
}
{
name = "copilot"; # copilot suggestions
}
{
name = "path"; # file system paths
keywordLength = 3;
}
{
name = "luasnip"; # snippets
keywordLength = 3;
}
];
settings = {
# FIX: Fix error in mappings that's breaking Neve

mapping = {
"<Tab>" = {
modes = ["i" "s"];
action = ''
function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end
'';
};
"<S-Tab>" = {
modes = ["i" "s"];
action = ''
function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end
mapping = {
__raw = ''
cmp.mapping.preset.insert({
['<C-j>'] = cmp.mapping.select_next_item(),
['<C-k>'] = cmp.mapping.select_prev_item(),
['<C-e>'] = cmp.mapping.abort(),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<S-CR>'] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
})
'';
};
"<C-j>" = {
action = "cmp.mapping.select_next_item()";
};
"<C-k>" = {
action = "cmp.mapping.select_prev_item()";
snippet = {
expand = "function(args) require('luasnip').lsp_expand(args.body) end";
};
"<C-e>" = {
action = "cmp.mapping.abort()";
};
"<C-b>" = {
action = "cmp.mapping.scroll_docs(-4)";
};
"<C-f>" = {
action = "cmp.mapping.scroll_docs(4)";
sources = {
__raw = ''
cmp.config.sources({
{name = 'nvim_lsp'},
{name = 'copilot'},
{name = 'path'},
{name = 'luasnip'},
{name = 'cmdline'},
}, {
{name = 'buffer'},
})
'';
};
"<C-Space>" = {
action = "cmp.mapping.complete()";
performance = {
debounce = 60;
fetching_timeout = 200;
max_view_entries = 30;
};
"<CR>" = {
action = "cmp.mapping.confirm({ select = true })";
window = {
completion = {
border = "rounded";
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
};
documentation = {
border = "rounded";
};
};
"<S-CR>" = {
action = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
formatting = {
fields = ["kind" "abbr" "menu"];
expandable_indicator = true;
};
};
};
cmp-nvim-lsp = {enable = true;}; # lsp
cmp-buffer = {enable = true;};
copilot-cmp = {enable = true;}; # copilot suggestions
cmp-path = {enable = true;}; # file system paths
cmp_luasnip = {enable = true;}; # snippets
cmp-cmdline = {enable = false;}; # autocomplete for cmdline
};
extraConfigLua = ''
luasnip = require("luasnip")
Expand Down
1 change: 0 additions & 1 deletion config/git/neogit.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
plugins.neogit = {
enable = true;
disableBuiltinNotifications = true;
};
keymaps = [
{
Expand Down
5 changes: 4 additions & 1 deletion config/lsp/trouble.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
plugins.trouble = {
enable = true;
autoClose = true;
settings = {
auto_close = true;
};
};
# TODO: Add keybinds to close trouble (q would be nice), rn I need to use :x to close it...
keymaps = [
{
mode = "n";
Expand Down
12 changes: 0 additions & 12 deletions config/none-ls/none-ls.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
statix = {
enable = true;
};
luacheck = {
enable = true;
};
flake8 = {
enable = true;
};
};
formatting = {
alejandra = {
Expand All @@ -51,9 +45,6 @@
google_java_format = {
enable = true;
};
rustfmt = {
enable = true;
};
stylua = {
enable = true;
};
Expand All @@ -65,9 +56,6 @@
}
'';
};
jq = {
enable = true;
};
};
};
};
Expand Down
58 changes: 23 additions & 35 deletions config/telescope/telescope.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@
};
undo = {
enable = true;
mappings = {
i = {
"<cr>" = "yank_additions";
"<s-cr>" = "yank_deletions";
"<c-cr>" = "restore";
};
n = {
"y" = "yank_additions";
"Y" = "yank_deletions";
"u" = "restore";
};
};
};
};
# If you'd prefer Telescope not to enter a normal-like mode when hitting escape (and instead exiting), you can map <Esc> to do so via:
Expand All @@ -47,95 +35,95 @@
keymaps = {
"<leader><space>" = {
action = "find_files, {}";
desc = "Find project files";
options.desc = "Find project files";
};
"<leader>/" = {
action = "live_grep";
desc = "Grep (root dir)";
options.desc = "Grep (root dir)";
};
"<leader>:" = {
action = "command_history, {}";
desc = "Command History";
options.desc = "Command History";
};
"<leader>b" = {
action = "buffers, {}";
desc = "+buffer";
options.desc = "+buffer";
};
"<leader>ff" = {
action = "find_files, {}";
desc = "Find project files";
options.desc = "Find project files";
};
"<leader>fr" = {
action = "oldfiles, {}";
desc = "Recent";
options.desc = "Recent";
};
"<leader>fb" = {
action = "buffers, {}";
desc = "Buffers";
options.desc = "Buffers";
};
"<C-p>" = {
action = "git_files, {}";
desc = "Search git files";
options.desc = "Search git files";
};
"<leader>gc" = {
action = "git_commits, {}";
desc = "Commits";
options.desc = "Commits";
};
"<leader>gs" = {
action = "git_status, {}";
desc = "Status";
options.desc = "Status";
};
"<leader>sa" = {
action = "autocommands, {}";
desc = "Auto Commands";
options.desc = "Auto Commands";
};
"<leader>sb" = {
action = "current_buffer_fuzzy_find, {}";
desc = "Buffer";
options.desc = "Buffer";
};
"<leader>sc" = {
action = "command_history, {}";
desc = "Command History";
options.desc = "Command History";
};
"<leader>sC" = {
action = "commands, {}";
desc = "Commands";
options.desc = "Commands";
};
"<leader>sD" = {
action = "diagnostics, {}";
desc = "Workspace diagnostics";
options.desc = "Workspace diagnostics";
};
"<leader>sh" = {
action = "help_tags, {}";
desc = "Help pages";
options.desc = "Help pages";
};
"<leader>sH" = {
action = "highlights, {}";
desc = "Search Highlight Groups";
options.desc = "Search Highlight Groups";
};
"<leader>sk" = {
action = "keymaps, {}";
desc = "Keymaps";
options.desc = "Keymaps";
};
"<leader>sM" = {
action = "man_pages, {}";
desc = "Man pages";
options.desc = "Man pages";
};
"<leader>sm" = {
action = "marks, {}";
desc = "Jump to Mark";
options.desc = "Jump to Mark";
};
"<leader>so" = {
action = "vim_options, {}";
desc = "Options";
options.desc = "Options";
};
"<leader>sR" = {
action = "resume, {}";
desc = "Resume";
options.desc = "Resume";
};
"<leader>uC" = {
action = "colorscheme, {}";
desc = "Colorscheme preview";
options.desc = "Colorscheme preview";
};
};
};
Expand Down

0 comments on commit 7d692c8

Please sign in to comment.