207 lines
4.7 KiB
VimL
207 lines
4.7 KiB
VimL
|
"" Plugin stuff
|
||
|
|
||
|
" Vim-Plug
|
||
|
""""""""""""""""""""""""""""""""""""""""""""""""""
|
||
|
" Autoinstall Plug
|
||
|
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||
|
echo "Downloading junegunn/vim-plug"
|
||
|
silent !curl -fLo '~/.local/share/nvim/site/autoload/plug.vim' --create-dir \
|
||
|
'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||
|
endif
|
||
|
|
||
|
" Plugins will be downloaded under the specified directory
|
||
|
call plug#begin('$HOME/.config/nvim/plugged')
|
||
|
|
||
|
""""""""""""""""""""""""""""""""""""""""""""""""""
|
||
|
|
||
|
" Custom status bar
|
||
|
Plug 'itchyny/lightline.vim'
|
||
|
|
||
|
" Language highlighting packages
|
||
|
Plug 'sheerun/vim-polyglot'
|
||
|
|
||
|
" Indentation guides
|
||
|
Plug 'nathanaelkane/vim-indent-guides'
|
||
|
|
||
|
" Colorscheme management
|
||
|
Plug 'lifepillar/vim-colortemplate'
|
||
|
|
||
|
" Neovim colorizer
|
||
|
Plug 'norcalli/nvim-colorizer.lua'
|
||
|
|
||
|
" All Plugins must be added before the following line
|
||
|
call plug#end()
|
||
|
|
||
|
" Brief help
|
||
|
" :PlugInstall - installs plugins; append `!` to update or just :PluginUpdate
|
||
|
" :PlugUpdate - updates plugins
|
||
|
" :PlugUpgrade - upgrades vim-plug
|
||
|
" :PlugClean - confirms removal of unused plugins; append `!` to auto-approve removal
|
||
|
|
||
|
" Lightline already shows the mode -> get rid of vim's default
|
||
|
set noshowmode
|
||
|
|
||
|
" Lightline customization
|
||
|
|
||
|
let g:lightline = {
|
||
|
\ 'colorscheme': 'Tomorrow_Night_Eighties',
|
||
|
\ 'active' : {
|
||
|
\ 'left': [ [ 'mode', 'paste' ],
|
||
|
\ [ 'gitbranch' ],
|
||
|
\ [ 'filename', 'modified' ] ],
|
||
|
\ 'right': [ [ 'readonly' ],
|
||
|
\ [ 'column'],
|
||
|
\ [ 'filetype' ] ],
|
||
|
\ },
|
||
|
\ 'subseparator': { 'left': '-'},
|
||
|
\ 'component_function': {
|
||
|
\ 'gitbranch': 'fugitive#head',
|
||
|
\ 'modified': 'LightlineModified',
|
||
|
\ 'filetype': 'LightlineFiletype'
|
||
|
\ }
|
||
|
\ }
|
||
|
|
||
|
function! LightlineModified()
|
||
|
return &modifiable && &modified ? '[MO]' : ''
|
||
|
endfunction
|
||
|
|
||
|
function! LightlineFiletype()
|
||
|
return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
|
||
|
endfunction
|
||
|
|
||
|
" Indent Guides
|
||
|
let g:indent_guides_enable_on_vim_startup=1
|
||
|
|
||
|
"" General
|
||
|
""""""""""""""""""""""""""""""""""""""""""""""""""
|
||
|
" Set how many lines VIM has to remember
|
||
|
set history=500
|
||
|
|
||
|
" Set vim update time (milliseconds)
|
||
|
set updatetime=250
|
||
|
|
||
|
" Detect filetypes plugins and indent rules
|
||
|
filetype plugin indent on
|
||
|
|
||
|
" To recognize groff filetype
|
||
|
au BufNewFile,BufRead *.mom set filetype=groff
|
||
|
|
||
|
" Defining the <leader>
|
||
|
let mapleader = " "
|
||
|
|
||
|
" Remove the pause when leaving insert mode
|
||
|
set ttimeoutlen=10
|
||
|
|
||
|
" Set utf8 as standard encoding
|
||
|
set encoding=utf-8
|
||
|
|
||
|
" No netrw history
|
||
|
let g:netrw_dirhistmax=0
|
||
|
|
||
|
"" User Interface
|
||
|
""""""""""""""""""""""""""""""""""""""""""""""""""
|
||
|
" Sets the font
|
||
|
set guifont=FuraCode\ Nerd\ Font\ Mono\ 12
|
||
|
|
||
|
" Shows the current position
|
||
|
set number
|
||
|
|
||
|
" Shows line numbers relative to the cursor
|
||
|
set relativenumber
|
||
|
|
||
|
" A buffer becomes hidden when abandonned
|
||
|
set hid
|
||
|
|
||
|
" Highlights search results
|
||
|
set hlsearch
|
||
|
|
||
|
" Searches before hitting ENTER
|
||
|
set incsearch
|
||
|
|
||
|
" Shows matching brackets when cursor is over them
|
||
|
set showmatch
|
||
|
|
||
|
" Shows the command that's being typed
|
||
|
set showcmd
|
||
|
|
||
|
" Splits to the right
|
||
|
set splitright
|
||
|
|
||
|
" Prevents nvim from being customized by text files commands
|
||
|
set nomodeline
|
||
|
|
||
|
" GUI colors
|
||
|
set termguicolors
|
||
|
|
||
|
" Colorscheme
|
||
|
colorscheme polyjuice
|
||
|
|
||
|
"" Text, tab and indent
|
||
|
""""""""""""""""""""""""""""""""""""""""""""""""""
|
||
|
" Do not use spaces instead of tabs
|
||
|
set noexpandtab
|
||
|
|
||
|
" But be smart with tabs
|
||
|
set smarttab
|
||
|
|
||
|
" 1 tab = 4 spaces
|
||
|
set tabstop=4
|
||
|
set shiftwidth=4 "for indent operations
|
||
|
|
||
|
" Indent and wrap rules
|
||
|
set autoindent
|
||
|
set wrap "wrap lines
|
||
|
|
||
|
" Stop auto-commenting new line
|
||
|
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
|
||
|
|
||
|
" Change cursor behaviour when entering insert mode
|
||
|
let &t_SI.="\e[6 q" "SI = INSERT mode // steady bar
|
||
|
let &t_SR.="\e[4 q" "SR = REPLACE mode // underline
|
||
|
|
||
|
" Enable autocompletion
|
||
|
set wildmode=longest,full
|
||
|
|
||
|
" Automatically remove all trailing whitespaces on save
|
||
|
autocmd BufWritePre * %s/\s\+$//e
|
||
|
|
||
|
"" Status line
|
||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""
|
||
|
"Always show the status line
|
||
|
set laststatus=2
|
||
|
|
||
|
"" Macros
|
||
|
""""""""""""""""""""""""""""""""""""""""""""""""""
|
||
|
" Source files
|
||
|
noremap <leader>s :source ~/.config/nvim/init.vim <CR>
|
||
|
|
||
|
" Circle through buffers
|
||
|
noremap <leader>n :bn
|
||
|
noremap <leader>p :bp
|
||
|
|
||
|
" Clear the search highlight
|
||
|
noremap <leader>q :nohl<CR>
|
||
|
|
||
|
" Make use of xclipboard
|
||
|
nnoremap <leader>v "+p
|
||
|
vnoremap <leader>c "+y
|
||
|
|
||
|
" Compile document
|
||
|
noremap <leader><Enter> :w! \| !compiler %<CR>
|
||
|
|
||
|
" Compile mom folder into pdf
|
||
|
noremap <leader>m :w! \| !mommerge<CR>
|
||
|
|
||
|
" Plugin management
|
||
|
noremap <leader>pi :PlugInstall<CR>
|
||
|
noremap <leader>pc :PlugClean<CR>
|
||
|
noremap <leader>pu :PlugUpdate \| PlugUpgrade<CR>
|
||
|
|
||
|
" Fugitive
|
||
|
noremap <leader>gd :Gdiffsplit<CR>
|
||
|
noremap <leader>gb :Gblame<CR>
|
||
|
|
||
|
" Colorize
|
||
|
noremap <leader>cc :ColorizerToggle<CR>
|