Configuration file for vim on macos
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

126 lines
3.8 KiB

" ------------------
" __
" .--.--.|__|.--------.----.----.
" | | || || | _| __|
" \___/ |__||__|__|__|__| |____|
" ------------------
"
" Basic settings
" --------------
set nocompatible
filetype plugin indent on
syntax enable
set number relativenumber
set path+=**
set wildmode=longest,list,full
set encoding=UTF-8
set cursorline
set showmatch " matching brackets
set linebreak
set ignorecase " case insensitive matching
set smartcase " smart case matching
"set clipboard+=unnamedplus
set mouse=a
set tabstop=4
set shiftwidth=4
set softtabstop=4
set spelllang=en_us
set fillchars+=eob:~
set showtabline=2
set laststatus=2
set backspace=indent,eol,start " more powerful backspacing
" ------------------
" Basic styling
" ------------------
highlight Comment cterm=italic
highlight CursorLine ctermbg=Black cterm=NONE
highlight CursorLineNr ctermbg=Black cterm=bold ctermfg=Green
highlight LineNr ctermbg=Black ctermfg=White
" OS detection
" ---------------------------------------------
if !exists("g:os_current")
if system('uname -s') == "Linux\n"
let g:os_current = "Linux"
elseif system('uname -s') == "Darwin\n"
let g:os_current = "Darwin"
else
echom "Error: the current operating system won't support my Vim Config"
let g:os_current = "Other"
endif
endif
" ---------------------------------------------
" Plugin settings
" ------------------
call plug#begin()
Plug 'sonph/onehalf', { 'rtp': 'vim' }
Plug 'https://github.com/Badacadabra/vim-archery'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'lervag/vimtex'
Plug 'Valloric/YouCompleteMe'
Plug 'preservim/nerdtree'
"Plug 'liuchengxu/vim-which-key'
Plug 'godlygeek/tabular'
Plug 'preservim/vim-markdown'
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
Plug 'https://github.com/godlygeek/tabular'
call plug#end()
" Theme configuration
" ------------------
colorscheme onehalfdark "archery
let g:airline_theme = 'onehalfdark' "'archery'
set t_Co=256
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline_symbols = {}
let g:airline_symbols.colnr = ' ㏇:'
" LaTeX
let g:tex_flavor='latex'
set sw=2
set iskeyword+=:
let g:vimtex_view_method = "skim"
let g:vimtex_compiler_latexmk= {'options' : ['-pdf', '-shell-escape', '-verbose', '-file-line-error', '-synctex=1', '-interaction=nonstopmode',],} " we need to enable -shell-escape to be able to use externalization library for avioiding recompiling unchanged diagrams/graphs created using tikz/pgfplots
if !exists('g:ycm_semantic_triggers')
let g:ycm_semantic_triggers = {}
endif
au VimEnter * let g:ycm_semantic_triggers.tex=g:vimtex#re#youcompleteme
" ---------------------------------------------
" Miscelanious
" ---------------------------------------------
" Easier write command
let mapleader = " "
nnoremap <leader>w <Cmd>write<CR>
" NERDTree
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
let g:NERDTreeQuitOnOpen = 1
" Whichkey
set timeoutlen=500
"let g:mapleader = "\<Space>"
"let g:maplocalleader = ','
"nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
"nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
" Tabularize
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction