From 56360889c163f15bb23313e3a27c3898c42ed459 Mon Sep 17 00:00:00 2001 From: Filemon Moenne-loccoz Date: Wed, 6 Nov 2019 12:44:44 +0100 Subject: add .vimrc copyright Rd2rue --- .vimrc | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 .vimrc (limited to '.vimrc') diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..480141e --- /dev/null +++ b/.vimrc @@ -0,0 +1,178 @@ +let mapleader="," + +" Plugins +call plug#begin('~/.vim/plugged') +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +call plug#end() + +" Some basics: + "set bg=light + set go=a + set mouse=a + set nohlsearch + set clipboard=unnamedplus + set tabstop=4 + set softtabstop=4 + set shiftwidth=4 + nnoremap c "_c + set nocompatible + filetype plugin indent on + set encoding=utf-8 + set number + set ruler + syntax on + set hidden + +" Enable autocompletion: + set wildmode=longest,list,full + +" Previous / next buffer + noremap :bprevious + noremap :bnext + noremap w :w :bp :bd # + +" Airline + let g:airline#extensions#tabline#enabled = 1 + let g:airline#extensions#tabline#fnamemod = ':t' + let g:airline_detect_modified = 1 + let g:airline_detect_paste = 1 + let g:airline_detect_crypt = 1 + let g:airline_theme = 'term' + let g:airline_powerline_fonts = 1 + let g:airline_symbols_ascii = 1 + let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]' + +" Cursor mode + let g:airline#extensions#cursormode#enabled = 1 + let g:cursormode_color_map = { + \ "i": "#7da9c7", + \ "n": "#eac179", + \ "R": "#bb5653", + \ "r": "#bb5653", + \ "v": "#b06597", + \ "V": "#b06597", + \ "\": "#b06597", + \} + +" 10 buffers jump + let g:airline#extensions#tabline#buffer_idx_mode = 1 + nmap 1 AirlineSelectTab1 + nmap 2 AirlineSelectTab2 + nmap 3 AirlineSelectTab3 + nmap 4 AirlineSelectTab4 + nmap 5 AirlineSelectTab5 + nmap 6 AirlineSelectTab6 + nmap 7 AirlineSelectTab7 + nmap 8 AirlineSelectTab8 + nmap 9 AirlineSelectTab9 + nmap 0 AirlineSelectTab10 + +" Disables automatic commenting on newline: + autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o + +" Powerline + set laststatus=2 + set t_Co=256 + +" Runs a script that cleans out tex build files whenever I close out of a .tex file. + autocmd VimLeave *.tex !texclear % + +" Compile document, be it groff/LaTeX/markdown/etc. + "map c :w! \| !compiler % + autocmd BufWritePost *.tex !compiler % + +" Compile C file + autocmd FileType c noremap :w :!clear :!~/.vim/c/f5.sh; + autocmd FileType c noremap :w :!clear :!~/.vim/c/f6.sh; + autocmd FileType c noremap :w:!gcc-Wall-Wextra-Werror % + autocmd FileType c noremap :w :!clear :!~/.vim/c/f9.sh % + autocmd FileType c noremap :w :!clear :!~/.vim/c/f10.sh % + +" Compile C++ file + autocmd FileType cpp noremap :w :!clear :!~/.vim/cpp/f5.sh; + autocmd FileType cpp noremap :w :!clear :!~/.vim/cpp/f6.sh; + autocmd FileType cpp noremap :w:!g++-Wall-Wextra-Werror % + autocmd FileType cpp noremap :w :!clear :!~/.vim/cpp/f9.sh % + autocmd FileType cpp noremap :w :!clear :!~/.vim/cpp/f10.sh % +" === Comfy === +" C + autocmd FileType c inoremap " "" + autocmd FileType c inoremap ' '' + autocmd FileType c inoremap ( () + autocmd FileType c inoremap [ [] + autocmd FileType c inoremap { {} + autocmd FileType c inoremap < <> + autocmd FileType c inoremap { {}O + autocmd FileType c inoremap {; {};O + autocmd FileType c inoremap < < + autocmd FileType c inoremap > > + autocmd FileType c inoremap <= <= + autocmd FileType c nnoremap m o#include#include#include#includeintmain(void){return0;}O + autocmd FileType c nnoremap M o#include#include#include#includeintmain(intargc,char*argv[]){if(argc!=1){printf("NOTENOUGHARGS\n");return1;}return0;}Oprintf(); + +" C++ + autocmd FileType cpp noremap :w:!g++-Wall-Wextra-Werror -O3 % + autocmd FileType cpp noremap :w:!g++ -Wall -Wextra -Werror -O3 %; ./a.out ; echo "~>\n\n.vimrc 2.3.1-release Tilde Edition by Joe"; rm a.out + autocmd FileType cpp noremap :w:!g++ -Wall -Wextra -Werror -O3 %; ./a.out; echo "~>\n\n.vimrc 2.3.1-release Tilde Edition by Joe"; rm a.out + autocmd FileType cpp inoremap " "" + autocmd FileType cpp inoremap ' '' + autocmd FileType cpp inoremap ( () + autocmd FileType cpp inoremap [ [] + autocmd FileType cpp inoremap { {} + autocmd FileType cpp inoremap < <> + autocmd FileType cpp inoremap { {}O + autocmd FileType cpp inoremap {; {};O + autocmd FileType cpp inoremap < < + autocmd FileType cpp inoremap << << + autocmd FileType cpp inoremap > > + autocmd FileType cpp inoremap >> >> + autocmd FileType cpp inoremap <= <= + autocmd FileType cpp nnoremap m ointmain(void){return0;}O + autocmd FileType cpp nnoremap M ointmain(intargc,char*argv[]){if(argc!=1)return0;if(argv[]){}return0;}O + autocmd FileType cpp nnoremap M ointmain(intargc,char*argv[]){if(argc!=1){cout<<"NOTENOUGHARGS"<<endl;return1;}return0;}O + +" = Web = +" HTML + autocmd FileType html inoremap " "" + autocmd FileType html inoremap ' '' + autocmd FileType html inoremap ( () + autocmd FileType html inoremap [ [] + autocmd FileType html inoremap { {} + autocmd FileType html inoremap { {}O + autocmd FileType html inoremap < <> + +" PHP + autocmd FileType php inoremap " "" + autocmd FileType php inoremap ' '' + autocmd FileType php inoremap ( () + autocmd FileType php inoremap [ [] + autocmd FileType php inoremap { {} + autocmd FileType php inoremap { {}O + autocmd FileType php inoremap < <> + autocmd FileType php inoremap + autocmd FileType php inoremap ?>O + +" CSS + autocmd FileType css inoremap " "" + autocmd FileType css inoremap ' '' + autocmd FileType css inoremap ( () + autocmd FileType css inoremap [ [] + autocmd FileType css inoremap { {} + autocmd FileType css inoremap { {}O + + +" Just in case + inoremap " "" + inoremap ' '' + inoremap ( () + inoremap [ [] + inoremap { {} + inoremap "" "" + inoremap '' '' + inoremap () () + inoremap [] [] + inoremap {} {} + inoremap <> <> + +" .vimrc 2.4.1-release | Copyright Joe 2k19 -- cgit v1.2.3