Skip to content

Commit

Permalink
Merge pull request #27 from redyf/dev
Browse files Browse the repository at this point in the history
Neve improvements
  • Loading branch information
redyf authored Jan 31, 2024
2 parents 16bbcc0 + 61023e9 commit dc75729
Show file tree
Hide file tree
Showing 21 changed files with 340 additions and 134 deletions.
33 changes: 24 additions & 9 deletions config/colorschemes/colorscheme.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
colorschemes = {
rose-pine = {
enable = false;
style = "main"; # "main", "moon", "dawn" or raw lua code
style = "moon"; # "main", "moon", "dawn" or raw lua code
disableItalics = false;
transparentFloat = true;
transparentBackground = true;
Expand All @@ -19,18 +19,33 @@
disableUnderline = false;
transparentBackground = true;
integrations = {
cmp = true;
noice = true;
notify = true;
treesitter = true;
which_key = true;
cmp = true;
gitsigns = true;
harpoon = true;
neotree = true;
mini.enabled = true;
indent_blankline.enabled = true;
native_lsp.enabled = true;
harpoon = true;
gitsigns = true;
which_key = true;
illuminate = {
enabled = true;
};
treesitter = true;
treesitter_context = true;
telescope.enabled = true;
indent_blankline.enabled = true;
mini.enabled = true;
native_lsp = {
enabled = true;
inlay_hints = {
background = true;
};
underlines = {
errors = [ "underline" ];
hints = [ "underline" ];
information = [ "underline" ];
warnings = [ "underline" ];
};
};
};
};
};
Expand Down
67 changes: 26 additions & 41 deletions config/completion/cmp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
nvim-cmp = {
enable = true;
autoEnableSources = true;
experimental = {
ghost_text = true;
};
performance = {
debounce = 60;
fetchingTimeout = 200;
Expand All @@ -13,37 +16,25 @@
};
formatting = {
fields = [ "kind" "abbr" "menu" ];
format = ''
function(entry, vim_item)
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
vim_item.menu = ({
path = "[Path]",
nvim_lua = "[NVIM_LUA]",
nvim_lsp = "[LSP]",
luasnip = "[Snippet]",
buffer = "[Buffer]",
})[entry.source.name]
return vim_item
end
'';
};
sources = [
{
name = "nvim_lsp";
keywordLength = 1;
name = "nvim_lsp"; # lsp
}
{
name = "luasnip";
keywordLength = 1;
name = "buffer"; # text within current buffer
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
keywordLength = 3;
}
{
name = "buffer";
# Words from other open buffers can also be suggested.
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
name = "copilot"; # copilot suggestions
}
{
name = "path"; # file system paths
keywordLength = 3;
}
{
name = "path";
name = "luasnip"; # snippets
keywordLength = 3;
}
];
Expand Down Expand Up @@ -87,10 +78,10 @@
end
'';
};
"<C-n>" = {
"<C-j>" = {
action = "cmp.mapping.select_next_item()";
};
"<C-p>" = {
"<C-k>" = {
action = "cmp.mapping.select_prev_item()";
};
"<C-e>" = {
Expand All @@ -113,18 +104,12 @@
};
};
};
cmp-buffer = {
enable = true;
};
cmp_luasnip = {
enable = true;
};
cmp-nvim-lsp = {
enable = true;
};
cmp-path = {
enable = 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 Expand Up @@ -181,11 +166,11 @@
}, {
{ name = 'cmdline' }
}),
formatting = {
format = function(_, vim_item)
vim_item.kind = cmdIcons[vim_item.kind] or "FOO"
return vim_item
end
}
-- formatting = {
-- format = function(_, vim_item)
-- vim_item.kind = cmdIcons[vim_item.kind] or "FOO"
-- return vim_item
-- end
-- }
}) '';
}
51 changes: 29 additions & 22 deletions config/completion/copilot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,38 @@
enable = true;
};

keymaps = [
{
mode = "n";
key = "<leader>to";
action = "<cmd>:Copilot panel<cr>";
options = {
silent = true;
desc = "Open Copilot";
};
}
{
mode = "n";
key = "<leader>tc";
action = "<cmd>:lua require('copilot.suggestion').toggle_auto_trigger()<cr>";
options = {
silent = true;
desc = "Toggle Copilot";
};
}
];
# keymaps = [
# {
# mode = "n";
# key = "<leader>t";
# action = "+copilot";
# }
#
# {
# mode = "n";
# key = "<leader>to";
# action = "<cmd>:Copilot panel<cr>";
# options = {
# silent = true;
# desc = "Open Copilot";
# };
# }
#
# {
# mode = "n";
# key = "<leader>tc";
# action = "<cmd>:lua require('copilot.suggestion').toggle_auto_trigger()<cr>";
# options = {
# silent = true;
# desc = "Toggle Copilot";
# };
# }
# ];

extraConfigLua = ''
require('copilot').setup({
panel = {
enabled = true,
enabled = false,
auto_refresh = true,
keymap = {
jump_prev = "[[",
Expand All @@ -42,7 +49,7 @@
},
},
suggestion = {
enabled = true,
enabled = false,
auto_trigger = true,
debounce = 75,
keymap = {
Expand Down
12 changes: 12 additions & 0 deletions config/completion/lspkind.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
plugins.lspkind = {
enable = true;
symbolMap = {
Copilot = "";
};
extraOptions = {
maxwidth = 50;
ellipsis_char = "...";
};
};
}
1 change: 1 addition & 0 deletions config/dap/dap.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
plugins.dap = {
enable = true;
adapters = { };

signs = {
dapBreakpoint = {
text = "●";
Expand Down
9 changes: 6 additions & 3 deletions config/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
, pkgs
, ...
}: {
# TODO: Implement code actions + more keybinds

# Import all your configuration modules here
imports = [
./sets.nix
Expand All @@ -16,6 +14,7 @@

./completion/cmp.nix
./completion/copilot.nix
./completion/lspkind.nix

./dap/dap.nix

Expand All @@ -25,15 +24,17 @@
./git/lazygit.nix
./git/neogit.nix

./languages/nvim-jdtls.nix
./languages/nvim-lint.nix
./languages/typescript-tools-nvim.nix
./languages/treesitter/treesitter.nix
./languages/treesitter/treesitter-context.nix
./languages/treesitter/treesitter-textobjects.nix
./languages/treesitter/ts-autotag.nix
./languages/treesitter/ts-context-commentstring.nix

./lsp/lsp.nix
./lsp/conform.nix
./lsp/lsp.nix
./lsp/trouble.nix

./none-ls/none-ls.nix
Expand Down Expand Up @@ -67,7 +68,9 @@
./utils/todo-comments.nix
./utils/toggleterm.nix
./utils/undotree.nix
./utils/vim-be-good.nix
./utils/wakatime.nix
./utils/whichkey.nix
./utils/wilder.nix
];
}
6 changes: 0 additions & 6 deletions config/keymaps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@
action = "+code";
}

{
mode = "n";
key = "<leader>t";
action = "+copilot";
}

# Tabs
{
mode = "n";
Expand Down
73 changes: 73 additions & 0 deletions config/languages/nvim-jdtls.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{ pkgs, ... }: {
plugins.nvim-jdtls = {
enable = true;
cmd = [
"/nix/store/20h2hjjm94gbskqhbwikbgxbblv1xpf2-jdt-language-server-1.31.0/bin/jdtls"
];
data = "~/.cache/jdtls/workspace";
# configuration = "/path/to/configuration";
# rootDir = "require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'})";

# settings = {
# java = { };
# };
#
# initOptions = {
# bundles = { };
# };
};
# extraConfigLua = ''
# local jdtls = require("jdtls")
# local cmp_nvim_lsp = require("cmp_nvim_lsp")
#
# local root_dir = require("jdtls.setup").find_root({ "packageInfo" }, "Config")
# local home = os.getenv("HOME")
# local eclipse_workspace = home .. "/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
#
# local ws_folders_jdtls = {}
# if root_dir then
# local file = io.open(root_dir .. "/.bemol/ws_root_folders")
# if file then
# for line in file:lines() do
# table.insert(ws_folders_jdtls, "file://" .. line)
# end
# file:close()
# end
# end
#
# -- for completions
# local client_capabilities = vim.lsp.protocol.make_client_capabilities()
# local capabilities = cmp_nvim_lsp.default_capabilities(client_capabilities)
#
# local config = {
# capabilities = capabilities,
# cmd = {
# "${pkgs.jdt-language-server}/bin/jdt-language-server",
# "--jvm-arg=-javaagent:" .. home .. "/Developer/lombok.jar",
# "-data",
# eclipse_workspace,
# "--add-modules=ALL-SYSTEM",
# },
# root_dir = root_dir,
# init_options = {
# workspaceFolders = ws_folders_jdtls,
# },
# settings = {
# java = {
# signatureHelp = { enabled = true},
# completion = { enabled = true },
# },
# },
# on_attach = function(client, bufnr)
# local opts = { silent = true, buffer = bufnr }
# vim.keymap.set('n', "<leader>lo", jdtls.organize_imports, { desc = 'Organize imports', buffer = bufnr })
# vim.keymap.set('n', "<leader>df", jdtls.test_class, opts)
# vim.keymap.set('n', "<leader>dn", jdtls.test_nearest_method, opts)
# vim.keymap.set('n', '<leader>rv', jdtls.extract_variable_all, { desc = 'Extract variable', buffer = bufnr })
# vim.keymap.set('n', '<leader>rc', jdtls.extract_constant, { desc = 'Extract constant', buffer = bufnr })
# end
# }
#
# jdtls.start_or_attach(config)
# '';
}
1 change: 1 addition & 0 deletions config/languages/nvim-lint.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
typescript = [ "eslint_d" ];
typescriptreact = [ "eslint_d" ];
json = [ "jsonlint" ];
java = [ "checkstyle" ];
};
};
}
Loading

0 comments on commit dc75729

Please sign in to comment.