Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Update nvim config
Browse files Browse the repository at this point in the history
  • Loading branch information
DataEraserC committed Dec 29, 2023
1 parent 8d7e943 commit 481dc07
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 28 deletions.
19 changes: 14 additions & 5 deletions home/common/modules/neovim/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AstroNvim Configuration and Shortcuts
# Neovim Editor

My Neovim config based on [AstroNvim](https://github.com/AstroNvim/AstroNvim).
For more details, visit the [AstroNvim website](https://astronvim.com/).
Expand Down Expand Up @@ -33,6 +33,19 @@ Remove all unused plugins:
![](/_img/astronvim_2023-07-13_00-39.webp)
![](/_img/hyprland_2023-07-29_2.webp)

## Terminal Related

I used to use Neovim's terminal related shortcuts frequently, but now **I switched my daily terminal environment to zellij**,
which provides a more powerful and stable terminal experience, so I don't use neovim's terminal feature anymore.

So here is zellij's terminal shortcuts I use frequently now:

| Action | Zellij's Shortcut |
| ------------------------- | ------------------ |
| Floating Terminal | `Ctrl + <p> + <w>` |
| Horizontal Split Terminal | `Ctrl + <p> + <d>` |
| Vertical Split Terminal | `Ctrl + <p> + <n>` |

## Visual Modes

| Action | Shortcut |
Expand Down Expand Up @@ -94,10 +107,6 @@ Provided by [flash.nvim](https://github.com/folke/flash.nvim), it's a intelligen
| Learn Neovim's Basics | `:Tutor` |
| Open file explorer | `<Space> + e` |
| Focus Neotree to current file | `<Space> + o` |
| Floating Terminal | `<Space> + tf` |
| Horizontal Split Terminal | `<Space> + th` |
| Vertical Split Terminal | `<Space> + tv` |
| Open IPython REPL | `<Space> + tp` |
| Toggle line wrap | `<Space> + uw` |
| Show line diagnostics | `gl` |
| Show function/variable info | `K` |
Expand Down
52 changes: 39 additions & 13 deletions home/common/modules/neovim/astronvim_user/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ return {
spell = false, -- Spell checking
swapfile = false, -- Swapfile
smartindent = false, -- fix https://github.com/ryan4yin/nix-config/issues/4
title = true, -- Set the title of window to `filename [+=-] (path) - NVIM`
-- The percentage of 'columns' to use for the title
-- When the title is longer, only the end of the path name is shown.
titlelen = 20,
},
},

Expand All @@ -17,7 +21,7 @@ return {
{ import = "astrocommunity.colorscheme.catppuccin" },
-- Highly experimental plugin that completely replaces
-- the UI for messages, cmdline and the popupmenu.
{ import = "astrocommunity.utility.noice-nvim" },
-- { import = "astrocommunity.utility.noice-nvim" },
-- Fully featured & enhanced replacement for copilot.vim
-- <Tab> work with both auto completion in cmp and copilot
{ import = "astrocommunity.media.vim-wakatime" },
Expand All @@ -38,25 +42,28 @@ return {
{ import = "astrocommunity.pack.json" },
{ import = "astrocommunity.pack.yaml" },
{ import = "astrocommunity.pack.toml" },
---- Backend
---- Backend / System
{ import = "astrocommunity.pack.lua" },
{ import = "astrocommunity.pack.go" },
{ import = "astrocommunity.pack.rust" },
{ import = "astrocommunity.pack.python" },
{ import = "astrocommunity.pack.java" },
{ import = "astrocommunity.pack.cmake" },
{ import = "astrocommunity.pack.cpp" },
-- { import = "astrocommunity.pack.nix" }, -- manually add config for nix, comment this one.
{ import = "astrocommunity.pack.proto" },
---- Operation & Cloud Native
{ import = "astrocommunity.pack.terraform" },
{ import = "astrocommunity.pack.bash" },
{ import = "astrocommunity.pack.cmake" },
{ import = "astrocommunity.pack.cpp" },
{ import = "astrocommunity.pack.docker" },
{ import = "astrocommunity.pack.helm" },
-- Motion
{ import = "astrocommunity.motion.mini-surround" },
-- https://github.com/echasnovski/mini.ai
{ import = "astrocommunity.motion.mini-ai" },
{ import = "astrocommunity.motion.flash-nvim" },
-- diable toggleterm.nvim, zellij's terminal is far better than neovim's one
{ "akinsho/toggleterm.nvim", enabled = false },
{ "folke/flash.nvim", vscode = false },
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
{ import = "astrocommunity.motion.nvim-spider" },
Expand All @@ -73,20 +80,21 @@ return {
end,
},

{
"skyfireitdiy/codegeex-vim",
},

{
"neoclide/coc.nvim",
},

{
"0x00-ketsu/autosave.nvim",
-- lazy-loading on events
event = { "InsertLeave", "TextChanged" },
opts = function(_, opts)
opts.prompt_style = "notify" -- or stdout
opts.prompt_style = "stdout" -- notify or stdout
end,
},

-- Provide a comparable s-expression editing experience in Neovim to that provided by Emacs.
-- https://github.com/julienvincent/nvim-paredit
{
"julienvincent/nvim-paredit",
config = function()
require("nvim-paredit").setup()
end,
},

Expand Down Expand Up @@ -250,6 +258,13 @@ return {
"regex",
"terraform",
"nix",
"csv",
-- other programming language
"diff",
"gitignore",
"gitcommit",
"latex",
"sql",
})
end,
},
Expand Down Expand Up @@ -394,6 +409,17 @@ return {
})
end,
},

-- The plugins required by Mayuri
-- AI prompt for programming
{
"skyfireitdiy/codegeex-vim",
},
-- Language Servers
{
"neoclide/coc.nvim",
},

},

-- Configure require("lazy").setup() options
Expand Down
2 changes: 0 additions & 2 deletions home/common/modules/neovim/astronvim_user/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ return {
-- NOTE: https://neovim.io/doc/user/builtin.html#jobstart()
-- 1. If {cmd} is a List it runs directly (no 'shell')
-- 2. If {cmd} is a String it runs in the 'shell'
["<leader>tp"] = { function() utils.toggle_term_cmd({ cmd = "ipython" }) end, desc = "ToggleTerm python" },

-- search and replace globally
['<leader>ss'] = {'<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" },
['<leader>sw'] = {'<cmd>lua require("spectre").open_visual({select_word=true})<CR>', desc = "Search current word" },
Expand Down
43 changes: 35 additions & 8 deletions home/common/modules/neovim/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
pkgs,
pkgs-unstable,
astronvim,
...
}:
Expand All @@ -12,7 +11,10 @@
{
xdg.configFile = {
# astronvim's config
"nvim".source = astronvim;
"nvim" = {
source = astronvim;
force = true;
};

# my custom astronvim config, astronvim will load it after base config
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
Expand All @@ -34,21 +36,28 @@
vimAlias = true;

# currently we use lazy.nvim as neovim's package manager, so comment this one.
# plugins = with pkgs.vimPlugins; [
# # search all the plugins using https://search.nixos.org/packages
# ];
# Install packages that will compile locally or download FHS binaries via Nix!
# and use lazy.nvim's `dir` option to specify the package directory in nix store.
# so that these plugins can work on NixOS.
#
# related project:
# https://github.com/b-src/lazy-nix-helper.nvim
plugins = with pkgs.vimPlugins; [
# search all the plugins using https://search.nixos.org/packages
telescope-fzf-native-nvim
];

# Extra packages only available to nvim(won't pollute the global home environment)
extraPackages = with pkgs-unstable;
extraPackages = with pkgs;
[
#-- c/c++
cmake
cmake-language-server
gnumake
ccache
checkmake
gcc # c/c++ compiler, required by nvim-treesitter!
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
gdb
lldb

#-- python
Expand All @@ -65,6 +74,24 @@
requests
pyquery
pyyaml
pip # use in venv "python -m venv .venv" "source .venv/bin/activate"

ipykernel
jupyterlab
matplotlib
numpy
seaborn
networkx
beautifulsoup4
selenium
urllib3
pyclip
pybluez
pymysql
jieba
# wordcloud
pandas-datareader
pyperclip
]
))

Expand Down Expand Up @@ -131,7 +158,6 @@
actionlint # GitHub Actions linter
buf # protoc plugin for linting and formatting
proselint # English prose linter
guile # scheme language

#-- Misc
tree-sitter # common language parser/highlighter
Expand All @@ -150,6 +176,7 @@
else [
#-- verilog / systemverilog
verible
gdb
]
);
};
Expand Down

0 comments on commit 481dc07

Please sign in to comment.