Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
tomodachi94 committed Jun 20, 2024
1 parent 6609a2f commit 6c2813f
Show file tree
Hide file tree
Showing 18 changed files with 235 additions and 54 deletions.
9 changes: 9 additions & 0 deletions home/common/nvim-new/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
imports = [
./plugins
];

programs.neovim = {
enable = true;
};
}
4 changes: 4 additions & 0 deletions home/common/nvim-new/lua/tomodachi94/plugins/nerdtree.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
return function()
vim.g.NERDTreeMinimalUI = 1
vim.keymap.set("n", "<Leader>n", "<CR>:NERDTree<CR>")
end
59 changes: 59 additions & 0 deletions home/common/nvim-new/lua/tomodachi94/plugins/nvim-cmp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
return function()
-- Set up nvim-cmp.
local cmp = require("cmp")
local lspkind = require("lspkind")

vim.opt.completeopt = { "menu", "menuone", "noselect" }

cmp.setup {
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert {
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm { select = true }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
},
formatting = {
format = lspkind.cmp_format(),
},
sources = cmp.config.sources {
{ name = "nvim_lsp" },
{ name = "luasnip" }, -- For luasnip users.
{ name = "buffer" },
{ name = "git" },
},
}
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})

-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})

-- Set up lspconfig.
local capabilities = require("cmp_nvim_lsp").default_capabilities()
require("lspconfig")["lua_ls"].setup {
capabilities = capabilities,
}
end
7 changes: 7 additions & 0 deletions home/common/nvim-new/lua/tomodachi94/plugins/telescope.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return function()
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
vim.keymap.set("n", "<leader>fr", builtin.lsp_references, {})
vim.keymap.set("n", "<leader>fs", builtin.lsp_symbols, {})
end
3 changes: 3 additions & 0 deletions home/common/nvim-new/lua/tomodachi94/plugins/trouble.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return function()
require("trouble").setup()
end
45 changes: 45 additions & 0 deletions home/common/nvim-new/plugins/completion.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{ pkgs, ... }:
{
programs.neovim.plugins = [
{
plugin = pkgs.vimPlugins.nvim-cmp;
config = ''
require("lz.n").load {
"nvim-cmp",
event = "InsertEnter",
after = require("tomodachi94.plugins.nvim-cmp"),
}
'';
type = "lua";
optional = true;
}
{
plugin = pkgs.vimPlugins.cmp-buffer;
optional = true;
}
{
plugin = pkgs.vimPlugins.cmp-path;
optional = true;
}
{
plugin = pkgs.vimPlugins.cmp-nvim-lsp;
optional = true;
}
{
plugin = pkgs.vimPlugins.cmp-buffer;
optional = true;
}
{
plugin = pkgs.vimPlugins.cmp_luasnip;
optional = true;
}
{
plugin = pkgs.vimPlugins.cmp-git;
optional = true;
}
{
plugin = pkgs.vimPlugins.lspkind-nvim;
optional = true;
}
];
}
6 changes: 6 additions & 0 deletions home/common/nvim-new/plugins/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{ pkgs, ... }:
{
programs.neovim.plugins = [
pkgs.vimPlugins.lz-n
];
}
29 changes: 29 additions & 0 deletions home/common/nvim-new/plugins/filetree.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ pkgs, ... }:
{
programs.neovim.plugins = [
{
plugin = pkgs.vimPlugins.nerdtree;
config = ''
require("lz.n").load {
"nerdtree",
cmd = {
"NERDTree",
"NERDTreeVCS",
"NERDTreeFromBookmark",
"NERDTreeToggle",
"NERDTreeToggleVCS",
"NERDTreeFocus",
"NERDTreeMirror",
"NERDTreeClose",
"NERDTreeFind",
"NERDTreeCWD",
"NERDTreeRefreshRoot",
},
after = require("tomodachi94.plugins.nerdtree"),
}
'';
type = "lua";
optional = true;
}
];
}
29 changes: 29 additions & 0 deletions home/common/nvim-new/plugins/git.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ pkgs, ... }:
{
programs.neovim.plugins = [
{
plugin = pkgs.vimPlugins.vim-fugitive;
config = ''
require("lz.n").load {
"vim-fugitive",
cmd = {
"Gedit",
"Gdiffsplit",
"Gread",
"Gwrite",
"Ggrep",
"Glgrep",
"GMove",
"GRename",
"GDelete",
"GBrowse",
"G",
"Git",
},
}
'';
type = "lua";
optional = true;
}
];
}
1 change: 1 addition & 0 deletions home/common/nvim-new/plugins/insert-mode.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions home/common/nvim-new/plugins/lsp/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions home/common/nvim-new/plugins/lsp/none-ls.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions home/common/nvim-new/plugins/movement.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions home/common/nvim-new/plugins/per-language/elixir.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions home/common/nvim-new/plugins/per-language/mediawiki.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

37 changes: 37 additions & 0 deletions home/common/nvim-new/plugins/pickers.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{ pkgs, tomolib, ... }:
{
programs.neovim.plugins = [
{
plugin = pkgs.vimPlugins.telescope-nvim;
config = ''
require("lz.n").load {
"telescope",
cmd = "Telescope",
}
'';
type = "lua";
optional = true;
}
{
plugin = pkgs.vimPlugins.trouble-nvim;
config = ''
require("lz.n").load {
"trouble",
cmd = {
"Trouble",
"TroubleClose",
"TroubleToggle",
"TroubleRefresh",
},
after = function()
require("trouble").setup()
end,
}
'';
type = "lua";
optional = true;
}
];
}


1 change: 1 addition & 0 deletions home/common/nvim-new/plugins/snippets.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

54 changes: 0 additions & 54 deletions home/common/nvim/lua/tomodachi94/plugins/tools.lua
Original file line number Diff line number Diff line change
@@ -1,47 +1,3 @@
local M = {
"tpope/vim-fugitive",
lazy = true,
cmd = {
"Gedit",
"Gdiffsplit",
"Gread",
"Gwrite",
"Ggrep",
"Glgrep",
"GMove",
"GRename",
"GDelete",
"GBrowse",
"G",
"Git",
},
config = false,
dependencies = { "tpope/vim-rhubarb" },
}

local N = {
"preservim/nerdtree",
lazy = true,
cmd = {
"NERDTree",
"NERDTreeVCS",
"NERDTreeFromBookmark",
"NERDTreeToggle",
"NERDTreeToggleVCS",
"NERDTreeFocus",
"NERDTreeMirror",
"NERDTreeClose",
"NERDTreeFind",
"NERDTreeCWD",
"NERDTreeRefreshRoot",
},
}

function N.config()
vim.g.NERDTreeMinimalUI = 1
vim.keymap.set("n", "<Leader>n", "<CR>:NERDTree<CR>")
end

local O = {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" },
Expand All @@ -65,14 +21,4 @@ end

local P = { "liuchengxu/vim-which-key", lazy = true, cmd = "WhichKey" }

local Q = {
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons", "https://github.com/folke/lsp-colors.nvim" },
cmd = { "Trouble", "TroubleClose", "TroubleToggle", "TroubleRefresh" },
}

function Q.config()
require("trouble").setup {}
end

return { M, N, O, P, Q }

0 comments on commit 6c2813f

Please sign in to comment.