Advertisement
ALENTL

Untitled

Oct 2nd, 2022
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.07 KB | None | 0 0
  1. " leader key
  2. let mapleader = " "
  3.  
  4. " Configure expanding of tabs for various file types
  5. au BufRead, BufNewFile *.py set expandtab
  6. au BufRead, BufNewFile *.c set noexpandtab
  7. au BufRead, BufNewFile *.h set noexpandtab
  8. au BufRead, BufNewFile Makefile* set noexpandtab
  9.  
  10. set listchars=tab:Γû╕\ " ΓöÉ
  11. set listchars+=trail:┬╖ " Γöé Use custom symbols to
  12. set listchars+=eol:↴ " │ represent invisible characters
  13. set listchars+=nbsp:_ " Γöÿ
  14.  
  15. set magic " Enable extended regexp
  16. set mousehide " Hide mouse pointer while typing
  17. set noerrorbells " Disable error bells
  18.  
  19. set nojoinspaces " When using the join command,
  20. " only insert a single space
  21. " after a `.`, `?`, or `!`
  22.  
  23. set tabstop=4
  24. set nocompatible
  25. set shiftwidth=4
  26. set expandtab
  27. set autoindent
  28. set smartindent
  29. set ruler
  30. set showcmd
  31. set incsearch
  32. set number
  33. set relativenumber
  34. set cino+=L0
  35. set paste
  36. set linebreak
  37. set title
  38. set mouse=v
  39. set history=50
  40. set matchtime=2
  41. set matchpairs+=<:>
  42. set cb=unnamed
  43. set showmatch
  44. set softtabstop=4
  45. set textwidth=120
  46. set smarttab
  47.  
  48. set nostartofline
  49. set report=0
  50. set numberwidth=5
  51. set scrolloff=5
  52.  
  53. "set shortmess=aAItW
  54. set showmode
  55.  
  56. set synmaxcol=2500
  57.  
  58. set hlsearch
  59. set lazyredraw
  60.  
  61. " Setting up the undofile, ttyfast, virtualedit
  62. set undofile
  63. set ttyfast
  64. set virtualedit=all
  65.  
  66. set visualbell
  67. set noerrorbells
  68. set t_vb=
  69.  
  70. set wildmenu
  71.  
  72. " Smart wrapping
  73. set wrap
  74. set formatoptions=qrn1
  75.  
  76. " Smart Search
  77. set ignorecase
  78. set smartcase
  79.  
  80. " Search as characters are entered
  81. set incsearch
  82.  
  83. " C/C++ Indent
  84. set cindent
  85.  
  86. " Enabling the backspace key
  87. set backspace=indent,eol,start
  88.  
  89. " Setting up the font, encoding and font size
  90. let &guifont = 'Hack Nerd Font Mono:h10'
  91. set encoding=UTF-8
  92.  
  93. " Enabling the pastetoggle
  94. set pastetoggle=<F11>
  95.  
  96. " Setting nerdtree to ignore unnecessary files
  97. let NERDTreeIgnore = ['\.DAT$', '\.LOG1$', '\.LOG1$']
  98.  
  99. syntax on
  100. filetype indent on
  101. filetype off
  102. setlocal indentkeys-=:
  103.  
  104. set t_Co=256
  105. set foldmethod=indent
  106. set foldlevel=99
  107.  
  108. set backup
  109.  
  110. "startup full screen
  111. au GUIEnter * sim ~x
  112.  
  113. " very useful for yaml files
  114. autocmd Filetype yaml set cursorcolumn
  115. autocmd Filetype yml set cursorcolumn
  116.  
  117. " Split settings
  118. set splitbelow splitright
  119.  
  120. " New python file Buff
  121. au BufNewFile, BufRead *.py
  122. \ set tabstop=4
  123. \ set softtabstop=4
  124. \ set shiftwidth=4
  125. \ set textwidth=79
  126. \ set expandtab
  127. \ set autoindent
  128. \ set fileformat=unix
  129. autocmd Filetype python set cursorcolumn
  130.  
  131. "keybindings for { completion, "jk" for escape, ctrl-a to select all
  132. inoremap {<CR> {<CR>}<Esc>O
  133. inoremap {} {}
  134. imap jk <Esc>
  135. map <C-a> <esc>ggVG<CR>
  136. set belloff=all
  137.  
  138. " Keybindings for python file execution
  139. autocmd FileType python nnoremap <buffer> <F9> :update<bar>!python %<CR>
  140.  
  141. " Hiding the toolbar and menubar
  142. set guioptions -=m
  143. set guioptions -=T
  144. set guioptions -=r
  145.  
  146. " Ale Linting setup for python
  147. let g:ale_linters = {'python': ['flake8']}
  148.  
  149. "Plugin setup
  150. call plug#begin()
  151. Plug 'junegunn/vim-plug'
  152. Plug 'lervag/vimtex'
  153. Plug 'octol/vim-cpp-enhanced-highlight'
  154. Plug 'tpope/vim-dispatch'
  155. Plug 'vim-airline/vim-airline'
  156. Plug 'neoclide/coc.nvim'
  157. Plug 'frazrepo/vim-rainbow'
  158. Plug 'jiangmiao/auto-pairs'
  159. Plug 'pangloss/vim-javascript'
  160. Plug 'leafgarland/typescript-vim'
  161. Plug 'peitalin/vim-jsx-typescript'
  162. Plug 'styled-components/vim-styled-components', { 'branch': 'main' }
  163. Plug 'jparise/vim-graphql'
  164. Plug 'dense-analysis/ale'
  165. Plug 'krischik/Rainbow-Parenthesis-Bundle'
  166. Plug 'rust-lang/rust.vim'
  167. Plug 'nvie/vim-flake8'
  168. Plug 'ryanoasis/vim-devicons'
  169. Plug 'drewtempelmeyer/palenight.vim'
  170. Plug 'vim-airline/vim-airline-themes'
  171. Plug 'junegunn/limelight.vim'
  172. Plug 'junegunn/goyo.vim'
  173. Plug 'searleser97/cpbooster.vim'
  174. Plug 'vim-scripts/errormarker.vim'
  175. Plug 'gruvbox-community/gruvbox'
  176. Plug 'preservim/nerdtree', {'on': 'NERDTreeToggle'}
  177. Plug 'Xuyuanp/nerdtree-git-plugin'
  178. Plug 'ryanoasis/vim-devicons'
  179. Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
  180. Plug 'PhilRunninger/nerdtree-buffer-ops'
  181. Plug 'mattn/emmet-vim'
  182. Plug 'ap/vim-css-color'
  183. Plug 'stephpy/vim-php-cs-fixer'
  184. Plug 'arnaud-lb/vim-php-namespace'
  185. Plug 'craigemery/vim-autotag'
  186. Plug 'othree/xml.vim'
  187. Plug 'sainnhe/everforest'
  188. Plug 'sainnhe/gruvbox-material'
  189. Plug 'nvim-treesitter/nvim-treesitter'
  190. Plug 'xolox/vim-lua-ftplugin'
  191. Plug 'xolox/vim-misc'
  192. Plug 'pineapplegiant/spaceduck'
  193. Plug 'sjl/badwolf'
  194. Plug '4513ECHO/vim-colors-hatsunemiku'
  195. Plug 'Rigellute/shades-of-purple.vim'
  196. Plug 'leafgarland/typescript-vim'
  197. Plug 'MaxMEllon/vim-jsx-pretty'
  198. call plug#end()
  199.  
  200. filetype plugin indent on
  201. let g:vimtex_view_general_viewer = 'SumatraPDF'
  202. let g:vimtex_view_general_options = '-reuse-instance @pdf'
  203. let g:vimtex_view_general_options_latexmk = '-reuse-instance'
  204. let g:tex_flavor = 'latex'
  205. let g:vimtex_motion_matchparen = 0
  206. let g:vimtex_fold_manual = 1
  207. let g:vimtex_matchparen_enabled = 0
  208.  
  209. " Coc Extensions
  210. "let g:coc_global_extensions = ["coc-tsserver"]
  211.  
  212. " Lua setup for vim
  213. let g:lua_check_syntax=1
  214. let g:lua_complete_omni=1
  215. let g:lua_compiler_name='C:\Program Files\lua\bin\luac.exe'
  216.  
  217. " copy, cut and paste
  218. vmap <C-c> "+y
  219. vmap <C-x> "+c
  220. vmap <C-v> c<ESC>"+p
  221. imap <C-v> <ESC> "+pa
  222.  
  223. " Clipboard configuration
  224. let s:clip = 'C:\Windows\System32\clip.exe'
  225. if executable(s:clip)
  226. augroup WSLYank
  227. autocmd!
  228. autocmd TextYankPost * if v:event.operator ==# 'y' | call system(s:clip, @0) | endif
  229. augroup END
  230. endif
  231.  
  232. au BufNewFile, BufRead *.tex
  233. \ set nocursorline
  234. \ set nornu
  235. \ set number
  236.  
  237. " disable autoindent when pasting text
  238. " source: https://coderwall.com/p/if9mda/automatically-set-paste-mode-in-vim-when-pasting-in-insert-mode
  239. let &t_SI .= "\<Esc>[?2004h"
  240. let &t_EI .= "\<Esc>[?2004l"
  241.  
  242. function! XTermPasteBegin()
  243. set pastetoggle=<Esc>[201~
  244. set paste
  245. return ""
  246. endfunction
  247.  
  248. inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
  249.  
  250. "Append template to new C++ files
  251. autocmd BufNewFile *.cpp 0r C:/Users/alent/Documents/vimws/Template.cpp
  252.  
  253. "Compile and run
  254. "Note that the next uncommented line requires the build.sh script!
  255. "Replace it with the commented line below if you don't have it
  256. "set makeprg=g++\ -static\ -DDEBUG\ -lm\ -s\ -x\ c++\ -Wall\ -Wextra\ -O2\ -std=c++17\ -o\ %:r\ %
  257. "set makeprg=build.sh\ %:r
  258. "autocmd filetype cpp nnoremap <F9> :w <bar> Make <CR>
  259. "autocmd filetype cpp nnoremap <F9> :w <bar> !build.sh %:r <CR>
  260. "autocmd filetype cpp nnoremap <F10> :vertical terminal ++shell ++cols=40 %:r<CR>
  261. "autocmd filetype cpp nnoremap <F11> :!%:r<CR>
  262. "autocmd filetype java nnoremap <F9> :w <bar> !javac %<CR>
  263. "autocmd filetype java nnoremap <F10> :vertical terminal ++shell ++cols=40 java %:r<CR>
  264. "autocmd filetype java nnoremap <F11> :!java %:r<CR>
  265. autocmd filetype cpp nnoremap <F9> :w <bar> !g++ -std=c++17 % -o %:r -Wl,--stack,268435456<CR>
  266. autocmd filetype cpp nnoremap <F10> :!%:r<CR>
  267. autocmd filetype cpp nnoremap <C-C> :s/^\(\s*\)/\1\/\/<CR> :s/^\(\s*\)\/\/\/\//\1<CR> $
  268.  
  269. " Javascript Highlighting
  270. autocmd BufEnter *.{js,jsx,ts,tsx} :syntax sync fromstart
  271. autocmd BufLeave *.{js,jsx,ts,tsx} :syntax sync clear
  272.  
  273. "LaTeX settings
  274. autocmd FileType tex :NoMatchParen
  275. autocmd FileType tex :set tw=110
  276.  
  277. " Vim Theme Customization
  278. "let g:molokai_original = 1
  279. "let g:rehash256 = 1
  280. "colorscheme molokai
  281. set termguicolors
  282. colorscheme gruvbox
  283. set background=dark
  284. let g:gruvbox_guisp_fallback = "bg"
  285. let g:gruvbox_italic = 1
  286.  
  287. " Spelling
  288. setlocal spell spelllang=en_us
  289. setlocal spell!
  290.  
  291. " Airline theme
  292. let g:airline_theme='gruvbox'
  293.  
  294. " Split navigations
  295. nnoremap <C-J> <C-W><C-J>
  296. nnoremap <C-K> <C-W><C-K>
  297. nnoremap <C-L> <C-W><C-L>
  298. nnoremap <C-H> <C-W><C-H>
  299.  
  300. " Tabnew settings
  301. nnoremap <C-Left> :tabprevious<CR>
  302. nnoremap <C-Right> :tabnext<CR>
  303. nnoremap <C-j> :tabprevious<CR>
  304. nnoremap <C-k> :tabnext<CR>
  305.  
  306. " Vim Rainbow
  307. let g:rainbow_active = 1
  308.  
  309. " NerdTree
  310. inoremap <c-b> <Esc>:NERDTreeToggle<cr>
  311. nnoremap <c-b> <Esc>:NERDTreeToggle<cr>
  312.  
  313. " Always show sign column (the column at the left of the numbers)
  314. set signcolumn=yes
  315.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement