Last active
November 19, 2023 14:31
-
-
Save hG3n/77706178733dd2f1452b to your computer and use it in GitHub Desktop.
vim config file
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
""""""""""""""""""""""" | |
"--- !! VUNDLE !! --- " | |
""""""""""""""""""""""" | |
set shell=/bin/bash | |
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'VundleVim/Vundle.vim' | |
" Plugin 'shougo/neocomplete' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'Yggdroot/indentLine' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'Townk/vim-autoclose' | |
" Plugin 'rking/ag.vim' | |
" Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'tpope/vim-surround' | |
Plugin 'tpope/vim-commentary' | |
" Plugin 'othree/html5.vim' | |
" Plugin 'crusoexia/vim-monokai' | |
" Plugin 'pangloss/vim-javascript' | |
Plugin 'godlygeek/tabular' | |
" Plugin 'majutsushi/tagbar' | |
Plugin 'keith/swift.vim' | |
Plugin 'leafgarland/typescript-vim' | |
Plugin 'ctrlpvim/ctrlp.vim' | |
call vundle#end() | |
filetype plugin on | |
""""""""""""""""""""""""""" | |
"--- GENERAL SETTINGS ---" | |
""""""""""""""""""""""""""" | |
scriptencoding utf-8 | |
set enc=utf-8 | |
set fileencoding=utf-8 | |
set fileencodings=ucs-bom,utf8,prc | |
set backspace=indent,eol,start "in case bcksp isnt working well" | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 "set Tabvalue=4"dd | |
set ruler "always show actual position" | |
set nu "side indexnunbers" | |
set history=1000 | |
set undolevels=1000 | |
set noswapfile "disable creating stupid .swp files" | |
set nobackup | |
set nowritebackup | |
set autoindent | |
set title "sets filename on top of the open window" | |
set wildmenu "sets the autocomplete in commandline" | |
set showmode "shows the actual mode" | |
set mouse=a "enables Mouse in vim" | |
set clipboard=unnamed "use the system clipboard for copying and pasting | |
set showcmd "show partial commands in status line and | |
"selected characters/lines in visual mode" | |
set showmatch "show matching brackets/parenthesis | |
set incsearch "find as you type search" | |
set hlsearch "highlights searched objects" | |
set expandtab "set tabs to spaces | |
set list listchars=tab:-\ \,trail:· "set points after | |
"enables codefolding" | |
set foldmethod=indent | |
set foldnestmax=10 | |
set foldcolumn=2 | |
set nofoldenable | |
set foldlevel=1 | |
"soft wrap and indent lines | |
set breakindent | |
set showbreak=\ | |
" scroll down with five lines visible | |
set scrolloff=5 | |
" show the numbers od lines | |
"set relativenumber | |
"enables syntax detection" | |
syntax on | |
"colorscheme" | |
set t_Co=256 | |
" colorscheme monokai | |
" colorscheme badwolf | |
" set to autoread if a file is changed from the outside | |
set autoread | |
"""""""""""""""""""" | |
"--- REMAPPINGS ---" | |
"""""""""""""""""""" | |
" options for key remapping | |
" <Esc> Escape key | |
" <C-G> CTRL-G | |
" <Up> cursor up key | |
" <C-LeftMouse> Control- left mouse click | |
" <S-F11> Shifted function key 11 | |
" <M-a> Meta- a ('a' with bit 8 set) | |
" <M-A> Meta- A ('A' with bit 8 set) | |
" <t_kd> "kd" termcap entry (cursor down key) | |
" switch to insert mode when typing 'jk' in insert mode | |
" best map EVER | |
inoremap jk <esc> | |
" temporarily disable escape and cursor keys key | |
inoremap <esc> <nop> | |
map <up> <nop> | |
map <down> <nop> | |
map <left> <nop> | |
map <right> <nop> | |
" movement | |
nmap H 0 | |
vmap H 0 | |
nmap L $ | |
vmap L $ | |
"Stupid shift key fixes & helper" | |
cmap X x | |
cmap W w | |
cmap Q q | |
cmap WQ wq | |
cmap wQ wq | |
cmap Tabe tabe | |
cmap qq q! | |
cmap xx x! | |
cmap ww w! | |
" faster mapping to get into normal mode | |
vmap ; :norm | |
"Yank from the cursor to the end of the line, to be consistent with C and D" | |
nnoremap Y y$ | |
"pane switching done easily | |
nmap <tab> <C-w><C-w> | |
"tab movement | |
nmap tn :tabnew<CR> | |
nmap tq :tabclose<CR> | |
nmap <S-tab> :tabnext<CR> | |
" cycle through buffers | |
nmap B :bnext<CR> | |
" center current search result | |
nmap n nzz | |
nmap N Nzz | |
"toggle tagbar | |
" nmap tb :Tagbar<CR> | |
"get the fuck out of insert mode if I press esc | |
"inoremap <Esc> <Esc><Esc> | |
""""""""""""""""""""""" | |
"--- CONFIG FILES ---" | |
""""""""""""""""""""""" | |
" using external files to keep an overview on that file | |
" neocomplete settings length sucks, airline as well | |
" source ~/.vim/configs/airline.config.vim | |
" source ~/.vim/configs/neocomplete.config.vim | |
"""""""""""""""""""""""""" | |
"--- LEADER SHORTCUTS ---" | |
"""""""""""""""""""""""""" | |
let mapleader = "," "creates mapleader do do more key combinations | |
" select all text | |
nnoremap <leader>a ggVG | |
"clearing highlighted search | |
nmap <silent> <leader><space> :nohlsearch<CR> | |
"increase the value below the cursor by 1 | |
"nnoremap <leader>f IncreaseValueByOne | |
""""""""""""""""""" | |
"--- SYNTASTIC ---" | |
""""""""""""""""""" | |
set statusline+=%#warningmsg# | |
set statusline+=%{SyntasticStatuslineFlag()} | |
set statusline+=%* | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 0 | |
let g:syntastic_cpp_compiler = 'g++-5' | |
let g:syntastic_cpp_compiler_options = ' -std=c++11 -Wall' | |
let g:syntastic_c_include_dirs = ['/usr/include', '/usr/local/include', '/usr/local/include/opencv', '/usr/local/include/opencv2'] | |
let g:syntastic_cpp_include_dirs = ['/usr/include', '/usr/local/include', '/usr/local/include/opencv', '/usr/local/include/opencv2'] | |
let g:syntastic_html_tidy_exec = '/usr/local/Cellar/tidy-html5/5.1.25/bin/tidy' | |
let syntastic_mode_map = { 'passive_filetypes': ['html','typescript'] } | |
""""""""""""""""""" | |
"--- NERDTREE ---" | |
""""""""""""""""""" | |
let g:indentLine_color_term = 239 | |
let g:indentLine_char = '·' | |
"""""""""""""""""""""""""""""" | |
"--- OTHER MINOR SETTINGS ---" | |
"""""""""""""""""""""""""""""" | |
"convert every umlaut into HTML Format" | |
"because fuck you HTML | |
function HtmlEscape() | |
silent s/ö/\ö/eg | |
silent s/ä/\ä/eg | |
silent s/ü/\ü/eg | |
silent s/Ö/\Ö/eg | |
silent s/Ä/\Ä/eg | |
silent s/Ü/\Ü/eg | |
silent s/ß/\ß/eg | |
endfunction | |
map <silent> <c-h> :call HtmlEscape()<CR> | |
"""""""""""""""""""""""""" | |
"--- BUILDING OPTIONS ---" | |
"""""""""""""""""""""""""" | |
"run current python programs | |
autocmd Filetype python map <c-b> :w <CR>:!python "%"<CR> | |
"compile tex document | |
autocmd Filetype tex map <c-t> :w <CR>:!lualatex *.tex <CR> | |
"compile project if the data type is c++ | |
autocmd Filetype cpp map <c-b> :w <CR>:!make <CR> | |
"compile project if the data type is c++ | |
autocmd Filetype swift map <c-b> :w <CR>:!make run<CR> | |
"compile project if the data type is typescript | |
autocmd Filetype typescript map <c-b> :w <CR>:silent :make<CR>:redraw!<CR> | |
"Sudo to write | |
cnoremap w!! w !sudo tee % >/dev/null | |
"return to the same line if reopen a file" | |
augroup line_return | |
au! | |
au BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | | |
\ execute 'normal! g`"zvzz' | | |
\ endif | |
augroup END | |
"automatically add shebang in the first line of the file | |
augroup Shebang | |
autocmd BufNewFile *.py 0put =\"#!/usr/bin/env python\<nl>\"|$ | |
autocmd BufNewFile *.zsh 0put =\"#!/bin/bash <nl>\"|$ | |
autocmd BufNewFile *.sh 0put =\"#!/bin/bash <nl>\"|$ | |
augroup END | |
"""""""""""""""""""""-" | |
"--- CTRL-P PLUGIN ---" | |
"""""""""""""""""""""-" | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip | |
"""""""""""""""""""" | |
"--- INDENTLINE ---" | |
"""""""""""""""""""" | |
let g:indentLine_char = '¦' | |
"""""""""""""""""""""""""""" | |
"--- FILETYPPE SETTINGS ---" | |
"""""""""""""""""""""""""""" | |
autocmd FileType html setlocal ts=4 | |
autocmd FileType html setlocal shiftwidth=4 | |
autocmd FileType html setlocal softtabstop=4 | |
autocmd FileType typescript setlocal shortmess= | |
autocmd FileType markdown setlocal ts=4 | |
autocmd FileType markdown setlocal shiftwidth=4 | |
autocmd FileType markdown setlocal softtabstop=4 | |
""""""""""""""""""""""""""""" | |
"--- TYPESCRIPT SETTINGS ---" | |
""""""""""""""""""""""""""""" | |
autocmd QuickFixCmdPost [^l]* nested cwindow | |
autocmd QuickFixCmdPost l* nested lwindow | |
" i know you mean good but this sucks ass | |
let g:vim_json_conceal=0 | |
""""""""""""""""""" | |
"--- FUNCTIONS ---" | |
""""""""""""""""""" | |
" function! IncreaseValueByOne | |
" let character = matchstr(getline('.'), '\%'.col('.').'c.') | |
" if character = ~# '^\d\+$' | |
" character += 1 | |
" endif | |
" normal! a . character . jk | |
" endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment