Files
dots/laptop/.vimrc
Marco Thomas 24fc842639 Updates
2020-09-23 00:05:15 +02:00

165 lines
5.3 KiB
VimL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
" ▄▄ ▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄▄ ▄▄ ▄▄▄▄▄▄▄ ▄▄ ▄▄ ▄▄▄ ▄▄ ▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄▄
" █ █▄█ █ █ ▄ █ █ █ ██ █ █ █ █ █ █ █▄█ █ ▄ █ █ █
" █ █ ▄ █ █ █ █ █ █▄▄██ ▄▄▄▄▄█ █ █▄█ █ █ █ █ █ █ █ █
" █ █ █▄█ █ █▄▄█▄█ ▄▄█ █ █▄▄▄▄▄ █ █ █ █ █▄▄█▄█ ▄▄█
" █ █ █ ▄▄ █ █ █▄▄▄▄▄ █ █ █ █ █ ▄▄ █ █
" █ ██▄██ █ ▄ █ █ █ █ █▄▄ ▄▄▄▄▄█ █ █ ██ █ ██▄██ █ █ █ █ █▄▄
" █▄█ █▄█▄█ █▄▄█▄▄▄█ █▄█▄▄▄▄▄▄▄█ █▄▄▄▄▄▄▄█ █▄▄▄█ █▄▄▄█▄█ █▄█▄▄▄█ █▄█▄▄▄▄▄▄▄█
"
let mapleader = "\<Space>"
" ============================== vim-plug
call plug#begin()
Plug 'joshdick/onedark.vim' " Colorscheme
Plug 'tpope/vim-sleuth' " Automatic intendations
Plug 'jiangmiao/auto-pairs' " Pair ompletion
Plug 'airblade/vim-gitgutter' " Show git changes
if executable("fzf")
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
endif
if has ("nvim")
Plug 'neovim/nvim-lspconfig' " LSP
Plug 'Shougo/neosnippet.vim'
Plug 'Shougo/neosnippet-snippets'
Plug 'nvim-lua/completion-nvim' " Fancy autocomplete
endif
call plug#end()
" ============================== Colors
syntax on
set background=dark
colorscheme onedark
hi Normal ctermbg=NONE guibg=NONE
set termguicolors
filetype indent plugin on
" ============================== General
set number
set relativenumber
set cursorline
set ruler
set showmatch " highlights paranthesis
set laststatus=0 " remove status bar
set mat=5
set noswapfile " can be problematic on some systems
set confirm " can't quit without saving
set noshowmode " don't show mode in status
set noshowcmd " don't show command in status
set encoding=utf-8
set mouse=c " a=on, c=off
set undolevels=1337
set backspace=indent,eol,start
set wildmenu " autocomplete :e
set scrolloff=7 " min lines aboive or below the cursor
" ============================== Indents and Whitespaces
set list
set listchars=tab:»\ ,extends:,precedes:,nbsp,trail
autocmd FileType perl set tabstop=8 shiftwidth=4 softtabstop=4
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+\%#\@<!$/
" ============================== Search
set incsearch
set ignorecase
set smartcase " case sensitive when capital letters are used
set hlsearch " highlight all results
nnoremap<leader><space> :nohlsearch<CR>
" ============================== Cursor Thiccness
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q"
" ============================== netrw
let g:netrw_winsize = 25
let g:netrw_liststyle = 3 " Tree-like structure
let g:netrw_banner = 0 " Remove useless banner at the top of netrw
" ============================== Macros and Mappings
cmap Wq wq
cmap Q q
cmap W w
cmap q1 q!
" fzf
nmap <C-f> :Files<CR>
" ============================== Snippets
iab lbf \textbf{}<LEFT>
iab lframe \begin{frame}{}<CR><CR>\end{frame}<UP>
iab litem \begin{itemize}<CR><CR>\end{itemize}<UP>
iab ltable \begin{tabular}{}<CR>\end{tabular}<UP><RIGHT><RIGHT><RIGHT>
iab lfig \begin{figure}<CR>\includegraphics[width=1\textwidth]{}<CR>\caption{}<CR>\label{figure:}<CR>\end{figure}
" ============================== LSP
" ++++++++++ completion-nvim Settings
if has ("nvim")
" Use completion-nvim in every buffer
autocmd BufEnter * lua require'completion'.on_attach()
" Use <Tab> and <S-Tab> to navigate through popup menu
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect
" Avoid showing message extra message when using completion
set shortmess+=c
let g:completion_trigger_keyword_length = 1
let g:completion_matching_ignore_case = 1
let g:completion_trigger_on_delete = 1
let g:completion_enable_snippet = 'Neosnippet'
let g:completion_chain_complete_list = {
\ 'default' : {
\ 'default': [
\ {'complete_items': ['lsp', 'snippet', 'path']},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'}],
\ }
\}
set pumheight=10
endif
" ++++++++++ lsp Settings
if has ("nvim")
" Show definition
nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>
" Go to references
nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>
nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
endif
" ++++++++++ neosnippet Settings
if has ("nvim")
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
endif
" ++++++++++ Enable Language Servers
if has ("nvim")
lua <<EOF
require'nvim_lsp'.pyls.setup{}
require'nvim_lsp'.rust_analyzer.setup{}
require'nvim_lsp'.texlab.setup{}
EOF
endif