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

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. " ------------------
  2. " __
  3. " .--.--.|__|.--------.----.----.
  4. " | | || || | _| __|
  5. " \___/ |__||__|__|__|__| |____|
  6. " ------------------
  7. "
  8. " Basic settings
  9. " --------------
  10. set nocompatible
  11. filetype plugin indent on
  12. syntax enable
  13. set number relativenumber
  14. set path+=**
  15. set wildmode=longest,list,full
  16. set encoding=UTF-8
  17. set cursorline
  18. set showmatch " matching brackets
  19. set linebreak
  20. set ignorecase " case insensitive matching
  21. set smartcase " smart case matching
  22. "set clipboard+=unnamedplus
  23. set mouse=a
  24. set tabstop=4
  25. set shiftwidth=4
  26. set softtabstop=4
  27. set spelllang=en_us
  28. set fillchars+=eob:~
  29. set showtabline=2
  30. set laststatus=2
  31. set backspace=indent,eol,start " more powerful backspacing
  32. " ------------------
  33. " Basic styling
  34. " ------------------
  35. highlight Comment cterm=italic
  36. highlight CursorLine ctermbg=Black cterm=NONE
  37. highlight CursorLineNr ctermbg=Black cterm=bold ctermfg=Green
  38. highlight LineNr ctermbg=Black ctermfg=White
  39. " OS detection
  40. " ---------------------------------------------
  41. if !exists("g:os_current")
  42. if system('uname -s') == "Linux\n"
  43. let g:os_current = "Linux"
  44. elseif system('uname -s') == "Darwin\n"
  45. let g:os_current = "Darwin"
  46. else
  47. echom "Error: the current operating system won't support my Vim Config"
  48. let g:os_current = "Other"
  49. endif
  50. endif
  51. " ---------------------------------------------
  52. " Plugin settings
  53. " ------------------
  54. call plug#begin()
  55. Plug 'sonph/onehalf', { 'rtp': 'vim' }
  56. Plug 'https://github.com/Badacadabra/vim-archery'
  57. Plug 'vim-airline/vim-airline'
  58. Plug 'vim-airline/vim-airline-themes'
  59. Plug 'lervag/vimtex'
  60. Plug 'Valloric/YouCompleteMe'
  61. Plug 'preservim/nerdtree'
  62. "Plug 'liuchengxu/vim-which-key'
  63. Plug 'godlygeek/tabular'
  64. Plug 'preservim/vim-markdown'
  65. Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
  66. Plug 'https://github.com/godlygeek/tabular'
  67. call plug#end()
  68. " Theme configuration
  69. " ------------------
  70. colorscheme onehalfdark "archery
  71. let g:airline_theme = 'onehalfdark' "'archery'
  72. set t_Co=256
  73. let g:airline_powerline_fonts=1
  74. let g:airline#extensions#tabline#left_sep = ' '
  75. let g:airline#extensions#tabline#left_alt_sep = '|'
  76. let g:airline_symbols = {}
  77. let g:airline_symbols.colnr = ' ㏇:'
  78. " LaTeX
  79. let g:tex_flavor='latex'
  80. set sw=2
  81. set iskeyword+=:
  82. let g:vimtex_view_method = "skim"
  83. 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
  84. if !exists('g:ycm_semantic_triggers')
  85. let g:ycm_semantic_triggers = {}
  86. endif
  87. au VimEnter * let g:ycm_semantic_triggers.tex=g:vimtex#re#youcompleteme
  88. " ---------------------------------------------
  89. " Miscelanious
  90. " ---------------------------------------------
  91. " Easier write command
  92. let mapleader = " "
  93. nnoremap <leader>w <Cmd>write<CR>
  94. " NERDTree
  95. nnoremap <leader>n :NERDTreeFocus<CR>
  96. nnoremap <C-n> :NERDTree<CR>
  97. nnoremap <C-t> :NERDTreeToggle<CR>
  98. nnoremap <C-f> :NERDTreeFind<CR>
  99. let g:NERDTreeQuitOnOpen = 1
  100. " Whichkey
  101. set timeoutlen=500
  102. "let g:mapleader = "\<Space>"
  103. "let g:maplocalleader = ','
  104. "nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
  105. "nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
  106. " Tabularize
  107. inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
  108. function! s:align()
  109. let p = '^\s*|\s.*\s|\s*$'
  110. if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
  111. let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
  112. let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
  113. Tabularize/|/l1
  114. normal! 0
  115. call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
  116. endif
  117. endfunction