Skip to content

Instantly share code, notes, and snippets.

@matejsarlija
Created October 20, 2021 05:41
Show Gist options
  • Save matejsarlija/14fc19910cee2d3d1fc5368be2c439a7 to your computer and use it in GitHub Desktop.
Save matejsarlija/14fc19910cee2d3d1fc5368be2c439a7 to your computer and use it in GitHub Desktop.
My budding .vimrc for Scala
call plug#begin('C:\Users\matej\AppData\Local\nvim\plugged')
Plug 'ryanoasis/vim-devicons'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" fugitive - git support
Plug 'tpope/vim-fugitive'
" nerd tree
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" surround vim
Plug 'tpope/vim-surround'
" nerd commenter
Plug 'scrooloose/nerdcommenter'
Plug 'itchyny/lightline.vim'
"scala-metals + required
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'nvim-lua/plenary.nvim'
Plug 'scalameta/nvim-metals'
" colorscheme
Plug 'nanotech/jellybeans.vim'
Plug 'chriskempson/base16-vim'
Plug 'morhetz/gruvbox'
Plug 'w0ng/vim-hybrid'
Plug 'tpope/vim-vividchalk'
Plug 'lokaltog/vim-distinguished'
" glsl color
Plug 'tikhomirov/vim-glsl'
Plug 'drewtempelmeyer/palenight.vim'
call plug#end()
" Let clangd fully control code completion
let g:ycm_clangd_uses_ycmd_caching = 0
" Use installed clangd, not YCM-bundled clangd which doesn't get updates.
let g:ycm_clangd_binary_path = exepath("clangd")
" ================ Suggestions ======================
" show wild menu (menu of suggestions) when typing commands in command mode
set path+=**
set wildmenu
set showcmd
" ================ File management ==================
" Turn off swap files
set noswapfile
set nobackup
set nowb
" ================ Visualization ====================
syntax on
set background=dark
" ================ Indentation ======================
set autoindent
set smartindent
set shiftwidth=4
set tabstop=4
set smarttab
set expandtab
" ================ Number column ====================
" numbers
set number " see the line number column
" Toggle relative numbering, and set to absolute on loss of focus or insert mode
autocmd InsertEnter * :set nornu
autocmd InsertLeave * :set rnu
" we don't want to see relative numbering while debugging
" debugger uses its own window, so we can disable rnu when source window loses
" focus
autocmd BufLeave * :set nornu
autocmd BufEnter * call SetRNU()
function! SetRNU()
if(mode()!='i')
set rnu
endif
endfunction
" ================ Performance ======================
" fix slow scrolling that occurs when using mouse and relative numbers
set lazyredraw
" vim timeout (forgot why I need this or if I do at all)
set ttyfast
set ttimeoutlen=10
" ================ Misc =============================
" highlight matching braces
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=0
" When the last window will have a status line (2 = always)
set laststatus=2
" disable wrapping of long lines into multiple lines
set nowrap
" history
set history=1000
" on some systems the backspace does not work as expected.
" this fixes the problem
set backspace=indent,eol,start
" to avoid hitting:
" 'press ENTER or type command to continue'
" add 'silent' keyword before the command
"
" ################ Lightline ########################
" # lightline
let g:lightline = {
\ 'colorscheme': 'palenight',
\ 'active': {
\ 'left':[ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ]
\ ]
\ },
\ 'component': {
\ 'lineinfo': '%3l:%-2v',
\ },
\ 'component_function': {
\ 'gitbranch': 'fugitive#head',
\ }
\ }
let g:lightline.separator = {
\ 'left': '', 'right': ''
\}
let g:lightline.subseparator = {
\ 'left': '', 'right': ''
\}
let g:lightline.tabline = {
\ 'left': [ ['tabs'] ],
\ 'right': [ ['close'] ]
\ }
set showtabline=2 " Show tabline
set guioptions-=e " Don't use GUI tabline
" ################ NERDTree #########################
" shift+i (show hidden files)
" ctrl+n open/closes nerd tree
noremap <C-n> :NERDTreeToggle<CR>
" quit nerd tree on file open
let g:NERDTreeQuitOnOpen = 1
" show nerd tree always on the right instead on the left
let g:NERDTreeWinPos = "right"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment