nvim

nvim

轻量灵活的Neovim配置方案 打造高效开发环境

这是一个针对Neovim的全面配置方案,集成了LSP、Treesitter、Telescope等多种插件,支持智能补全、语法分析、快速搜索等功能。该配置适用于多种编程语言,提供代码导航、调试等开发工具,并优化了键位映射以提高操作效率。方案保持了较高的可定制性,适合不同经验水平的Neovim用户使用,有助于提升整体的开发体验。

Neovim配置插件开发环境自定义Github开源项目
<h1 align="center">My Nvim Configuration</h1> <div align="center"><p> <a href="https://github.com/neovim/neovim"> <img src="https://img.shields.io/badge/Neovim-0.10.0-blueviolet.svg?style=flat-square&logo=Neovim&color=90E59A&logoColor=white" alt="Neovim"/> </a> <a href="https://github.com/Allaman/nvim/pulse"> <img src="https://img.shields.io/github/last-commit/Allaman/nvim" alt="Last commit"/> </a> <a href="https://github.com/Allaman/nvim/issues"> <img src="https://img.shields.io/github/issues/Allaman/nvim.svg?style=flat-square&label=Issues&color=F05F40" alt="Github issues"/> </a> <a href="https://github.com/Allaman/nvim/actions/workflows/ci.yml"> <img src="https://github.com/Allaman/nvim/actions/workflows/ci.yml/badge.svg" alt="CI Status"/> </a> <a href="https://github.com/Allaman/nvim/blob/main/LICENSE"> <img src="https://img.shields.io/github/license/Allaman/nvim?style=flat-square&logo=MIT&label=License" alt="License"/> </a> </p> </div>

screenshot

💻 This configuration works on my NixOS Linux as well as on my macOS. It requires and is tested with Neovim >= 0.10. It should run with Neovim 0.9.5 but I can't recommend it.

Have a look at my rice how my Linux machine is configured and at my mac-setup how my MBP is configured. My dotfiles are also on GitHub.

More Screenshots

Terminal: alacritty

Font: Jetbrains Mono

<details> <summary>Leader Key Clusters via which-key</summary>

which-key

See ./lua/core/config/ui/which-key.lua for details.

</details> <details> <summary>Go development</summary>

go-dev

</details> <details> <summary>Debugging via DAP</summary>

dap

</details>

Motivation

There are many great Neovim configurations (see Inspiration), that give you a pleasant experience right out of the box, available. However, I am a long time (Neo)Vim user with a specific workflow and needs. Additionally, I do not have any Lua background and was not willing to spent too much time into that. Therefore, it was quite hard for me to customize and strip down the existing configs to my needs especially because the code is quite sophisticated.

I decided to move to my own fresh Lua based Neovim from my good old vimrc trying to accomplish the following principles.

Principles

  1. Migrate to Lua based alternative plugins respectively use only Lua based plugins (if possible).
  2. Keep the config as maintainable as possible knowing that this would possibly impact the code quality.
  3. Modular and meaningful directory structure and file naming.
  4. Just make it work and not make it beautiful 😃. Of course, Neovim itself must look beautiful, but my focus is not on beautiful code or on utilizing all Lua features.

Features

General ⚙️

Navigation 🧭

Coding 🖥️

Try out

If you have Docker on your system you can try out this configuration.

💡 Due to installing required tools like LSPs, CLI apps, etc. the image is approximately 3 GB large

Dockerhub

There is a GitHub action in place that builds and pushes the Docker image to Dockerhub as allaman/nvim

Just start Neovim in container

docker run --name nvim --rm -it allaman/nvim

Mount a local directory (to ~/mount) and start Neovim

docker run --name nvim --rm -it -v ${HOME}/tmp:/home/nvim/mount allaman/nvim

Start container in bash instead of Neovim

docker run --name nvim --rm -it --entrypoint=/bin/bash allaman/nvim

Build the image

You can also build the image on your own

docker build -t nvim .

Replace allaman/nvim in the former commands with just nvim.

Requirements

There are some tools that are required in order to use some features/plugins:

Run :checkhealth core to check the status.

Tools

For the neo-tree delete functionality:

For Latex functionality:

  • Tectonic (can be changed in config.lua)
  • Skim (can be changed in config.lua)

LSPs, Formatting, Linters, DAP

The following programs should be installed on your system so that the appropriate tools can be installed:

  • Go
  • Python
  • NodeJs > 12
  • Cargo

All other

All other dependencies are managed by Mason. Tools are installed by running :MasonToolsInstall (in vim.fn.std path("data") .. "mason"). Mason requirements must be available on your system.

Bindings

Some bindings can be overwritten in your user config file. See ./lua/core/config/defaults.lua for possible settings.

Modekeybinding
nspaceLeader key
n<c-h | j | k | l>Change window focus (including Tmux panes)
n<leader>TabSwitch to previously opened buffer
n<Tab>Switch to next buffer (bnext)
n<S-Tab>Switch to previous buffer (bprevious)
nstVisual selection with Treesitter hint textobject
vsaAdd surrounding
nsdDelete surrounding
nsrReplace surrounding
n<c-Tab>Start auto completion
n/vgaStart mini.align (align text)
ngccToggle line comment
n/vgcToggle line comment (works with movements like gcip)
nssJump to character(s) (flash.nvim)
i/s<c-j>Luasnip expand/forward
i/s<c-k>Luasnip backward
i<c-h>Luasnip select choice
n<c-n>Toggleterm (opens/hides a full terminal in Neovim)
i<c-l>Move out of closing brackets
n<CR>Start incremental selection
v<Tab>Increment selection
v<S-Tab>Decrement selection
n<c-f>Search buffer
i/v/n/s<c-s>Save file
n<leader>RrToggle Search and Replace (via Spectre)
n<leader>RwSearch (and replace) current word (via Spectre)
n<leader>RfSearch (and replace) in current file (via Spectre)
n<leader>RcReplace current selection (in Spectre)
n<leader>RRReplace all (in Spectre)
n:LtexLang <lang>Set a specific language like "de-DE" for ltex-ls
n<leader>mcEnable GitHub Copilot (if plugin is enabled in your user config)
n<leader>trToggle Overseer (if plugin is enabled in your user config)
n<leader>rOverseerRun (if plugin is enabled in your user config)
n<leader>lfyazi.nvim or lf.nvim (if enabled in your user config)
n<leader>tzToggle distraction free mode (if plugin is enabled in your user config)
n<leader>tFDisable auto formatting (if conform.nvim is enabled in your user config)
n<leader>tLDisable linting (if nvim-lint is enabled in your user config)

Hit <leader> to start which-key which gives you more mappings grouped by topic.

Structure

❯ tree -L 1 . . ├── after # file specific settings ├── config-example.lua # user-config file ├── init.lua # main entry point ├── lazy-lock.json # Lockfile for Lazy.nvim ├── lua # lua configuration ├── snippets # snippets directory (luasnip style) └── spell # my spell files linked from another repo
❯ tree -L 1 lua lua ├── config # Neovim config and user-config handling ├── core # checkhealth and plugins └── utils # utilities
❯ tree -L 1 lua/config lua/config ├── autocmds.lua # autocmds ├── defaults/ # default configuration ├── init.lua # entry point ├── lazy.lua # plugin management └── mappings.lua # "global" key mappings
❯ tree -L 1 lua/core lua/core ├── health.lua # :checkhealth core └── plugins # plugins and their config

Each plugin to be installed is defined in ./lua/core/plugins/ in a separate file.

User configuration

The intention of my Neovim configuration was never to be a fully customizable "distribution" like LunarVim, SpaceVim, etc. but from time to time I like to change my color scheme and the idea of making this configurable came to my mind. Based upon this idea I implemented some further lightweight configuration options that might be useful.

The default configuration can be found in ./lua/config/defaults.

You can overwrite any of this configuration by writing a .nvim_config.lua file that follows the same structure as the default table and pick only those keys that you want to modify. Have a look at my user configuration in my dots repo. The configuration file should be placed in $XDG_CONFIG_HOME, $HOME, or the windows equivalent path.

You can start with cp ./config-example.lua $HOME/.nvim_config.lua.

Remove plugins

You can remove unwanted plugins by just removing the appropriate file in ./lua/core/plugins/. Lazy will take care of removing the plugin. You should also clean up any default configurations in ./lua/config/defaults.

Keep in mind that some plugins are configured to work in conjunction with other plugins. For instance, autopairs is configured in ./lua/core/plugins/treesitter.lua. For now there is no logic implemented that cross-checks such dependencies.

Add plugins

If you want to follow my method adding a plugin is straight forward:

Create a file in ./lua/core/plugins/ following the expected format of Lazy.

Open another instance of Neovim (I always try to keep one running instance of Neovim open in case I messed up my config) and run Lazy sync.

编辑推荐精选

音述AI

音述AI

全球首个AI音乐社区

音述AI是全球首个AI音乐社区,致力让每个人都能用音乐表达自我。音述AI提供零门槛AI创作工具,独创GETI法则帮助用户精准定义音乐风格,AI润色功能支持自动优化作品质感。音述AI支持交流讨论、二次创作与价值变现。针对中文用户的语言习惯与文化背景进行专门优化,支持国风融合、C-pop等本土音乐标签,让技术更好地承载人文表达。

lynote.ai

lynote.ai

一站式搞定所有学习需求

不再被海量信息淹没,开始真正理解知识。Lynote 可摘要 YouTube 视频、PDF、文章等内容。即时创建笔记,检测 AI 内容并下载资料,将您的学习效率提升 10 倍。

AniShort

AniShort

为AI短剧协作而生

专为AI短剧协作而生的AniShort正式发布,深度重构AI短剧全流程生产模式,整合创意策划、制作执行、实时协作、在线审片、资产复用等全链路功能,独创无限画布、双轨并行工业化工作流与Ani智能体助手,集成多款主流AI大模型,破解素材零散、版本混乱、沟通低效等行业痛点,助力3人团队效率提升800%,打造标准化、可追溯的AI短剧量产体系,是AI短剧团队协同创作、提升制作效率的核心工具。

seedancetwo2.0

seedancetwo2.0

能听懂你表达的视频模型

Seedance two是基于seedance2.0的中国大模型,支持图像、视频、音频、文本四种模态输入,表达方式更丰富,生成也更可控。

nano-banana纳米香蕉中文站

nano-banana纳米香蕉中文站

国内直接访问,限时3折

输入简单文字,生成想要的图片,纳米香蕉中文站基于 Google 模型的 AI 图片生成网站,支持文字生图、图生图。官网价格限时3折活动

扣子-AI办公

扣子-AI办公

职场AI,就用扣子

AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!

堆友

堆友

多风格AI绘画神器

堆友平台由阿里巴巴设计团队创建,作为一款AI驱动的设计工具,专为设计师提供一站式增长服务。功能覆盖海量3D素材、AI绘画、实时渲染以及专业抠图,显著提升设计品质和效率。平台不仅提供工具,还是一个促进创意交流和个人发展的空间,界面友好,适合所有级别的设计师和创意工作者。

图像生成AI工具AI反应堆AI工具箱AI绘画GOAI艺术字堆友相机AI图像热门
码上飞

码上飞

零代码AI应用开发平台

零代码AI应用开发平台,用户只需一句话简单描述需求,AI能自动生成小程序、APP或H5网页应用,无需编写代码。

Vora

Vora

免费创建高清无水印Sora视频

Vora是一个免费创建高清无水印Sora视频的AI工具

Refly.AI

Refly.AI

最适合小白的AI自动化工作流平台

无需编码,轻松生成可复用、可变现的AI自动化工作流

下拉加载更多