A cross-platform floating terminal plugin for Neovim that automatically detects and opens in your project root directory. Perfect for users who want a clean, distraction-free terminal experience within their editor.
- 🪟 Floating terminal window with customizable dimensions
- 📁 Smart project root detection based on common project markers
- 🌍 Cross-platform support (Windows, Linux, macOS, and WSL)
- 🔄 Intelligent shell detection:
- Windows: PowerShell (preferred) or cmd.exe
- Unix: Uses default shell or falls back to bash
- WSL: Proper WSL environment support
- 🎨 Clean and minimal UI with rounded borders
- ⚡ Zero dependencies - just pure Neovim
- 🔧 Fully configurable through setup options
- 🎯 Automatic project root directory detection
- 🎨 Proper terminal colors and UI integration
Using lazy.nvim
{
'Bruno-BRG/terminal.nvim',
config = function()
require('Terminal').setup({
-- Your custom config here (optional)
})
end,
}
Using packer.nvim
use {
'Bruno-BRG/terminal.nvim',
config = function()
require('Terminal').setup()
end
}
Using vim-plug
Plug 'Bruno-BRG/terminal.nvim'
After installation, add to your init.vim/init.lua:
require('Terminal').setup()
The plugin comes with these default keymaps:
<leader>t
: Open floating terminal<Esc><Esc>
: Exit terminal mode (while in terminal)
These keymaps are set up automatically when you call setup()
.
Here's the default configuration with all available options:
require('Terminal').setup({
-- Window dimensions (as percentage of editor size)
width = 0.8,
height = 0.7,
-- Window appearance
border = 'rounded', -- none, single, double, rounded, solid, shadow
style = 'minimal', -- minimal, default
-- Project root detection markers (in order of priority)
root_markers = {
'.git',
'.svn',
'.hg',
'Makefile',
'package.json',
'go.mod',
'cargo.toml',
'mix.exs',
'pom.xml',
'composer.json',
'.projectile',
'.project'
},
})
The plugin intelligently detects your project's root directory by looking for common project markers in the following order:
-
Version Control Systems:
.git
directory.svn
directory.hg
directory (Mercurial)
-
Build System & Package Managers:
Makefile
package.json
(Node.js)go.mod
(Go)cargo.toml
(Rust)mix.exs
(Elixir)pom.xml
(Maven)composer.json
(PHP)
-
Project Files:
.projectile
(Emacs projectile).project
(Eclipse)
If no markers are found, it falls back to the current working directory.
- Prioritizes PowerShell Core (pwsh) if available
- Falls back to Windows PowerShell if PowerShell Core isn't available
- Uses cmd.exe as last resort
- Proper handling of drive letter changes with
cd /d
- Uses the user's default shell ($SHELL)
- Falls back to /bin/bash if $SHELL is not set
- Proper handling of login shell initialization
- Detects WSL environment automatically
- Uses appropriate WSL shell with proper environment setup
- Maintains WSL-specific environment variables
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Created and maintained by Bruno-BRG.
If you encounter any problems or have suggestions:
- Check the Issues page first
- If your issue isn't already reported, open a new issue
- Added comprehensive cross-platform support
- Improved project root detection with more markers
- Enhanced shell detection and initialization
- Added proper WSL support
- Improved terminal UI and color handling