diff --git a/home/base/desktop/neovim/astronvim_user_init.lua b/home/base/desktop/neovim/astronvim_user/init.lua similarity index 98% rename from home/base/desktop/neovim/astronvim_user_init.lua rename to home/base/desktop/neovim/astronvim_user/init.lua index 23f6a6f8..26b03bc4 100644 --- a/home/base/desktop/neovim/astronvim_user_init.lua +++ b/home/base/desktop/neovim/astronvim_user/init.lua @@ -18,7 +18,7 @@ return { { import = "astrocommunity.utility.noice-nvim" }, -- Fully featured & enhanced replacement for copilot.vim -- work with both auto completion in cmp and copilot - { import = "astrocommunity.completion.copilot-lua" }, + { import = "astrocommunity.completion.copilot-lua-cmp" }, { import = "astrocommunity.media.vim-wakatime" }, { import = "astrocommunity.motion.leap-nvim" }, { import = "astrocommunity.motion.flit-nvim" }, @@ -70,7 +70,6 @@ return { -- neovim "vim", "lua", - -- operation & cloud native "dockerfile", "hcl", diff --git a/home/base/desktop/neovim/astronvim_user/mappings.lua b/home/base/desktop/neovim/astronvim_user/mappings.lua new file mode 100644 index 00000000..139c1692 --- /dev/null +++ b/home/base/desktop/neovim/astronvim_user/mappings.lua @@ -0,0 +1,21 @@ +-- Mapping data with "desc" stored directly by vim.keymap.set(). +-- +-- Please use this mappings table to set keyboard mapping since this is the +-- lower level configuration and more robust one. (which-key will +-- automatically pick-up stored data by this setting.) +local utils = require "astronvim.utils" +return { + -- first key is the mode + n = { + -- second key is the lefthand side of the map + -- mappings seen under group name "Buffer" + ["bn"] = { "tabnew", desc = "New tab" }, + -- quick save + [""] = { ":w!", desc = "Save File" }, -- change description but the same command + ["tp"] = { function() utils.toggle_term_cmd("ipython") end, desc = "ToggleTerm python" }, + }, + t = { + -- setting a mapping to false will disable it + -- [""] = false, + }, +} diff --git a/home/base/desktop/neovim/default.nix b/home/base/desktop/neovim/default.nix index a99f7294..5e06dcac 100644 --- a/home/base/desktop/neovim/default.nix +++ b/home/base/desktop/neovim/default.nix @@ -1,10 +1,37 @@ { pkgs, astronvim, ... }: -# related folders: -# nvim's config: `~/.config/nvim` -# astronvim's user configuration: `$XDG_CONFIG_HOME/astronvim/lua/user` -# all plugins will be installed into(by lazy.nvim): `~/.local/share/nvim/` -# for details: https://astronvim.com/ +############################################################################### +# +# AstroNvim's configuration and all its dependencies +# +# Related folders: +# nvim's config: `~/.config/nvim` +# astronvim's user configuration: `$XDG_CONFIG_HOME/astronvim/lua/user` +# all plugins will be installed into(by lazy.nvim): `~/.local/share/nvim/` +# +# For details: https://astronvim.com/ +# +# Commands & shortcuts in AstroNvim +# Learn Neovim's Basics: `:Tutor` +# Opening file explorer: ` + e` +# Focus Neotree to current file: ` + o` +# Floating Terminal: ` + tf` +# Horizontal Split Terminal: ` + th` +# Vertical Split Terminal: ` + tv` +# Opening LSP symbols: ` + lS` +# Toggle buffer auto formatting: ` + uf` +# +# Switching between windows: ` + h/j/k/l` +# Resizing windows: ` + Up/Down/Left/Right` +# Horizontal Split: `\` +# Vertical Split: `|` +# Next Buffer(Tab): `]b` +# Previous Buffer(Tab): `[b` +# Close Buffer: ` + c` +# ...... +# See https://astronvim.com/Basic%20Usage/walkthrough +# +#e############################################################################# { xdg.configFile = { # base config @@ -15,10 +42,10 @@ }; # my cusotom astronvim config, astronvim will load it after base config # https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16 - "astronvim/lua/user/init.lua" = { + "astronvim/lua/user" = { # update AstroNvim onChange = "${pkgs.neovim}/bin/nvim --headless +quitall"; - source = ./astronvim_user_init.lua; + source = ./astronvim_user; }; }; @@ -103,20 +130,24 @@ # HTML/CSS/JSON/ESLint language servers extracted from vscode nodePackages.vscode-langservers-extracted - #-- cloudnative + #-- CloudNative nodePackages.dockerfile-language-server-nodejs terraform terraform-ls jsonnet jsonnet-language-server - #-- others + #-- Others taplo # TOML language server / formatter / validator nodePackages.yaml-language-server - # common + #-- Misc tree-sitter # common language parser/highlighter nodePackages.prettier # common code formatter + + #-- Optional Requirements: + gdu # disk usage analyzer, required by AstroNvim + ripgrep # fast search tool, required by AstroNvim's 'fw'( is space key) ]; };