dotfiles/.vimrc

180 lines
5.4 KiB
VimL
Raw Normal View History

2021-05-27 17:54:53 +02:00
" Vundle
set nocompatible
filetype off
" Set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
" Download plug-ins to the ~/.vim/plugged/ directory
call vundle#begin('~/.vim/plugged')
2021-06-01 17:44:59 +02:00
" Let Vundle manage Vundle; muss immer der erste eintrag sein
Plugin 'VundleVim/Vundle.vim'
2021-05-31 20:04:54 +02:00
Plugin 'nestorsalceda/vim-strip-trailing-whitespaces'
2021-05-31 20:44:56 +02:00
" entferne trailing whitespaces
Plugin 'itchyny/lightline.vim'
" statusline
2021-05-27 17:54:53 +02:00
Plugin 'sheerun/vim-polyglot'
2021-06-01 17:44:59 +02:00
" languagepack
2021-05-27 22:27:43 +02:00
Plugin 'Xuyuanp/nerdtree-git-plugin'
2021-06-01 17:44:59 +02:00
" nerdtree plugin, markiere dateien mit git symbolen
2021-05-28 08:51:12 +02:00
Plugin 'jeetsukumaran/vim-buffergator'
2021-06-01 17:44:59 +02:00
" buffer wechseln
2021-05-27 22:27:43 +02:00
Plugin 'mhinz/vim-signify'
2021-06-01 17:44:59 +02:00
" change icons neben der zeilennummerierung
2021-05-27 17:54:53 +02:00
Plugin 'ctrlpvim/ctrlp.vim'
2021-05-31 20:44:56 +02:00
" fuzzy finder
2021-05-27 17:54:53 +02:00
Plugin 'lifepillar/vim-solarized8'
2021-05-31 20:44:56 +02:00
" farbschema
2021-05-27 17:54:53 +02:00
Plugin 'Yggdroot/indentLine'
2021-05-31 20:44:56 +02:00
" einrückungsmarkierungen
2021-05-27 17:54:53 +02:00
Plugin 'tpope/vim-fugitive'
2021-05-31 20:44:56 +02:00
" git integration G:
2021-05-27 17:54:53 +02:00
Plugin 'jiangmiao/auto-pairs'
2021-05-31 20:44:56 +02:00
" autovervollständigung symbole wie klammern
2021-05-27 17:54:53 +02:00
Plugin 'preservim/nerdtree'
2021-06-01 17:44:59 +02:00
" dateibrowser
2021-05-27 21:47:49 +02:00
Plugin 'unkiwii/vim-nerdtree-sync'
2021-05-31 20:44:56 +02:00
" springe in nerdtree zur geöffneten datei
2021-05-31 19:50:49 +02:00
Plugin 'jreybert/vimagit'
2021-06-01 17:44:59 +02:00
" git integration
2021-05-27 17:54:53 +02:00
call vundle#end()
2021-06-01 17:44:59 +02:00
" allgemeine Optionen
set showcmd
set showbreak=+++
set textwidth=100
set showmatch
set virtualedit=onemore
set encoding=UTF-8
set visualbell
set hlsearch
set smartcase
set gdefault
set ignorecase
set incsearch
set autoindent
set smartindent
set smarttab
set softtabstop=4
set ruler
set undolevels=1000
set backspace=indent,eol,start
set nu " Enable line numbers
syntax on " Enable syntax highlighting
set tabstop=4 " How many columns of whitespace a \t is worth
set shiftwidth=4 " How many columns of whitespace a level of indentation is worth
set expandtab " Use spaces when tabbing
set incsearch " Enable incremental search
set hlsearch " Enable highlight search
set termwinsize=12x0 " Set terminal size
set splitbelow " Always split below
set mouse=a " Enable mouse drag on window splits
set clipboard=unnamedplus " https://unix.stackexchange.com/questions/12535/how-to-copy-text-from-vim-to-an-external-program
" Keybindings"
:let mapleader = ","
2021-05-27 17:54:53 +02:00
" auto-pairs
2021-05-31 20:24:43 +02:00
let g:AutoPairsShortcutToggle = '<C-P>'
2021-06-01 17:44:59 +02:00
" lightline/statusline
set laststatus=2
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ }
2021-06-01 17:44:59 +02:00
2021-05-27 21:47:49 +02:00
" NERDtree + nerdtree-sync
2021-06-01 17:44:59 +02:00
" https://github.com/preservim/nerdtree
2021-05-27 17:54:53 +02:00
let NERDTreeShowHidden = 1 " Show hidden files
let NERDTreeShowLineNumbers = 0 " Hide line numbers
let NERDTreeMinimalMenu = 1 " Use the minimal menu (m)
let NERDTreeWinSize = 31 " Set panel width to 31 columns
nmap <F2> :NERDTreeToggle<CR> " ruft NERDtree mit F2 auf
2021-05-31 19:39:11 +02:00
" Start NERDTree when Vim is started without file arguments.
2021-05-27 21:47:49 +02:00
autocmd StdinReadPre * let s:std_in=1
2021-05-31 19:39:11 +02:00
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | endif
2021-05-27 21:47:49 +02:00
let g:nerdtree_sync_cursorline = 1 " highlight the file in tree
" exit Vim if NERDTree is the only window left.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
\ quit | endif
2021-06-01 17:44:59 +02:00
" buffergator
2021-05-28 08:51:12 +02:00
" https://joshldavis.com/2014/04/05/vim-tab-madness-buffers-vs-tabs/
" This allows buffers to be hidden if you've modified a buffer.
" " This is almost a must if you wish to use buffers in this way.
set hidden
2021-05-28 09:19:23 +02:00
" To open a new empty buffer
2021-05-28 08:51:12 +02:00
nmap <C-t> :enew<cr>
2021-06-01 17:46:00 +02:00
" Move to the next buffer
2021-05-28 08:51:12 +02:00
nmap <C-l> :bnext<CR>
" Move to the previous buffer
2021-05-28 09:19:23 +02:00
nmap <C-h> :bprevious<CR>
" Close the current buffer and move to the previous one
2021-05-28 08:51:12 +02:00
" This replicates the idea of closing a tab
2021-05-28 09:24:32 +02:00
nmap <C-q> :bp <BAR> bd #<CR>
2021-06-01 17:44:59 +02:00
2021-05-28 09:19:23 +02:00
" nerdtree-git-plugin
2021-05-27 22:45:40 +02:00
let g:NERDTreeGitStatusIndicatorMapCustom = {
\ 'Modified' :'*',
\ 'Staged' :'+',
\ 'Untracked' :'',
\ 'Renamed' :'*',
\ 'Unmerged' :'',
\ 'Deleted' :'-',
\ 'Dirty' :'',
\ 'Ignored' :'',
\ 'Clean' :'',
\ 'Unknown' :'?',
\ }
2021-06-01 17:44:59 +02:00
2021-05-27 17:54:53 +02:00
" indentLine
" fügt vertikale Striche bei Einrückungen ein
filetype plugin indent on
2021-06-01 17:44:59 +02:00
2021-05-27 17:54:53 +02:00
" aussehen
2021-05-28 10:21:32 +02:00
set background=dark " dark or light
2021-05-27 12:30:15 +02:00
colorscheme solarized8 " Your favorite color scheme's name
2021-06-01 17:44:59 +02:00
2021-05-27 17:54:53 +02:00
" ripgrep und ctrlp
" sudo apt install ripgrep(rg)
if executable('rg')
let g:ctrlp_user_command = 'rg %s --files --hidden --color=never --glob ""'
endif
let g:ctrlp_map = '<c-f>' "aufruf mit strg+f
" ignore files
" https://github.com/ctrlpvim/ctrlp.vim
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
2021-05-28 13:26:56 +02:00
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
2021-05-27 22:27:43 +02:00
2021-05-31 19:45:32 +02:00
"https://jeffkreeftmeijer.com/vim-number/
set number relativenumber
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
augroup END
2021-06-01 17:44:59 +02:00
2021-05-31 19:56:37 +02:00
" vimagit
" https://github.com/jreybert/vimagit#mappings
nmap <Leader>m :Magit<cr>
2021-06-01 17:44:59 +02:00
2021-05-31 21:10:00 +02:00
" toggle linenumbers
nmap <Leader>c :set norelativenumber!<CR>:set nonu!<CR>