Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/khaneliman/khanelivim

Dotfiles for neovim configuration
https://github.com/khaneliman/khanelivim

astronvim lsp neovim neovim-dotfiles plugins

Last synced: 21 days ago
JSON representation

Dotfiles for neovim configuration

Awesome Lists containing this project

README

        

# Khanelivim: My Nix-Powered Neovim Configuration

This is my fully customized Neovim configuration, built with Nix and the
powerful [Nixvim flake](https://github.com/nix-community/nixvim). Enjoy a
consistent, reproducible, and easy-to-manage Neovim environment across different
machines.

![Screenshot](assets/screenshot.png)

## Key Features

- **Nixvim for Declarative Configuration:** Leverage Nix expressions for a clean
and maintainable Neovim setup. Easily add, remove, or update plugins, LSP
servers, and other components.
- **Consistent Environments:** Reproduce your Neovim setup effortlessly on any
system with Nix installed.
- **Plugin Management:** Seamlessly manage plugins using Nixvim's declarative
configuration.
- **LSP Integration:** Built-in support for language servers and completion
tools.
- **Customization:** Adapt to your preferences with additional plugins, themes,
and key mappings (details below).

## Prerequisites

- **Nix Package Manager:** Ensure Nix is installed on your system. Follow the
instructions at
[https://nixos.org/download.html](https://nixos.org/download.html).

## Installation

**Option 1: Using `nix run` (Easiest):**

```bash
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:

```nix
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:**

```bash
nix build . && ./result/bin/nvim
```

### Updating

```bash
nix flake update
```

### Rebuild your Neovim:

```bash
nix build
```

### Run the updated Neovim:

```bash
./result/bin/nvim
```

### Enter Nix Shell:

```bash
cd ~/.config/nvim nix develop
```

*(If you have direnv installed, it should automatically activate the environment
when you cd into the directory.)

## Plugins

- UI/UX Enhancements:
- bufferline: A buffer line to show open buffers
- catppuccin: A color theme with a focus on aesthetics
- lualine: A highly customizable statusline
- mini.nvim: A collection of minimalist plugins
- neo-tree: A file explorer
- noice.nvim: A highly customizable notification system
- which-key: A popup that displays possible keybindings
- yazi: A plugin that is the best way to navigate filesystems

- Git Integration:
- git-conflict: A plugin to help resolve git conflicts
- git-worktree: A plugin to help manage git worktrees
- gitsigns.nvim: A plugin that provides git integration

- Coding Productivity:
- cmp: A completion engine
- codeium: An AI powered autocompletion tool
- conform.nvim: A formatter
- dap: A debugger adapter protocol
- illuminate: A plugin that highlights occurrences of the word under the
cursor
- leap: A motion plugin to jump to any word in the visible text
- lightbulb: A plugin that shows a lightbulb when code actions are available
- lsp: Language server protocol integration
- navic: A navigation plugin that uses lsp symbols to provide a breadcrumb
trail
- neotest: A test runner
- nvim-treesitter: A parser for better syntax highlighting and code navigation
- project.nvim: A project management plugin
- refactoring: A plugin to help with refactoring code
- telescope: A fuzzy finder
- trouble.nvim: A diagnostics list

- Note Taking and Markdown:
- neorg: A note taking plugin
- markdown-preview: A plugin to preview markdown files
- markview: A plugin to view markdown files

- Other:
- colorizer: A plugin that shows colors in css, scss, sass, html, and
javascript files
- debugprint: A plugin that makes it easier to debug print statements
- diffview: A plugin to view diffs
- dirtytalk: A plugin that provides some funny messages
- efm: A file manager
- glow.nvim: A markdown previewer
- harpoon: A plugin to mark and quickly navigate between files
- hop.nvim: A plugin to quickly jump to any location on the screen
- indent-blankline.nvim: A plugin that shows indent lines
- smartcolumn: A plugin to automatically adjust column widths
- spectre: A search and replace tool
- statuscol: A plugin to show git status in the sign column
- todo-comments: A plugin to highlight todo comments
- toggleterm: A terminal emulator
- undotree: A plugin to visualize the undo tree
- wakatime: A plugin that tracks your time spent coding
- wilder: A fuzzy finder
- yanky: A clipboard manager

## LSP (Language Server Protocol) Configuration

This configuration emphasizes LSP support to enhance your coding experience with
features like:

- Diagnostics: Visual feedback for errors, warnings, hints, and information
using symbols (e.g., ❌ for errors).
- Navigation: Quickly jump to definitions, references, implementations, and type
definitions.
- Code Actions: Access context-aware suggestions for code improvements.
- Hover Information: Get detailed information about symbols by hovering over
them.
- Rename: Refactor symbols accurately across your codebase.
- Formatting: Automatically format your code (either through a dedicated
formatter or LSP capabilities).

### Key LSP Plugins:

- `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).

### LSP Servers:

The configuration includes a comprehensive list of LSP servers to support
various programming languages, including:

- Bash/Shell (bashls)
- C/C++ (ccls, clangd)
- CMake (cmake)
- C# (csharp-ls)
- CSS/Less/SCSS (cssls)
- Docker (dockerls)
- JavaScript/TypeScript (eslint, tsserver)
- F# (fsautocomplete)
- Godot (gdscript)
- HTML (html)
- Java (java-language-server or jdt-language-server)
- JSON (jsonls)
- Lua (lua-ls)
- Markdown (marksman)
- Nix (nil-ls)
- Python (pyright)
- Rust (rust-analyzer, optionally if not using rustaceanvim)
- SQL (sqls)
- TOML (taplo)
- YAML (yamlls)

Each server has specific settings tailored to its language, such as filetype
associations, initialization options, and formatting configurations.

### Custom Keymappings:

The configuration defines key mappings for common LSP actions under the
`l` prefix:

- `la`: Code actions
- `ld`: Go to definition
- `lf`: Format code (in visual mode)
- `lD`: Find references
- `lt`: Go to type definition
- `li`: Go to implementation
- `lh`: Hover for information
- `lr`: Rename symbol

### Additional Notes:

- You can enable/disable specific LSP servers based on your needs.
- The `nvim-jdtls` plugin configuration is separate due to its specific
requirements.
- The `lsp-format` plugin is conditionally enabled if you're not using
`conform-nvim` for formatting.
- You can further customize the LSP behavior in your Neovim config.

## Key Mappings

### Normal Mode

| Key | Action | Description |
| ------------ | --------------------------- | ------------------------------------------ |
| `` | `` | Disable default space behavior |
| `` | `:noh` | Clear search highlighting |
| `` | `x` | Delete character with backspace |
| `Y` | `y$` | Yank to end of line |
| `` | `:b#` | Switch between recent buffers |
| `[` | `h` | Move to left window |
| `]` | `l` | Move to right window |
| `` | `:cnext` | Next quickfix item |
| `` | `:cprev` | Previous quickfix item |
| `` | `:resize -2` | Decrease window height |
| `` | `:resize +2` | Increase window height |
| `` | `:vertical resize +2` | Increase window width |
| `` | `:vertical resize -2` | Decrease window width |
| `` | `:move-2` | Move line up (Alt+k) |
| `` | `:move+` | Move line down (Alt+j) |
| `w` | `w` | 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) |
| `q` | `confirm q` | Quit with confirmation |
| `` | `enew` | New file |
| `W` | `w!` | Force write |
| `Q` | `q!` | Force quit |
| `\|` | `vsplit` | Vertical split |
| `\` | `split` | Horizontal split |
| `bC` | `:%bd!` | Close all buffers |
| `b]` | `:bnext` | Next buffer |
| `` | `:bnext` | Next buffer (default) |
| `b[` | `:bprevious` | Previous buffer |
| `` | `:bprevious` | Previous buffer |

### Toggle Mappings

| Key | Action | Description |
| ------------ | ------------ | ----------------------------- |
| `ud` | Lua function | Toggle buffer diagnostics |
| `uD` | Lua function | Toggle global diagnostics |
| `uf` | Lua function | Toggle buffer auto-formatting |
| `uF` | Lua function | Toggle global auto-formatting |
| `uS` | Lua function | Toggle spell check |
| `uw` | Lua function | Toggle word wrap |
| `uh` | Lua function | Toggle fold column |
| `uc` | Lua function | Toggle completions |

### Visual Mode

| Key | Action | Description |
| --------- | ------------------ | ----------------------------- |
| `` | `` | `>gv` | Indent line |
| `>` | `>gv` | Indent line |
| `K` | `:m '<-2gv=gv` | Move selected line/block up |
| `J` | `:m '>+1gv=gv` | Move selected line/block down |
| `` | `x` | Delete character |

### Insert Mode

| Key | Action | Description |
| ------- | --------- | -------------------- |
| `` | `gk` | Move line/block up |
| `` | `gj` | Move line/block down |
| `` | `` | Move Cursor Left |
| `` | `` | Move Cursor Right |

For the full configuration details, please explore the flake.nix file in the
repository.

## Customization / Contributing

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.