aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-10-01 17:40:04 +0800
committercrupest <crupest@outlook.com>2023-10-01 17:40:04 +0800
commit2396c7525c26e5d8b2afbdca814e73d2ed2b2b91 (patch)
tree2ef2947e8a8afa6c4e8bb7172d3700a3c50f8d95
parent9a9cd716024cb74dd88a5625dd657a099844a56e (diff)
downloadcrupest-2396c7525c26e5d8b2afbdca814e73d2ed2b2b91.tar.gz
crupest-2396c7525c26e5d8b2afbdca814e73d2ed2b2b91.tar.bz2
crupest-2396c7525c26e5d8b2afbdca814e73d2ed2b2b91.zip
Update nvim config.
-rw-r--r--configs/nvim/init.lua92
-rw-r--r--configs/nvim/lazy-lock.json17
-rw-r--r--configs/nvim/lua/crupest/filesystem-cmd.lua49
-rw-r--r--configs/nvim/lua/open_project.lua17
-rw-r--r--configs/nvim/lua/plugins/bufferline-nvim.lua3
-rw-r--r--configs/nvim/lua/plugins/catppuccin-nvim.lua6
-rw-r--r--configs/nvim/lua/plugins/everforest.lua5
-rw-r--r--configs/nvim/lua/plugins/neo-tree-nvim.lua9
-rw-r--r--configs/nvim/lua/plugins/nvim-tree.lua4
-rw-r--r--configs/nvim/lua/plugins/tokyonight-nvim.lua7
-rw-r--r--configs/nvim/lua/plugins/trouble-nvim.lua3
-rw-r--r--configs/nvim/lua/plugins/which-key-nvim.lua3
12 files changed, 86 insertions, 129 deletions
diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua
index 1944c46..bb1eb97 100644
--- a/configs/nvim/init.lua
+++ b/configs/nvim/init.lua
@@ -1,7 +1,3 @@
--- disable netrw for nvim-tree
-vim.g.loaded_netrw = 1
-vim.g.loaded_netrwPlugin = 1
-
if not vim.uv then
vim.uv = vim.loop
end
@@ -56,33 +52,23 @@ vim.opt.rtp:prepend(lazypath)
-- Use lazy.nvim
require("lazy").setup("plugins")
--- setup nvim-tree
-require("nvim-tree").setup()
-
-local nvim_tree_api = require("nvim-tree.api")
-vim.api.nvim_create_autocmd("DirChanged", {
- pattern = "global",
- callback = function(args)
- nvim_tree_api.tree.change_root(args.file)
- end
+-- setup neo-tree
+require("neo-tree").setup({
+ filesystem = {
+ filtered_items = {
+ hide_dotfiles = true,
+ hide_gitignored = true,
+ hide_hidden = true, -- only works on Windows for hidden files/directories
+ }
+ }
})
-- setup lualine
-require('lualine').setup()
-
--- setup bufferline
-require("bufferline").setup {
+require('lualine').setup({
options = {
- offsets = {
- {
- filetype = "NvimTree",
- text = "File Explorer",
- highlight = "Directory",
- separator = true
- }
- }
+ theme = "auto", -- Can also be "auto" to detect automatically.
}
-}
+})
-- setup gitsigns
require('gitsigns').setup()
@@ -300,9 +286,6 @@ if omnisharp_cmd then
}
end
--- setup trouble
-require("trouble").setup()
-
-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
@@ -335,9 +318,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
end,
})
-vim.cmd [[colorscheme tokyonight-night]]
-
--- custom keymapss
+vim.cmd("colorscheme everforest")
-- For terminal emulator
vim.keymap.set('t', '<leader><esc>', [[<C-\><C-n>]])
@@ -350,8 +331,7 @@ vim.keymap.set('n', '<leader>b', builtin.buffers, {})
vim.keymap.set('n', '<leader>h', builtin.help_tags, {})
-- setup ketmap for tree
-vim.keymap.set('n', '<leader>tt', nvim_tree_api.tree.toggle, {})
-vim.keymap.set('n', '<leader>tr', '<cmd>NvimTreeRefresh<cr>')
+vim.keymap.set('n', '<leader>t', "<cmd>Neotree toggle<cr>", {})
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
vim.keymap.set('n', '<leader>le', vim.diagnostic.open_float)
@@ -367,46 +347,4 @@ vim.keymap.set("n", "<s-tab>", "<c-o>")
vim.keymap.set("n", "<c-q>", require("crupest.nvim").win_close_buf)
vim.keymap.set("n", "<esc>", require("crupest.nvim").close_float)
-vim.api.nvim_create_user_command("Mv", function(opts)
- require("crupest.nvim").mv_buf_file(vim.api.nvim_get_current_buf(), opts.fargs[1])
-end, {
- nargs = 1,
- complete = "file"
-})
-
-vim.api.nvim_create_user_command("MvFile", function(opts)
- if (#opts.fargs ~= 2) then
- vim.notify("MvFile accepts exactly two arguments, old file and new file.")
- end
- require("crupest.nvim").mv_file(opts.fargs[1], opts.fargs[2])
-end, {
- nargs = "+",
- complete = "file"
-})
-
-vim.api.nvim_create_user_command("MvDir", function(opts)
- if (#opts.fargs ~= 2) then
- vim.notify("MvDir accepts exactly two arguments, old dir and new dir.")
- end
- require("crupest.nvim").mv_dir(opts.fargs[1], opts.fargs[2])
-end, {
- nargs = "+",
- complete = "file"
-})
-
-vim.api.nvim_create_user_command("Rename", function(opts)
- require("crupest.nvim").rename_buf_file(vim.api.nvim_get_current_buf(), opts.fargs[1])
-end, {
- nargs = 1,
- complete = "file"
-})
-
-vim.api.nvim_create_user_command("RenameFile", function(opts)
- if (#opts.fargs ~= 2) then
- vim.notify("RenameFile accepts exactly two arguments, old file and new file.")
- end
- require("crupest.nvim").rename_file(opts.fargs[1], opts.fargs[2])
-end, {
- nargs = "+",
- complete = "file"
-})
+require("crupest.filesystem-cmd").setup_filesystem_user_commands()
diff --git a/configs/nvim/lazy-lock.json b/configs/nvim/lazy-lock.json
index 59040e3..b1a40a4 100644
--- a/configs/nvim/lazy-lock.json
+++ b/configs/nvim/lazy-lock.json
@@ -1,25 +1,24 @@
{
"LuaSnip": { "branch": "master", "commit": "480b032f6708573334f4437d3f83307d143f1a72" },
- "bufferline.nvim": { "branch": "main", "commit": "6ecd37e0fa8b156099daedd2191130e083fb1490" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
+ "everforest": { "branch": "master", "commit": "83b666410d7ae0eccf96dbbe3b4b6ac5b8172d38" },
"formatter.nvim": { "branch": "master", "commit": "34dcdfa0c75df667743b2a50dd99c84a557376f0" },
"gitsigns.nvim": { "branch": "main", "commit": "bdeba1cec3faddd89146690c10b9a87949c0ee66" },
- "lazy.nvim": { "branch": "main", "commit": "0e1d264ab6567725b6c30ffd1ad120b16884ff45" },
+ "lazy.nvim": { "branch": "main", "commit": "59335c5b9d116f5d3948f833288a89e2a829a005" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
+ "neo-tree.nvim": { "branch": "main", "commit": "7e2a3caf999e2028abb643eb0472f351b2777591" },
+ "nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
"nvim-autopairs": { "branch": "master", "commit": "de4f7138a68d5d5063170f2182fd27faf06b0b54" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
- "nvim-lint": { "branch": "master", "commit": "67f74e630a84ecfa73a82783c487bdedd8cecdc3" },
- "nvim-lspconfig": { "branch": "master", "commit": "bfdf2e91e7297a54bcc09d3e092a12bff69a1cf4" },
- "nvim-tree.lua": { "branch": "master", "commit": "934469b9b6df369e198fb3016969e56393b0dc07" },
+ "nvim-lint": { "branch": "master", "commit": "1065763f115a7765ef237347ad676ba348d7193a" },
+ "nvim-lspconfig": { "branch": "master", "commit": "7ec2ab0cb8f529708dba55964fb0a59d3cc21853" },
"nvim-web-devicons": { "branch": "master", "commit": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82" },
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "53edfb413a54c9e55dcddc9e9fa4977a897e4425" },
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
- "telescope.nvim": { "branch": "master", "commit": "84d53dfdbefbdf84e861a288abc71ef8ccafd04e" },
- "toggleterm.nvim": { "branch": "main", "commit": "61e8ad370d4da5d84c77e31671027bc094ac06ca" },
- "tokyonight.nvim": { "branch": "main", "commit": "8e670218651eaf02bf61c68ecdfdaa572bc14b47" },
- "trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" }
+ "telescope.nvim": { "branch": "master", "commit": "ffe90fac32122f401429b14d383137bd92a685d0" },
+ "toggleterm.nvim": { "branch": "main", "commit": "61e8ad370d4da5d84c77e31671027bc094ac06ca" }
} \ No newline at end of file
diff --git a/configs/nvim/lua/crupest/filesystem-cmd.lua b/configs/nvim/lua/crupest/filesystem-cmd.lua
new file mode 100644
index 0000000..3148cef
--- /dev/null
+++ b/configs/nvim/lua/crupest/filesystem-cmd.lua
@@ -0,0 +1,49 @@
+local function setup_filesystem_user_commands()
+ vim.api.nvim_create_user_command("Mv", function(opts)
+ require("crupest.nvim").mv_buf_file(vim.api.nvim_get_current_buf(), opts.fargs[1])
+ end, {
+ nargs = 1,
+ complete = "file"
+ })
+
+ vim.api.nvim_create_user_command("MvFile", function(opts)
+ if (#opts.fargs ~= 2) then
+ vim.notify("MvFile accepts exactly two arguments, old file and new file.")
+ end
+ require("crupest.nvim").mv_file(opts.fargs[1], opts.fargs[2])
+ end, {
+ nargs = "+",
+ complete = "file"
+ })
+
+ vim.api.nvim_create_user_command("MvDir", function(opts)
+ if (#opts.fargs ~= 2) then
+ vim.notify("MvDir accepts exactly two arguments, old dir and new dir.")
+ end
+ require("crupest.nvim").mv_dir(opts.fargs[1], opts.fargs[2])
+ end, {
+ nargs = "+",
+ complete = "file"
+ })
+
+ vim.api.nvim_create_user_command("Rename", function(opts)
+ require("crupest.nvim").rename_buf_file(vim.api.nvim_get_current_buf(), opts.fargs[1])
+ end, {
+ nargs = 1,
+ complete = "file"
+ })
+
+ vim.api.nvim_create_user_command("RenameFile", function(opts)
+ if (#opts.fargs ~= 2) then
+ vim.notify("RenameFile accepts exactly two arguments, old file and new file.")
+ end
+ require("crupest.nvim").rename_file(opts.fargs[1], opts.fargs[2])
+ end, {
+ nargs = "+",
+ complete = "file"
+ })
+end
+
+return {
+ setup_filesystem_user_commands = setup_filesystem_user_commands
+}
diff --git a/configs/nvim/lua/open_project.lua b/configs/nvim/lua/open_project.lua
deleted file mode 100644
index 5228143..0000000
--- a/configs/nvim/lua/open_project.lua
+++ /dev/null
@@ -1,17 +0,0 @@
-local a = require'plenary.async'
-:with
-local context_manager = require "plenary.context_manager"
-local with = context_manager.with
-local open = context_manager.open
-
-local err, stat = a.fs_stat("./.project");
-assert(not error, ".project file does not exist, you should run this script at project root.")
-
--- open nvim tree
-local nvim_tree_api = require("nvim-tree.api")
-nvim_tree_api.open()
-
--- open terminal
-vim.cmd("split")
-vim.cmd
-
diff --git a/configs/nvim/lua/plugins/bufferline-nvim.lua b/configs/nvim/lua/plugins/bufferline-nvim.lua
deleted file mode 100644
index 216ca59..0000000
--- a/configs/nvim/lua/plugins/bufferline-nvim.lua
+++ /dev/null
@@ -1,3 +0,0 @@
-return {
- 'akinsho/bufferline.nvim'
-}
diff --git a/configs/nvim/lua/plugins/catppuccin-nvim.lua b/configs/nvim/lua/plugins/catppuccin-nvim.lua
deleted file mode 100644
index 87782a9..0000000
--- a/configs/nvim/lua/plugins/catppuccin-nvim.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-return {
- "catppuccin/nvim",
- name = "catppuccin",
- priority = 1000
-}
-
diff --git a/configs/nvim/lua/plugins/everforest.lua b/configs/nvim/lua/plugins/everforest.lua
new file mode 100644
index 0000000..191339d
--- /dev/null
+++ b/configs/nvim/lua/plugins/everforest.lua
@@ -0,0 +1,5 @@
+return {
+ "sainnhe/everforest",
+ lazy = false,
+ priority = 1000, -- make sure to load this before all the other start plugins
+}
diff --git a/configs/nvim/lua/plugins/neo-tree-nvim.lua b/configs/nvim/lua/plugins/neo-tree-nvim.lua
new file mode 100644
index 0000000..bbd954d
--- /dev/null
+++ b/configs/nvim/lua/plugins/neo-tree-nvim.lua
@@ -0,0 +1,9 @@
+return {
+ "nvim-neo-tree/neo-tree.nvim",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
+ "MunifTanjim/nui.nvim",
+ }
+}
+
diff --git a/configs/nvim/lua/plugins/nvim-tree.lua b/configs/nvim/lua/plugins/nvim-tree.lua
deleted file mode 100644
index 4ead963..0000000
--- a/configs/nvim/lua/plugins/nvim-tree.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-return {
- "nvim-tree/nvim-tree.lua",
- lazy = false,
-}
diff --git a/configs/nvim/lua/plugins/tokyonight-nvim.lua b/configs/nvim/lua/plugins/tokyonight-nvim.lua
deleted file mode 100644
index 11c8b15..0000000
--- a/configs/nvim/lua/plugins/tokyonight-nvim.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-return {
- "folke/tokyonight.nvim",
- lazy = false,
- priority = 1000,
- opts = {},
-}
-
diff --git a/configs/nvim/lua/plugins/trouble-nvim.lua b/configs/nvim/lua/plugins/trouble-nvim.lua
deleted file mode 100644
index b84aa33..0000000
--- a/configs/nvim/lua/plugins/trouble-nvim.lua
+++ /dev/null
@@ -1,3 +0,0 @@
-return {
- "folke/trouble.nvim"
-}
diff --git a/configs/nvim/lua/plugins/which-key-nvim.lua b/configs/nvim/lua/plugins/which-key-nvim.lua
deleted file mode 100644
index 31aca45..0000000
--- a/configs/nvim/lua/plugins/which-key-nvim.lua
+++ /dev/null
@@ -1,3 +0,0 @@
-return {
- "folke/which-key.nvim"
-}