Skip to content

Instantly share code, notes, and snippets.

@powerjungle
Last active January 18, 2025 14:20
Show Gist options
  • Save powerjungle/48aa6908a24289df4f70c183fb6eb4da to your computer and use it in GitHub Desktop.
Save powerjungle/48aa6908a24289df4f70c183fb6eb4da to your computer and use it in GitHub Desktop.
my neovim configuration
" plugins should only be installed as a normal user for better security
"
" to install vim-plug
" https://github.com/junegunn/vim-plug#Neovim
"
" to install the plugins
" quit nvim and run it as normal user and then run :PlugInstall
" :PlugUpdate to update the plugins
" :PlugUpgrade to update the plugin manager
" all commands: https://github.com/junegunn/vim-plug#commands
"
" plugins to be installed/updated
" https://github.com/liuchengxu/eleline.vim
Plug 'liuchengxu/eleline.vim'
set laststatus=2
" remember the last position of the cursor before closing the file
" https://github.com/farmergreg/vim-lastplace
Plug 'farmergreg/vim-lastplace'
" real time autocompletion
" https://github.com/neoclide/coc.nvim/
" needs: nodejs >= 12.12
" uncomment if you want to use it
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
" coc extentions: https://github.com/neoclide/coc.nvim/wiki/Using-coc-extensions
" coc language servers: https://github.com/neoclide/coc.nvim/wiki/Language-servers
" Viewer & Finder for LSP symbols and tags
" https://github.com/liuchengxu/vista.vim
" don't forget to run :Vista to use the panel
Plug 'liuchengxu/vista.vim'
" change vista window width
let g:vista_sidebar_width = 20
" uncomment if using CoC plugin
" let g:vista_default_executive = 'coc'
" disable special icons, because it requires special fonts
let g:vista#renderer#enable_icon = 0
" show line numbers
set number
" activate mouse for all modes
set mouse=a
" hide mouse when typing
set mousehide
" check spelling and highlight wrong words for English only
set spell spelllang=en_us
" make colors not as ugly
" this is assuming the terminal is using 256 colors
" the terminal is setup in "dark mode"
" check all colors using command :highlight or :hi
highlight clear SpellBad
highlight SpellBad ctermfg=211
highlight SpellCap ctermfg=0
highlight SpellLocal ctermbg=90
highlight DiffDelete ctermfg=0
highlight PmenuSbar ctermfg=0
highlight PmenuThumb ctermfg=0
highlight RedrawDebugClear ctermfg=0
highlight RedrawDebugComposed ctermfg=0
highlight RedrawDebugRecompose ctermfg=0
" force line wrap to be always on
set wrap
" make copy/cut/paste work outside of neovim as well
" doesn't seem to work when running as root
set clipboard+=unnamedplus
" adds a mark at char 80 and 120 so that lines don't get too long
set colorcolumn=80,120
" wrap text around the second limit only
set textwidth=120
" fixes taken from:
" https://github.com/neoclide/coc.nvim/tree/release#example-vim-configuration
" ########################## coc fixes ################################
" !!! PASTE COC FIXES FROM LINK HERE !!!
" ########################## end of coc fixes #########################
" software: https://neovim.io/
" !!! LOOK at the config and replace "/path/to" for your system !!!
" make sure the normal user can't edit the system-wide file, only root!
" system-wide config location: /etc/xdg/nvim/init.vim
" user only config location: ~/.config/nvim/init.vim
" include base-settings.vim contents
source /path/to/base-settings.vim
" additional settings here
" check if not running as root and then include the plugins config part
if getenv('USER') != 'root'
call plug#begin()
" include base-plugins.vim contents
source /path/to/base-plugins.vim
" additional plugins here
call plug#end()
" include coc-fixes.vim contents
" uncomment when using the CoC plugin
" source /path/to/coc-fixes.vim
endif
# /etc/firejail/nvim.local
# This config makes working with plugins
# and plugin managers, easier when
# sandboxed using firejail.
ignore net none
ignore x11 none
protocol inet,inet6
ignore protocol unix,inet,inet6
noblacklist ${HOME}/Development
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment