Last active
December 26, 2023 16:51
-
-
Save gamorales/12de14177d8db164e5d909be285047f0 to your computer and use it in GitHub Desktop.
Configure Vim to load the Vundle engine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"vgit clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
" vim-fugitive A status bar for Git with shortcuts for many Git tasks. | |
" tagbar A pane for making it easier to jump to functions, methods, and classes. | |
" To install -> :PluginInstall» | |
" To delete all plugins -> :PluginClean | |
" List installed plugins -> :PluginList | |
" To install from shell -> vim +PluginInstall +qall | |
" sudo apt install exuberant-ctags -y | |
syntax on | |
set nocompatible " be iMproved, required | |
set number | |
set hlsearch | |
set nolist | |
" set rnu | |
" set noswapfile | |
" Helps force plug-ins to load correctly when it is turned back on below. | |
filetype off | |
" Not need for <Esc> key, with comma and <key> | |
let mapleader = "," | |
noremap <leader>w :w!<cr> | |
noremap <leader>q :q!<cr> | |
noremap <leader>x :wq<cr> | |
" Next Tab | |
noremap <leader>tn :tabn<cr> | |
" Previous Tab | |
noremap <leader>tp :tabp<cr> | |
" Close Tabs | |
noremap <leader>tc :tabc<cr> | |
" JSON Pretty Print | |
noremap <leader>jp :%!python -m json.tool<cr> | |
" Window resize | |
noremap <leader>rl :vertical resize +1<CR> | |
noremap <leader>rr :vertical resize -1<CR> | |
noremap <leader>ru :resize +1<CR> | |
noremap <leader>rd :resize -1<CR> | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
" The following are examples of different formats supported. | |
" Keep Plugin commands between vundle#begin/end. | |
" plugin on GitHub repo | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'majutsushi/tagbar' | |
" Autocomplete python | |
" Plugin 'davidhalter/jedi-vim' | |
Plugin 'preservim/nerdtree' | |
" Django | |
Plugin 'lambdalisue/vim-django-support' | |
" Python syntax checking after save | |
Plugin 'vim-syntastic/syntastic' | |
" PEP 8 checking | |
Plugin 'nvie/vim-flake8' | |
" Files search | |
Plugin 'kien/ctrlp.vim' | |
" React | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'leafgarland/typescript-vim' | |
Plugin 'maxmellon/vim-jsx-pretty' | |
Plugin 'prettier/vim-prettier', { 'do': 'yarn install', 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] } | |
" GraphQL | |
Plugin 'jparise/vim-graphql' | |
" Terraform | |
Plugin 'hashivim/vim-terraform' | |
" Docker | |
Plugin 'kkvh/vim-docker-tools' | |
call vundle#end() " required | |
"React conf | |
let g:prettier#autoformat = 0 | |
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync | |
" Python look pretty | |
let python_highlight_all=1 | |
syntax on | |
" For plug-ins to load correctly. | |
filetype plugin indent on | |
" Open tagbar automatically in C files, optional | |
autocmd FileType c call tagbar#autoopen(0) | |
" Open tagbar automatically in Python and JS files, optional | |
autocmd FileType python call tagbar#autoopen(0) | |
autocmd FileType javascript call tagbar#autoopen(0) | |
" Just 2 spaces javascript | |
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2 softtabstop=0 expandtab | |
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | |
" Run python within vim with F5 and debugger with F6 (pudb must be installed) | |
autocmd FileType python map <buffer> <F5> :w<CR>:exec '!clear; python3' shellescape(@%, 1)<CR> | |
autocmd FileType python imap <buffer> <F5> <esc>:w<CR>:exec '!clear; python3' shellescape(@%, 1)<CR> | |
autocmd FileType python map <buffer> <F6> :w<CR>:exec '!clear; python3 -m pudb' shellescape(@%, 1)<CR> | |
autocmd FileType python imap <buffer> <F6> <esc>:w<CR>:exec '!clear; python3 -m pudb' shellescape(@%, 1)<CR> | |
" Show status bar, optional | |
set laststatus=2 | |
" Set status as git status (branch) | |
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ [BUFFER=%n]\ %{strftime('%c')}\ %{FugitiveStatusline()} | |
" Open NerdTree when vim starts without file | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
" Ignore .pyc files in NERDTree | |
let NERDTreeIgnore=['\.pyc$', '\~$', '\.swp$'] | |
" Ctrl - f to open NERDTree | |
map <C-f> :NERDTreeToggle<cr> | |
" Ctrl - n New Tab | |
map <C-n> :tabnew<cr> | |
" Ctrl - t To open the Tagbar toggle | |
map <C-t> :TagbarToggle<cr> | |
" Ctrl - d To open the Tagbar toggle | |
map <C-d> :DockerToolsToggle<cr> | |
"split navigations | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
" Enable folding collapsing | |
set foldmethod=indent | |
set foldlevel=99 | |
" Enable folding with the spacebar | |
nnoremap <space> za | |
set tabstop=4 " The width of a TAB is set to 4. | |
" Still it is a \t. It is just that | |
" Vim will interpret it to be having | |
" a width of 4. | |
set shiftwidth=4 " Indents will have a width of 4 | |
set softtabstop=4 " Sets the number of columns for a TAB | |
set expandtab " Expand TABs to spaces |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vim Example with Bundle