This is my fully customized Neovim configuration, built with Nix and the powerful Nixvim flake. Enjoy a consistent, reproducible, and easy-to-manage Neovim environment across different machines.
Option 1: Using nix run
(Easiest):
nix run github:khaneliman/khanelivim
Option 2: Adding as a Flake Input:
In your system's Nix configuration (e.g., ~/.config/nixpkgs/flake.nix or ~/.config/nixpkgs/home.nix), add the following:
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # Or your preferred channel
khanelivim.url = "github:khaneliman/khanelivim";
};
outputs = { self, nixpkgs, khanelivim }: {
# ... your other configuration ...
# Add to your system packages or devShell if you want to make it available system-wide
packages = with nixpkgs; [
khanelivim.packages.${system}.default
];
# Or, use in a devShell:
devShells.default = nixpkgs.mkShell {
nativeBuildInputs = [ khanelivim.packages.${system}.default ];
};
};
Option 3: Build and run locally:
nix build . && ./result/bin/nvim
nix flake update
nix build
./result/bin/nvim
cd ~/.config/nvim nix develop
*(If you have direnv installed, it should automatically activate the environment when you cd into the directory.)
UI/UX Enhancements:
Git Integration:
Coding Productivity:
Note Taking and Markdown:
Other:
This configuration emphasizes LSP support to enhance your coding experience with features like:
lspkind
: Provides informative icons for LSP completions.lsp-lines
: Enhances the display of LSP diagnostics within the code lines.lsp-format
: Integrates LSP formatting capabilities (if you're not using the
conform-nvim
plugin).nvim-jdtls
: Configures the Java LSP server (jdtls).The configuration includes a comprehensive list of LSP servers to support various programming languages, including:
Each server has specific settings tailored to its language, such as filetype associations, initialization options, and formatting configurations.
The configuration defines key mappings for common LSP actions under the
<leader>l
prefix:
<leader>la
: Code actions<leader>ld
: Go to definition<leader>lf
: Format code (in visual mode)<leader>lD
: Find references<leader>lt
: Go to type definition<leader>li
: Go to implementation<leader>lh
: Hover for information<leader>lr
: Rename symbolnvim-jdtls
plugin configuration is separate due to its specific
requirements.lsp-format
plugin is conditionally enabled if you're not using
conform-nvim
for formatting.Key | Action | Description |
---|---|---|
<Space> |
<NOP> |
Disable default space behavior |
<Esc> |
:noh<CR> |
Clear search highlighting |
<BS> |
<BS>x |
Delete character with backspace |
Y |
y$ |
Yank to end of line |
<C-c> |
:b#<CR> |
Switch between recent buffers |
<leader>[ |
<C-w>h |
Move to left window |
<leader>] |
<C-w>l |
Move to right window |
<C-k> |
:cnext<CR> |
Next quickfix item |
<C-j> |
:cprev<CR> |
Previous quickfix item |
<C-Up> |
:resize -2<CR> |
Decrease window height |
<C-Down> |
:resize +2<CR> |
Increase window height |
<C-Left> |
:vertical resize +2<CR> |
Increase window width |
<C-Right> |
:vertical resize -2<CR> |
Decrease window width |
<M-k> |
:move-2<CR> |
Move line up (Alt+k) |
<M-j> |
:move+<CR> |
Move line down (Alt+j) |
<Leader>w |
<Cmd>w<CR> |
Save file |
j |
v:count == 0 ? 'gj' : 'j' |
Move cursor down (smart for wrapped lines) |
k |
v:count == 0 ? 'gk' : 'k' |
Move cursor up (smart for wrapped lines) |
<Leader>q |
<Cmd>confirm q<CR> |
Quit with confirmation |
<C-n> |
<Cmd>enew<CR> |
New file |
<leader>W |
<Cmd>w!<CR> |
Force write |
<leader>Q |
<Cmd>q!<CR> |
Force quit |
| |
<Cmd>vsplit<CR> |
Vertical split |
\ |
<Cmd>split<CR> |
Horizontal split |
<leader>bC |
:%bd!<CR> |
Close all buffers |
<leader>b] |
:bnext<CR> |
Next buffer |
<TAB> |
:bnext<CR> |
Next buffer (default) |
<leader>b[ |
:bprevious<CR> |
Previous buffer |
<S-TAB> |
:bprevious<CR> |
Previous buffer |
Key | Action | Description |
---|---|---|
<leader>ud |
Lua function | Toggle buffer diagnostics |
<leader>uD |
Lua function | Toggle global diagnostics |
<leader>uf |
Lua function | Toggle buffer auto-formatting |
<leader>uF |
Lua function | Toggle global auto-formatting |
<leader>uS |
Lua function | Toggle spell check |
<leader>uw |
Lua function | Toggle word wrap |
<leader>uh |
Lua function | Toggle fold column |
<leader>uc |
Lua function | Toggle completions |
Key | Action | Description |
---|---|---|
<S-Tab> |
<gv |
Unindent line |
< |
<gv |
Unindent line |
<Tab> |
>gv |
Indent line |
> |
>gv |
Indent line |
K |
:m '<-2<CR>gv=gv |
Move selected line/block up |
J |
:m '>+1<CR>gv=gv |
Move selected line/block down |
<BS> |
x |
Delete character |
Key | Action | Description |
---|---|---|
<C-k> |
<C-o>gk |
Move line/block up |
<C-j> |
<C-o>gj |
Move line/block down |
<C-h> |
<Left> |
Move Cursor Left |
<C-l> |
<Right> |
Move Cursor Right |
For the full configuration details, please explore the flake.nix file in the repository.
Feel free to fork the repository and modify the flake.nix file to personalize your Neovim configuration. Contributing
Pull requests are welcome! If you'd like to make improvements, please open an issue or submit a PR.