Skip to content

Instantly share code, notes, and snippets.

@powerjungle
Last active February 2, 2024 21:48
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
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
" The NERDTree is a file system explorer for the Vim editor.
" https://github.com/preservim/nerdtree
Plug 'preservim/nerdtree'
" open NERDTree and change cursor to opened file window
autocmd VimEnter * NERDTree | wincmd p
" change NERDTree windows width
let g:NERDTreeWinSize = 20
" buffer tabs on top
" https://github.com/ap/vim-buftabline
Plug 'ap/vim-buftabline'
" 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
" don't use ctags as default since coc gives better results so far
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
" make spelling highlights not as ugly
highlight clear SpellBad
highlight SpellBad ctermfg=7
" 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('HOME') != '/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
source /path/to/coc-fixes.vim
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment