Coder Social home page Coder Social logo

neelfrost / nvim-config Goto Github PK

View Code? Open in Web Editor NEW
120.0 5.0 3.0 371 KB

Personal neovim configuration⚑πŸͺŸ - Fully configured for LaTeX, Python, Lua, C#, HTML, CSS, and Javascript - Neovim version: v0.9+

License: MIT License

Lua 73.97% Vim Snippet 20.90% Vim Script 5.13%
neovim neovim-dotfiles neovim-configuration neovim-config neovim-lua latex latex-ide windows

nvim-config's Introduction

nvim-config

Just another opinionated, visually appealing Neovim IDE.
Configured for Windows, supports LaTeX, Python, Lua, C#, HTML, CSS, and Javascript.

license stars forks

Table of Contents

Screenshots πŸ“·

start time file explorer file navigation latex latex python

Installation ⚑

The following instructions are for Windows (powershell). An admin prompt is required.

  1. Install chocolatey.

    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  2. Install main dependencies.

    choco install -y git.install --params "/GitAndUnixToolsOnPath /NoGitLfs /SChannel /NoShellIntegration";
    choco install -y neovim python SumatraPDF.install miktex.install;
    # Needed for various plugins
    choco install -y universal-ctags strawberryperl make SQLite ripgrep fd golang; refreshenv; exit
    
  3. Install python dependencies.

    pip install pynvim neovim-remote
    
  4. Clone the repository and open nvim-qt or nvim.

    For fresh installation:

    git clone https://github.com/Neelfrost/nvim-config.git "$HOME\Appdata\Local\nvim"; nvim-qt.exe
    

    For existing config:

    ren "$HOME\Appdata\Local\nvim" 'nvim-old'; git clone https://github.com/Neelfrost/nvim-config.git "$HOME\Appdata\Local\nvim"; nvim-qt.exe
    

LaTeX

Formatting (latexindent)

latexindent is now included with miktex, so downloading it separately is no longer necessary. Moreover, null-ls is pre-configured to run latexindent on save for tex files. Global formatting rules can be changed by:

  1. Creating $HOME/indentconfig.yaml:

    paths:
      - C:\Users\<username>\defaultSettings.yaml
  2. Creating $HOME/defaultSettings.yaml, followed by copying and overriding defaultSettings.

For further reading refer: docs.

Viewing PDF

To launch SumatraPDF using VimTeX (\lv), ensure SumatraPDF.exe is added to environment path.

Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path -Value $((Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path).path + ";" + "$HOME\AppData\Local\SumatraPDF" + ";"); refreshenv; exit

Inverse Search

For inverse search, open SumatraPDF then go to Settings -> Options and set inverse search command-line to:

cmd /c start /min nvim --headless -c "PackerLoad vimtex" -c "VimtexInverseSearch %l '%f'"

Use :checkhealth to check for errors if any.

Language Servers

Python (pyright)

  1. Install npm.

    choco install -y nodejs.install; refreshenv; exit
    
  2. Install pyright.

    npm install -g pyright
    
  3. Install black, isort, and flake for formatting and linting.

    pip install flake8 black isort
    
  4. Use :checkhealth to check for errors if any.

Lua (LuaLs)

  1. Install dependencies.

    choco install -y 7zip.install; refreshenv; exit
    
  2. cd into install directory. For example:

    cd C:\tools
    
  3. Install LuaLs.

    curl.exe -L $(curl.exe -s https://api.github.com/repos/LuaLS/lua-language-server/releases/latest | findstr.exe "win32-x64" | %{"$($_.Split('"')[3])"} | findstr.exe "github") -o luals.zip; 7z.exe x .\luals.zip -olua-language-server; rm luals.zip
  4. Add LuaLs to environment path.

    Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path -Value $((Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path).path + ";" + "C:\tools\lua-language-server\bin" + ";"); refreshenv; exit
  5. Install stylua for formatting.

    curl.exe -L $(curl.exe -s https://api.github.com/repos/JohnnyMorganz/StyLua/releases/latest | findstr.exe "win64.zip" | %{"$($_.Split('"')[3])"} | findstr.exe "github") -o stylua-win64.zip; 7z.exe x -oC:\tools\stylua .\stylua-win64.zip; rm .\stylua-win64.zip;
    # Add stylua to environment path:
    Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path -Value $((Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path).path + ";" + "C:\tools\stylua" + ";"); refreshenv; exit
  6. Use :checkhealth to check for errors if any.

  1. Install dotnet-sdk.

    choco install dotnet-sdk -y
    
  2. Install omnisharp-roslyn.

    curl.exe -L $(curl.exe -s https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases/latest | findstr.exe "omnisharp-win-x64-net6.0.zip" | %{"$($_.Split('"')[3])"} | findstr.exe "github") -o omnisharp-win-x64-net6.0.zip; 7z.exe x -oC:\tools\omnisharp .\omnisharp-win-x64-net6.0.zip; rm .\omnisharp-win-x64-net6.0.zip;
    
  3. Use :checkhealth to check for errors if any.

HTML, CSS, Javascript (vscode-langservers-extracted)

  1. Install dependencies.

    npm i -g vscode-langservers-extracted
    
  2. Install prettierd for formatting.

    npm i -g @fsouza/prettierd
    
  3. Use :checkhealth to check for errors if any.

Update πŸš€

  1. Pull changes.

    cd "$HOME\Appdata\Local\nvim"; git pull
    
  2. Open nvim-qt or nvim and update plugins:

    :PackerSync
    

Features πŸ“ƒ

General

  • Smart display line movement.
  • Resume cursor position when re-opening a file.
  • Auto update file if changed outside of neovim.
  • Fix mixed indents (tabs are converted to spaces).
  • Persistent cursor positions when switching buffers.
  • Ability to search custom directories in telescope.nvim.
  • Ability to reload specific modules using telescope.nvim.
  • Automatically trim trailing whitespaces and newlines on save.
  • Search and replace selection (automatically escape special chars).
  • Open windows terminal, vscode, explorer at current directory using \\t, \\c, \\e respectively.

LaTeX

Compile status on statusline Compile not started Compile not started Compile running Compile running Compile success Compile success Compile failed Compile failed
  • Extensive snippets for LaTeX.
  • Better auxiliary file cleaner.
  • Null-ls: latexindent, chktex support.
  • Automatically substitute \ in imports (include, input) with / on save.
  • Keybinds for bold, underline, math, chemical formula environments.
  • Start newline with \item (or \task) if inside a list environment when pressing Enter, o or O.

Folder Structure

nvim
β”œβ”€β”€ after
β”‚Β Β  └── ftplugin         # filetype specific options, settings, mappings
β”œβ”€β”€ lua                  # .lua config files
β”‚Β Β  └── user
β”‚Β Β      └── mappings.lua # keybinds
β”‚Β Β      └── options.lua  # vim options
β”‚Β Β      └── utils.lua    # utility functions
β”‚Β Β      └── plugins
β”‚Β Β          β”œβ”€β”€ config   # plugin config
β”‚Β Β          └── init.lua # plugin definition file
β”œβ”€β”€ ultisnips            # snippets
β”‚Β Β  └── tex              # latex snippets
└── viml                 # .vim config files

Plugins

LSP

File navigation

Code completion

LaTeX

Looks

Buffer, Status

QOL

Mappings

Shortcut Mode Description
F2 Normal Replace word under cursor
F2 Visual Rename selection
F5 Normal Open telescope.nvim module reloader
F10 Normal Toggle spellcheck
F11 Normal Toggle warp
F12 Normal Toggle paste mode
\\t Normal Open windows terminal at cwd
\\e Normal Open explorer at cwd
\\c Normal Open current file in VSCode
\\n Normal Open current file in notepad
tf Normal Open telescope.nvim find files
tr Normal Open telescope.nvim recent files
ts Normal Open telescope.nvim session browser
\q Normal Toggle quickfix
\h Normal Disable search highlight
\v Normal/Insert Paste from system clipboard in paste mode
\w Normal Close buffer (will discard changes if not saved)
\u Normal Open URL under cursor in browser
\s Normal Search word under cursor in browser
\n Normal Open dashboard
f Normal Search buffer using 1 chars
S Normal Search buffer using 2 chars
Tab Normal Move to next buffer
Shift Tab Normal Move to previous buffer
Tab Insert Expand trigger or jump to next tab stop
Shift Tab Insert Jump to previous tab stop
Ctrl j(k) Command Move between completion items
Ctrl j(k) Insert Move between completion items
Alt d Normal Duplicate current line below
Alt j(k) Normal/Visual Move line (block) up or down
Alt ] Normal Increase indent
Alt [ Normal Decrease indent
Ctrl / Normal/Visual/Insert Comment current (selected) line(s)
Enter Insert Select completion item
Ctrl Space Insert Force completion menu to open
Ctrl c Insert Force completion menu to close
Ctrl e Insert Select first completion item
Ctrl t Insert Open omni-func completion
Ctrl Backspace Insert Delete previous word
Ctrl Delete Insert Delete next word
Ctrl b Normal Toggle nvim-tree
Ctrl f Normal Format document
Ctrl h(jkl) Normal Move to window to the left (down, up, right)
Ctrl s Normal Save current file
Ctrl Shift s Normal Save and reload module (current file)
Ctrl v Insert Paste from system clipboard
Ctrl z Insert Correct preceding misspelt word
Ctrl z Normal Correct misspelt word under cursor
gD Normal LSP: Goto function declaration
gi Normal LSP: Goto function implementation
gh Normal LSP: Preview documentation
gd Normal LSP: Preview function definition
gs Normal LSP: Preview signature help
gr Normal LSP: Rename instance
gl Normal LSP: Show line diagnostic
gR Normal LSP: Show references
ga Normal LSP: Trigger code action
\li Normal VimTeX: Info
\lT Normal VimTeX: TOC toggle
\lq Normal VimTeX: Log
\lv Normal VimTeX: View pdf
\lr Normal VimTeX: Reverse search
\ll Normal VimTeX: Compile
\lk Normal VimTeX: Stop
\le Normal VimTeX: Errors
\lC Normal VimTeX: Clean full
\lx Normal VimTeX: Reload
\lX Normal VimTeX: Reload state
\t Normal Python, Lua, C#: Run code in external terminal
\r Normal Python, Lua: Run code without terminal output
\lt Normal Lua (LΓ–VE2D): Run game in external terminal
\lr Normal Lua (LΓ–VE2D): Run game without terminal output

Todo βœ”

  • Improve mappings table
  • Document snippets
  • Automatic install script
  • Create video to showcase snippets

nvim-config's People

Contributors

neelfrost avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nvim-config's Issues

OmniSharp is not getting attached to the buffer

Hello Neelfrost,

Firstly THANK YOU for this awesome well made nvim config i really like it.

I am having an issue with using the config though for Unity Development Omnisharp is not getting attached to the buffer at all i tried a couple of things in the servers lua but to no avail any idea how can i fix that ? i have attached a screenshot
neovide_uSZzqNJFHX

there is sln and the .csproj files that got generated by unity
Thank you!

VimTex Inverse Search

Hi, I found your repo by googling and was trying to use your VimTex settings.

After setting the SumatraPDF Inverse Search, when using it, I got:

Error detected while processing command line:
E492: Not an editor command: PackerLoad vimtex
E492: Not an editor command: VimtexInverseSearch 93 'PATH_TO_TEX_FILE\test.tex'

Are you using the settings under Windows?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.