Last active
September 1, 2024 20:30
-
-
Save montj2/5d4748f882eb82c1ad5bc6b118af1cfd to your computer and use it in GitHub Desktop.
Standard vimrc
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
syntax on | |
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
" change the leader key from \ to , | |
let mapleader = "," | |
" Big moves | |
" Move up and down by 20 spaces | |
nnoremap <C-j> 20<C-E> | |
nnoremap <C-k> 20<C-Y> | |
"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> | |
" Enter a new line below cursor, non-insert | |
nmap <S-Enter> o<Esc> | |
" Enable folding | |
set foldmethod=indent | |
set foldlevel=99 | |
" Enable folding with the spacebar | |
nnoremap <space> za | |
" Linting Setup | |
let g:ale_fixers = { | |
\ 'javascript': ['eslint'] | |
\ } | |
let g:ale_sign_error = '❌' | |
let g:ale_sign_warning = '⚠️' | |
let g:ale_fix_on_save = 1 | |
" Enable DocString comments to remain visible | |
let g:SimpylFold_docstring_preview=1 | |
" PEP 8 for Python | |
au BufNewFile, BufRead *.py | |
\ set tabstop=4 | |
\ set softtabstop=4 | |
\ set shiftwidth=4 | |
\ set textwidth=89 | |
\ set expandtab | |
\ set autoindent | |
\ set fileformat=unix | |
" Full stack development | |
au BufNewFile,BufRead *.js,*.html,*.css,*.vue set tabstop=2 | |
au BufNewFile,BufRead *.js,*.html,*.css,*.vue set softtabstop=2 | |
au BufNewFile,BufRead *.js,*.html,*.css,*.vue set shiftwidth=2 | |
au BufNewFile,BufRead *.js,*.html,*.css,*.vue set expandtab | |
au BufNewFile,BufRead *.js,*.html,*.css,*.vue set autoindent | |
" Catch the bad whitespace | |
au BufRead, BufNewFile *.py match BadWhitespace /\s\+$/ | |
" Python safety net encoding | |
set encoding=utf-8 | |
" You Complete Me helpers | |
let g:ycm_autoclose_preview_window_after_completion=1 | |
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR> | |
" Use tab for trigger completion with characters ahead and navigate. | |
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by | |
" other plugin before putting this into your config. | |
"inoremap <silent><expr> <TAB> | |
" \ pumvisible() ? "\<C-n>" : | |
" \ <SID>check_back_space() ? "\<TAB>" : | |
" \ coc#refresh() | |
"inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~ '\s' | |
endfunction | |
inoremap <silent><expr> <Tab> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<Tab>" : | |
\ kite#completion#autocomplete() | |
" Python with virtualenv support | |
" py3 << EOF | |
" import os | |
"import sys | |
"if 'VIRTUAL_ENV' in os.environ: | |
" project_base_dir = os.environ['VIRTUAL_ENV'] | |
" activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') | |
" #execfile(activate_this, dict(__file__=activate_this)) | |
" exec(open(activate_this).read(), {'__file__': activate_this}) | |
"EOF | |
let python_highlight_all=1 | |
" Ignore files in NERDTree | |
let NERDTreeIgnore=['\.pyc$', '\~$'] | |
map <leader>t :NERDTreeToggle<CR> | |
" enable line numbers | |
let NERDTreeShowLineNumbers=1 | |
" make sure relative line numbers are used | |
autocmd FileType nerdtree setlocal relativenumber | |
" Auto close NERDTree when opening a file | |
let NERDTreeQuitOnOpen=1 | |
" auto close NERDTree with last exit | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
" MD Preview requirements due to GRIP | |
let vim_markdown_preview_github=1 | |
call plug#begin() | |
Plug 'https://github.com/myusuf3/numbers.vim.git' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'tpope/vim-sensible' | |
Plug 'fisadev/vim-isort' | |
Plug 'godlygeek/tabular' | |
Plug 'posva/vim-vue' | |
Plug 'plasticboy/vim-markdown' | |
Plug 'JamshedVesuna/vim-markdown-preview' | |
Plug 'vim-scripts/indentpython.vim' | |
Plug 'tmhedberg/SimpylFold' | |
" Plug 'Valloric/YouCompleteMe' | |
Plug 'vim-syntastic/syntastic' | |
Plug 'nvie/vim-flake8' | |
Plug 'scrooloose/nerdtree' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'arcticicestudio/nord-vim' | |
Plug 'tpope/vim-fugitive' | |
Plug 'powerline/powerline-fonts' | |
Plug 'vim-airline/vim-airline' | |
Plug 'chriskempson/base16-vim' | |
Plug 'w0rp/ale' | |
call plug#end() | |
colorscheme nord | |
nnoremap <leader>d :r!date "+\%F" | |
let g:Powerline_symbols = 'fancy' | |
let vim_markdown_preview_browser='Google Chrome' | |
" New Stuff | |
" ~/.vim/ftplugin/c.vim | |
setlocal noexpandtab " Use tabs for indentation | |
setlocal tabstop=8 " 8 spaces per tab | |
setlocal shiftwidth=8 " Indentation level is 8 spaces | |
" Additional settings to align with Linux kernel style | |
setlocal textwidth=80 " Limit line length to 80 columns | |
setlocal cindent " Enable C-style indentation | |
setlocal cinoptions+=:0 " No space between 'case' and colon | |
setlocal cinoptions+=j1 " Indent 'case' labels one level | |
setlocal cinoptions+=l1 " Indent statements within 'case' blocks one level | |
setlocal cinoptions+=N-s " Place opening brace on same line for functions | |
setlocal cinoptions+=f0 " No space between function name and opening parenthesis | |
"~/.vim/ftplugin/python.vim | |
setlocal expandtab " Use spaces instead of tabs | |
setlocal tabstop=4 " 4 spaces per tab | |
setlocal shiftwidth=4 " Indentation level is 4 spaces | |
setlocal softtabstop=4 " Backspace deletes 4 spaces at a time | |
setlocal textwidth=80 " Limit line length to 79 characters (PEP 8 recommendation) | |
" Enable filetype plugin | |
filetype plugin on | |
" Set the runtimepath to include your custom ftplugin directory | |
set runtimepath+=~/.vim/ftplugin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment