Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Andhar7/nvim_joz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Professional Neovim Configuration for Python & Web Development

A modern, comprehensive Neovim configuration built with Lua, optimized for Python, Django, and Web Development. Features advanced LSP support, debugging, testing, project management, and professional development workflows.

✨ Features

🎨 UI & Appearance

  • Tokyo Night colorscheme with custom transparency support
  • Alpha Dashboard with beautiful ASCII art and quick actions
  • Lualine status line with file info and git integration
  • Bufferline for elegant tab management
  • Indent Blankline for visual indentation guides
  • Relative line numbers for efficient navigation

🧠 Language Server Protocol (LSP)

  • Mason for automatic LSP server management
  • nvim-lspconfig with pre-configured servers:
    • Python (Pyright + Ruff LSP) - Advanced Python development with type checking
    • TypeScript/JavaScript - Full featured development
    • Lua (lua_ls) - Neovim configuration optimized
    • HTML/CSS - Web development essentials with Django template support
    • TailwindCSS - Utility-first CSS framework
    • Svelte - Modern web framework support
    • GraphQL - API development
    • Emmet - HTML/CSS expansion
    • Prisma - Database ORM support
    • ESLint - JavaScript/TypeScript linting
  • Diagnostics with custom icons and error handling
  • Go to definition/references with Telescope integration

🔧 Code Intelligence

  • nvim-cmp autocompletion with multiple sources:
    • LSP completion
    • GitHub Copilot integration
    • File path completion
    • Buffer text completion
    • Snippet expansion
  • LuaSnip with friendly snippets
  • Treesitter syntax highlighting for 20+ languages
  • Code actions and smart renaming
  • Incremental selection with Treesitter

🔍 Fuzzy Finding & Search

  • Telescope with multiple pickers:
    • File finder (<leader>ff)
    • Live grep (<leader>fs)
    • Recent files (<leader>fr)
    • Grep under cursor (<leader>fc)
    • Todo comments (<leader>ft)
    • Keymaps (<leader>fk)
  • FZF native for improved performance

📁 File Management & Project Tools

  • Neo-tree modern file explorer with:
    • Git integration and status indicators
    • Custom icons and advanced UI
    • Fuzzy finder integration
    • Multiple views (filesystem, buffers, git)
  • Project.nvim for intelligent project detection
  • Auto-session for project session management
  • Overseer task runner for development workflows
  • ToggleTerm integrated terminal with custom configurations

✍️ Code Editing

  • Auto-pairs for bracket completion
  • Surround for text object manipulation
  • Comment.nvim for smart commenting
  • Substitute for improved search/replace
  • Todo Comments highlighting and navigation
  • Vim Maximizer for window management

🛠️ Code Quality & Formatting

  • Conform.nvim formatting with:
    • Ruff (modern Python formatter/linter)
    • Prettier for web technologies
    • Stylua for Lua
    • Format on save enabled
  • nvim-lint with comprehensive linters:
    • MyPy for Python type checking
    • Flake8 for Python style guide enforcement
    • Bandit for Python security analysis
    • Auto-linting on file events

🐍 Python & Django Development

  • Python Configuration System:
    • Smart virtual environment detection
    • Project type detection (Django, Flask, FastAPI)
    • Python executable resolution
  • Django Integration:
    • Auto-detection of Django projects
    • Django template file type support (htmldjango)
    • Model/View/URL generators with keymaps
    • Management commands (runserver, migrate, shell, test)
  • Virtual Environment Management:
    • VenvSelector for easy environment switching
    • Swenv alternative environment manager
  • Python REPL & Debugging:
    • Iron.nvim with Django shell integration
    • nvim-dap-python for debugging with breakpoints
    • Neotest for running and debugging tests
    • Custom configurations for Django, Flask, FastAPI

🌐 Web Development Tools

  • Emmet for HTML/CSS expansion
  • Auto-tag closing for HTML/JSX/TSX
  • Color picker and preview (CCC.nvim)
  • Live server (Bracey) for real-time preview
  • Package.json management with version info
  • REST client for API testing
  • Database integration (DadBod UI)
  • Markdown preview for documentation

🎮 Git & Version Control

  • LazyGit integration for git operations
  • Diffview for advanced git diff viewing
  • Trouble for diagnostics and quickfix management
  • Spectre for advanced search and replace

📦 Installation

Prerequisites

  1. Neovim 0.9+

    # macOS
    brew install neovim
    
    # Ubuntu/Debian
    sudo apt install neovim
    
    # Arch Linux
    sudo pacman -S neovim
  2. Git (for plugin management)

  3. Node.js 16+ (for LSP servers and web tools)

  4. Python 3.8+ (for Python LSP and linting)

  5. Ripgrep (for Telescope grep)

    # macOS
    brew install ripgrep
    
    # Ubuntu/Debian
    sudo apt install ripgrep
    
    # Arch Linux
    sudo pacman -S ripgrep
  6. Optional but Recommended:

    • LazyGit for git operations: brew install lazygit
    • FZF for enhanced fuzzy finding: brew install fzf
    • fd for faster file finding: brew install fd

Setup

  1. Backup existing configuration (if any):

    mv ~/.config/nvim ~/.config/nvim.backup
  2. Clone this configuration:

    git clone https://github.com/yourusername/nvim-config ~/.config/nvim
  3. Install external dependencies:

    # Install Node.js formatters
    npm install -g prettier eslint
    
    # Install Python development tools
    pip install ruff black isort mypy bandit debugpy
    
    # Install Stylua (Lua formatter)
    # macOS
    brew install stylua
    
    # Ubuntu/Debian
    sudo apt install stylua
    
    # Or download from releases: https://github.com/JohnnyMorganz/StyLua/releases
    
    # Optional: Install additional Python tools
    pip install ipython jupyter  # Enhanced Python REPL
  4. Launch Neovim:

    nvim
  5. Plugin installation:

    • Lazy.nvim will automatically install all plugins on first launch
    • LSP servers will be automatically installed via Mason
    • Wait for all installations to complete

⌨️ Key Mappings

General

Key Action Description
<Space> Leader key Main leader key
jk <ESC> Exit insert mode
<leader>nh Clear highlights Clear search highlights
<leader>+ Increment number Increment number under cursor
<leader>- Decrement number Decrement number under cursor

Window Management

Key Action Description
<leader>sv Split vertically Split window vertically
<leader>sh Split horizontally Split window horizontally
<leader>se Equalize splits Make split windows equal size
<leader>sx Close split Close current split window

Tab Management

Key Action Description
<leader>to New tab Open new tab
<leader>tx Close tab Close current tab
<leader>tn Next tab Go to next tab
<leader>tp Previous tab Go to previous tab
<leader>tf Tab from buffer Open current buffer in new tab

File Explorer (Neo-tree)

Key Action Description
<leader>e Toggle explorer Toggle Neo-tree file explorer
<leader>o Focus explorer Focus Neo-tree

Fuzzy Finding (Telescope)

Key Action Description
<leader>ff Find files Fuzzy find files in cwd
<leader>fr Recent files Fuzzy find recent files
<leader>fs Live grep Find string in cwd
<leader>fc Grep cursor Find string under cursor
<leader>ft Find todos Find todo comments
<leader>fk Find keymaps Show all keymaps

LSP

Key Action Description
gR Show references Show LSP references
gD Go to declaration Go to declaration
gd Show definitions Show LSP definitions
gi Show implementations Show LSP implementations
gt Type definitions Show LSP type definitions
<leader>ca Code actions See available code actions
<leader>rn Rename Smart rename
<leader>D Buffer diagnostics Show buffer diagnostics
<leader>d Line diagnostics Show line diagnostics
[d Previous diagnostic Go to previous diagnostic
]d Next diagnostic Go to next diagnostic
K Hover documentation Show documentation
<leader>rs Restart LSP Restart LSP server

Autocompletion (nvim-cmp)

Key Action Description
<C-k> Previous item Previous completion item
<C-j> Next item Next completion item
<C-b> Scroll docs up Scroll documentation up
<C-f> Scroll docs down Scroll documentation down
<C-Space> Complete Show completion suggestions
<C-e> Abort Close completion window
<CR> Confirm Confirm selection

Python & Django Development

Key Action Description
<leader>pr Run Python file Execute current Python file
<leader>pa Activate venv Activate virtual environment
<leader>cv Select virtual env Choose virtual environment
<leader>dr Django runserver Start Django development server
<leader>ds Django shell Open Django shell
<leader>dt Django test Run Django tests
<leader>dM Django makemigrations Create Django migrations
<leader>dmi Django migrate Apply Django migrations
<leader>dm Create Django model Generate Django model template
<leader>dv Create Django view Generate Django view template
<leader>du Add Django URL Add Django URL pattern

Testing & Debugging

Key Action Description
<leader>tt Run nearest test Run test under cursor
<leader>tf Run file tests Run all tests in current file
<leader>td Debug nearest test Debug test under cursor
<leader>ts Toggle test summary Show/hide test results
<leader>to Show test output Display test output
<F5> Start debugging Start DAP debugger
<F10> Step over Debug step over
<F11> Step into Debug step into
<F12> Step out Debug step out
<leader>b Toggle breakpoint Set/remove breakpoint

REPL & Terminal

Key Action Description
<leader>is Start/Toggle REPL Open Iron REPL
<leader>ir Restart REPL Restart REPL
<leader>sc Send code to REPL Send selection/motion to REPL
<leader>sf Send file to REPL Send entire file to REPL
<leader>sl Send line to REPL Send current line to REPL
<leader>tf Toggle float term Open floating terminal
<leader>th Toggle horizontal Open horizontal terminal
<leader>tv Toggle vertical Open vertical terminal
<leader>gg Toggle LazyGit Open LazyGit interface
<leader>tp Toggle Python REPL Open Python REPL in terminal

Web Development

Key Action Description
<leader>cp Color picker Open color picker
<leader>ct Convert color Convert color format
<leader>ch Toggle color highlight Toggle color highlighting
<leader>bs Start live server Start Bracey live server
<leader>bq Stop live server Stop live server
<leader>br Reload live server Reload live server
<leader>rr Run REST request Execute HTTP request
<leader>rl Run last request Re-run last HTTP request
<leader>db Toggle Database UI Open/close database interface
<leader>mp Markdown preview Toggle markdown preview

Project Management

Key Action Description
<leader>fp Find projects Search and switch projects
<leader>ot Toggle task runner Open Overseer task runner
<leader>or Run task Execute project task
<leader>oa Quick task action Quick task management
<leader>S Open Spectre Advanced search and replace
<leader>sw Search current word Search word under cursor
<leader>sf Search in file Search within current file

Git Integration

Key Action Description
<leader>gd Open Diffview View git diff
<leader>gc Close Diffview Close git diff view

Formatting & Linting

Key Action Description
<leader>mp Format Format file or range
<leader>l Lint Trigger linting for current file

Treesitter

Key Action Description
<C-space> Init/expand selection Start or expand selection
<bs> Shrink selection Shrink selection

🗂️ Project Structure

~/.config/nvim/
├── init.lua                    # Entry point
├── lazy-lock.json             # Plugin version lock file
├── README.md                  # This documentation
├── lua/kling/
│   ├── core/
│   │   ├── init.lua           # Core module loader
│   │   ├── keymaps.lua        # Global key mappings
│   │   └── options.lua        # Neovim options
│   ├── lazy.lua               # Lazy.nvim setup
│   ├── python-config.lua      # Python utilities and configuration
│   └── plugins/
│       ├── init.lua           # Plugin loader
│       ├── alpha.lua          # Dashboard
│       ├── auto-session.lua   # Session management
│       ├── autopairs.lua      # Auto bracket pairing
│       ├── bufferline.lua     # Tab bar
│       ├── colorscheme.lua    # Tokyo Night theme
│       ├── comment.lua        # Smart commenting
│       ├── copilot.lua        # GitHub Copilot integration
│       ├── dap-python.lua     # Python debugging
│       ├── django.lua         # Django development tools
│       ├── dressing.lua       # UI improvements
│       ├── formatting.lua     # Code formatting
│       ├── indent-blankline.lua # Indentation guides
│       ├── iron.lua           # REPL integration
│       ├── lazygit.lua        # Git integration
│       ├── linting.lua        # Code linting
│       ├── lualine.lua        # Status line
│       ├── neogen.lua         # Documentation generation
│       ├── neotest.lua        # Testing framework
│       ├── nvim-cmp.lua       # Autocompletion
│       ├── nvim-dap.lua       # Debug Adapter Protocol
│       ├── nvim-tree.lua      # File explorer
│       ├── project-management.lua # Project tools
│       ├── substitute.lua     # Search/replace
│       ├── surround.lua       # Text objects
│       ├── telescope.lua      # Fuzzy finder
│       ├── todo-comments.lua  # Todo highlighting
│       ├── treesitter.lua     # Syntax highlighting
│       ├── trouble.lua        # Diagnostics panel
│       ├── venv-selector.lua  # Virtual environment management
│       ├── vim-maximizer.lua  # Window management
│       ├── web-dev.lua        # Web development tools
│       └── lsp/
│           ├── lspconfig.lua  # LSP configuration
│           └── mason.lua      # LSP server management

🎨 Customization

Colorscheme

The configuration uses Tokyo Night with custom transparency. To modify:

-- In lua/kling/plugins/colorscheme.lua
local transparent = true -- Toggle transparency
-- Modify colors in the on_colors function

Adding New LSP Servers

  1. Automatic installation via Mason (recommended):

    -- In lua/kling/plugins/lsp/mason.lua
    ensure_installed = {
      "lua_ls",
      "pyright",
      "ruff_lsp",
      "your_new_server", -- Add here
    }
  2. Manual configuration:

    -- In lua/kling/plugins/lsp/lspconfig.lua
    lspconfig.your_server.setup({
      capabilities = capabilities,
      -- Your specific configuration
    })

Adding Formatters

-- In lua/kling/plugins/formatting.lua
formatters_by_ft = {
  python = { "ruff_format", "ruff_organize_imports" },
  javascript = { "prettier" },
  your_filetype = { "your_formatter" },
}

Custom Key Mappings

Add to lua/kling/core/keymaps.lua:

keymap.set("n", "<leader>your_key", "<cmd>YourCommand<CR>", { desc = "Your description" })

🔧 Troubleshooting

LSP Issues

  1. Check server installation: :Mason
  2. Restart LSP: <leader>rs
  3. Check logs: :LspLog
  4. Python-specific issues:
    • Ensure correct Python interpreter: <leader>cv to select virtual env
    • Check if Pyright is using correct Python: :LspInfo
    • Restart after changing virtual environment

Plugin Issues

  1. Update plugins: :Lazy update
  2. Clean and reinstall: :Lazy clean then restart Neovim
  3. Check plugin status: :Lazy
  4. Profile startup time: :Lazy profile

Performance Issues

  1. Check startup time: nvim --startuptime startup.log
  2. Profile plugins: :Lazy profile

Python/Django Specific Issues

  1. Virtual Environment Not Detected:

    • Use <leader>cv to manually select environment
    • Check if venv is in standard locations (venv/, .venv/, env/)
    • Ensure Python executable is accessible
  2. Django Features Not Working:

    • Ensure manage.py exists in project root
    • Django commands require proper virtual environment
    • Check if Django is installed: python -m django --version
  3. Debugging Issues:

    • Install debugpy: pip install debugpy
    • Check DAP configuration: :lua =vim.tbl_keys(require('dap').configurations.python)

Formatter Not Working

  1. Check if formatter is installed: Run formatter command in terminal
  2. Check conform setup: :ConformInfo
  3. Python formatting: Ensure ruff is installed: pip install ruff

📚 Learning Resources

General Neovim

Python & Django Development

Web Development

Plugin Development

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

📄 License

This configuration is open source and available under the MIT License.

🙏 Acknowledgments

This configuration is built upon the excellent work of the Neovim community and the following plugin authors:

Special Features of This Configuration

  • Professional Python Development: Comprehensive Django support with project detection
  • Modern Tooling: Ruff LSP for fast Python linting and formatting
  • Advanced Debugging: Full DAP integration with Python, Django, Flask, FastAPI configurations
  • Intelligent Virtual Environment Management: Automatic detection and switching
  • Web Development Ready: Complete toolchain for modern web development
  • Project-Aware: Smart project detection and management

Happy coding! 🎉

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages