This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.config/.old/vim/vimrc

204 lines
4.6 KiB
VimL
Raw Normal View History

2020-05-06 03:20:19 +02:00
""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim-Plug
2020-05-06 03:20:19 +02:00
""""""""""""""""""""""""""""""""""""""""""""""""""
"Automatic installation
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Necessary to do cool stuff
set nocompatible
"Pluggins will be downloaded under the specified directory
call plug#begin('~/.vim/plugins')
""""""""""""""""""""""""""""""""""""""""""""""""""
" Language hilighting packages
Plug 'sheerun/vim-polyglot'
" Shows indent guides
Plug 'nathanaelkane/vim-indent-guides'
" Colorscheme management
Plug 'lifepillar/vim-colortemplate'
" Templates
Plug 'tibabit/vim-templates'
2020-05-06 03:20:19 +02:00
" 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
"
" Indent Guides
let g:indent_guides_enable_on_vim_startup=1
2020-05-06 03:20:19 +02:00
""""""""""""""""""""""""""""""""""""""""""""""""""
" "
" Non-plugin stuff : "
" "
""""""""""""""""""""""""""""""""""""""""""""""""""
"-> General
""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines VIM has to remember
set history=500
" Set vim update time (milliseconds)
set updatetime=250
" Detect plugins filetypes
filetype plugin 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
" Autocomplete settings
set wildmode=longest,list,full
""""""""""""""""""""""""""""""""""""""""""""""""""
" -> VIM User Interface
""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets the font
set guifont=FuraCode\ Nerd\ Font\ Mono\ 12
" Set utf8 as standard encoding
set encoding=utf-8
2020-05-06 03:20:19 +02:00
" Shows the current position
set ruler
" Shows line numbers
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
"""""""""""""""""""""""""""""""""""""""""""""""""""
" -> Status line
"""""""""""""""""""""""""""""""""""""""""""""""""""
"Always show the status line
set laststatus=2
"Don't show editor mode
set noshowmode
source $HOME/.vim/statusline.vim
augroup statusline
autocmd!
autocmd VimEnter *
\ call UpdateInactiveWindows()
autocmd VimEnter,WinEnter,BufWinEnter *
\ call RefreshStatusLine('active')
autocmd WinLeave *
\ call RefreshStatusLine('inactive')
augroup END
2020-05-06 03:20:19 +02:00
" GUI colors
" set Vim-specific sequences for RGB colors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
2020-05-06 03:20:19 +02:00
syntax enable
" Colorscheme
set background=dark
colorscheme polyjuice
2020-05-06 03:20:19 +02:00
""""""""""""""""""""""""""""""""""""""""""""""""""
" -> Text, tab and indent
2020-05-06 03:20:19 +02:00
""""""""""""""""""""""""""""""""""""""""""""""""""
" 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 si "smart indent
set wrap "wrap lines
" Stops the auto-commenting new line
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Enable autocompletion
set wildmode=longest,list,full
" Automatically removes all trailing whitespaces on save
autocmd BufWritePre * %s/\s\+$//e
""""""""""""""""""""""""""""""""""""""""""""""""""
" -> Macros
2020-05-06 03:20:19 +02:00
""""""""""""""""""""""""""""""""""""""""""""""""""
" Source files
noremap <leader>s :source ~/.vim/vimrc <CR>
2020-05-06 03:20:19 +02:00
" Circle through buffers
noremap <leader>n :bn<CR>
noremap <leader>b :bp<CR>
2020-05-06 03:20:19 +02:00
" Clear the search highlight
noremap <leader>h :nohl<CR>
2020-05-06 03:20:19 +02:00
" Make use of xclipboard
nnoremap <leader>v "+p
vnoremap <leader>c "+y
2020-05-06 03:20:19 +02:00
" Compile document
noremap <leader><Enter> :w! \| !compiler %<CR>
2020-05-06 03:20:19 +02:00
" Compile mom folder into pdf
noremap <leader>m :w! \| !mommerge<CR>
2020-05-06 03:20:19 +02:00
" Plugin management
noremap <leader>pi :PlugInstall<CR>
noremap <leader>pc :PlugClean<CR>
noremap <leader>pu :PlugUpdate \| PlugUpgrade<CR>
2020-05-06 03:20:19 +02:00
" Colorize
noremap <leader>cc :ColorizerToggle<CR>
" Template
noremap <leader>ti :TemplateInit<CR>
noremap <leader>te :TemplateExpand<CR>