init.vim 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. " Le VimRC de Vitali64
  2. " Check if the user uses at least Vim 8.0 or neoVim
  3. if version < 800
  4. echo "Vim 8.0 or higher is required for the config file to work! Please upgrade! ~Vitali64"
  5. sleep 2
  6. quit
  7. endif
  8. " teh vimrc on the flies
  9. autocmd BufWritePost .vimrc source $MYVIMRC
  10. set incsearch
  11. " Install Plugins with plug.vim
  12. call plug#begin()
  13. Plug 'tpope/vim-sensible' " Sensible.vim
  14. Plug 'preservim/nerdtree' "nerdTree
  15. Plug 'scrooloose/syntastic' "Syntastic (SYNtax, fanTASTIC, whatever)
  16. Plug 'majutsushi/tagbar' "TagBar
  17. Plug 'vim-scripts/indentpython.vim' "IndentPython
  18. Plug 'neoclide/coc.nvim', {'branch': 'release'} "ConquerOfCompletion
  19. Plug 'pangloss/vim-javascript' "VIm JavaScript (Pour JS)
  20. Plug 'sheerun/vim-polyglot' " Poligot.VIm
  21. Plug 'tpope/vim-fugitive' " Support de GitHub/GitLab pour Vim
  22. Plug 'mhinz/vim-startify' " Pour avoir un menu au demmarage de vim :) par Mhinz
  23. Plug 'sainnhe/everforest' "EverForest O_O
  24. call plug#end()
  25. " Enable Syntax and filetype
  26. filetype on
  27. filetype plugin indent on
  28. syntax on
  29. " I want to see the number of lines
  30. set number
  31. set numberwidth=4
  32. set relativenumber
  33. " file format and encoding
  34. set fileformat=unix
  35. set encoding=utf-8
  36. set fileencoding=utf-8
  37. " Startify-related things
  38. let g:startify_custom_header = [
  39. \ ' _ __ __ ',
  40. \ ' | | / / __ / / ',
  41. \ ' | |/ / /_/ _________ /_/ ',
  42. \ ' | V / / / / /--//-// __ ',
  43. \ ' |__/ /_/ /_/ // // /_/ ',
  44. \ ' Vim is open source and freely distributable',
  45. \ '',
  46. \ " Don't forget the basics !",
  47. \ " ------",
  48. \ " :q -> Quit buffer",
  49. \ " :q! -> Rage quit buffer (without saving)",
  50. \ " :qa -> Quit all buffers",
  51. \ " :qa! -> Rage quit all buffers (without saving)",
  52. \ " :w -> Save buffer",
  53. \ " :wa -> Save all buffers",
  54. \ " :wq -> Save and quit buffer",
  55. \ " :wqa -> Save and quit all buffers",
  56. \ " :wq! -> Save and rage quit buffer",
  57. \ " (Press <ESC> before typing these commands)",
  58. \]
  59. " Working with tabs
  60. set tabstop=4
  61. set shiftwidth=4
  62. set softtabstop=4
  63. set noexpandtab
  64. " Define characters to show up when there i a tab/eol or trailing spaces
  65. " without ANY plugin
  66. set listchars=tab:»\ ,eol:¬
  67. set listchars+=trail:•
  68. set list
  69. " hwewwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww-------------
  70. " indent/unindent with tab/shift-tab
  71. nmap <Tab> >>
  72. imap <S-Tab> <Esc><<i
  73. nmap <S-tab> <<
  74. " Theme
  75. set background=dark
  76. if has('termguicolors')
  77. set termguicolors
  78. endif
  79. let g:everforest_background = 'hard'
  80. colorscheme slate
  81. hi Normal guibg=NONE ctermbg=NONE
  82. " Restore the cursor place in a file
  83. autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  84. " Git in the status bar
  85. set statusline=%<%f\ %h%m%r%{FugitiveStatusline()}%=%-14.(%l,%c%V%)\ %P "HELLOOOO"
  86. " Install CoC pLuGiNs
  87. function InstallCocPlugs()
  88. echo "Installing ConquerOfCompletion Extensions ..."
  89. CocInstall coc-python coc-vimlsp coc-utils coc-tsserver coc-terminal coc-template coc-snippets coc-sh coc-prettier coc-pairs coc-lit-html coc-json coc-html coc-eslint coc-css
  90. endfunction
  91. " Install Plug.Vim
  92. function InstallPlugDotVim()
  93. echo "Installation de vimplug ..."
  94. !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  95. endfunction
  96. " Copier, couper et coller
  97. vmap <C-c> "+y
  98. vmap <C-x> "+c
  99. vmap <C-v> c<ESC>"+p
  100. imap <C-v> <ESC>"+pa
  101. " Automatically go into copy-paste mode when pasting in insert mode
  102. " source: https://coderwall.com/p/if9mda/automatically-set-paste-mode-in-vim-when-pasting-in-insert-mode
  103. let &t_SI .= "\<Esc>[?2004h"
  104. let &t_EI .= "\<Esc>[?2004l"
  105. function! XTermPasteBegin()
  106. set pastetoggle=<Esc>[201~
  107. set paste
  108. return ""
  109. endfunction
  110. inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
  111. " C++ specific things for me
  112. " I sometimes forget to put std:: and that gives me compiling errors so...
  113. " And I'm way too cool for namespaces
  114. iab cout std::cout
  115. iab endl std::endl
  116. iab ostream std::ostream
  117. iab vector std::vector
  118. " Because I'm too lazy to type std::, I use vim abbreviations