mirror of
https://github.com/Theodor-Springmann-Stiftung/server-package.git
synced 2025-10-28 08:45:32 +00:00
+vimrc
This commit is contained in:
212
.vimrc
Normal file
212
.vimrc
Normal file
@@ -0,0 +1,212 @@
|
||||
" Options
|
||||
"-----------------------------------------------------------------------------------------------
|
||||
" Set <space> as the leader key
|
||||
" See :help mapleader
|
||||
" NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||
let mapleader = ' '
|
||||
let maplocalleader = ' '
|
||||
|
||||
" Dont use the tab key for copilot suggestions
|
||||
let g:copilot_no_tab_map = 1
|
||||
|
||||
" [[ Setting options ]]
|
||||
" See :help option-list
|
||||
|
||||
" Make line numbers default
|
||||
set number
|
||||
|
||||
" Enable mouse mode, can be useful for resizing splits for example!
|
||||
set mouse=a
|
||||
|
||||
" Don't show the mode, since it's already in status line
|
||||
set noshowmode
|
||||
|
||||
" Sync clipboard between OS and Vim.
|
||||
" Remove this option if you want your OS clipboard to remain independent.
|
||||
" See :help 'clipboard'
|
||||
set clipboard=unnamedplus
|
||||
|
||||
" Enable break indent
|
||||
set breakindent
|
||||
|
||||
" Save undo history
|
||||
set noswapfile
|
||||
set nobackup
|
||||
set undofile
|
||||
|
||||
" Create undo directory if it doesn't exist
|
||||
if !isdirectory($HOME . "/.vim/undo")
|
||||
call mkdir($HOME . "/.vim/undo", "p", 0700)
|
||||
endif
|
||||
set undodir=~/.vim/undo
|
||||
|
||||
" Case-insensitive searching UNLESS \C or capital in search
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" Keep signcolumn on by default (Vim 8.1+)
|
||||
if has('signs') && v:version >= 801
|
||||
set signcolumn=yes
|
||||
endif
|
||||
|
||||
" Decrease update time
|
||||
set updatetime=250
|
||||
|
||||
" Time when the help popup will appear
|
||||
set timeoutlen=300
|
||||
|
||||
" Configure how new splits should be opened
|
||||
set splitright
|
||||
set splitbelow
|
||||
|
||||
" Sets how vim will display certain whitespace in the editor.
|
||||
" See :help 'list'
|
||||
" and :help 'listchars'
|
||||
set list
|
||||
set listchars=tab:\ \ ,trail:·,nbsp:␣
|
||||
|
||||
" Show which line your cursor is on
|
||||
set cursorline
|
||||
|
||||
" Minimal number of screen lines to keep above and below the cursor.
|
||||
set scrolloff=16
|
||||
|
||||
" Tab size
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
|
||||
" Don't expand tabs into spaces
|
||||
set noexpandtab
|
||||
|
||||
" Relative line numbers
|
||||
" See :help 'relativenumber'
|
||||
set relativenumber
|
||||
|
||||
" Disable folding, we don't need it
|
||||
set nofoldenable
|
||||
|
||||
" Set highlight on search
|
||||
set hlsearch
|
||||
|
||||
" Reset the cursor
|
||||
set guicursor=
|
||||
|
||||
" Enable syntax highlighting
|
||||
syntax on
|
||||
|
||||
" Set colorscheme (Vim 8.2+)
|
||||
colorscheme habamax
|
||||
|
||||
" Auto-indent new lines
|
||||
set autoindent
|
||||
set smartindent
|
||||
|
||||
" Show search matches as you type
|
||||
set incsearch
|
||||
|
||||
" Enhanced command-line completion
|
||||
set wildmenu
|
||||
set wildmode=longest:full,full
|
||||
|
||||
" Show incomplete commands in status line
|
||||
set showcmd
|
||||
|
||||
" Make backspace work properly in insert mode
|
||||
set backspace=indent,eol,start
|
||||
|
||||
" Allow switching buffers without saving
|
||||
set hidden
|
||||
|
||||
" Always show status line
|
||||
set laststatus=2
|
||||
|
||||
" UTF-8 encoding by default
|
||||
set encoding=utf-8
|
||||
|
||||
" Auto-reload files changed outside Vim
|
||||
set autoread
|
||||
|
||||
" Disable error bells
|
||||
set noerrorbells
|
||||
set novisualbell
|
||||
|
||||
" Highlight matching brackets when typing
|
||||
set showmatch
|
||||
set matchtime=2
|
||||
|
||||
" Longer command history
|
||||
set history=1000
|
||||
|
||||
" Wrap long lines
|
||||
set wrap
|
||||
|
||||
" Don't redraw screen during macros (faster)
|
||||
set lazyredraw
|
||||
|
||||
" Ask for confirmation instead of failing commands
|
||||
set confirm
|
||||
|
||||
" [[ Basic Keymaps ]]
|
||||
"-----------------------------------------------------------------------------------------------
|
||||
|
||||
" Always paste what was yanked, not what was deleted:
|
||||
nnoremap <silent> ,p "0p
|
||||
vnoremap <silent> ,p "0p
|
||||
nnoremap <silent> ,P "0P
|
||||
vnoremap <silent> ,P "0P
|
||||
|
||||
" Normal behaviour of j and k in wrapped lines
|
||||
nnoremap <silent> j gj
|
||||
vnoremap <silent> j gj
|
||||
nnoremap <silent> k gk
|
||||
vnoremap <silent> k gk
|
||||
|
||||
" Replace word I am on in the whole file
|
||||
nnoremap <leader>rw :%s/\<<C-r><C-w>\>//g<left><left>
|
||||
|
||||
" Allow moving selected text vertically in visual mode
|
||||
vnoremap <silent> K :m '<-2<CR>gv=gv
|
||||
vnoremap <silent> J :m '>+1<CR>gv=gv
|
||||
|
||||
" Clear highlight on pressing <Esc> in normal mode:
|
||||
nnoremap <Esc> :nohlsearch<CR>
|
||||
|
||||
" Vertically jump around half a page and always center the cursor
|
||||
" Vertically jump around to the next/prev search result and always center the cursor
|
||||
nnoremap <C-u> <C-u>zz
|
||||
nnoremap <C-d> <C-d>zz
|
||||
nnoremap n nzzzv
|
||||
nnoremap N Nzzzv
|
||||
|
||||
" Delete without yanking
|
||||
nnoremap <leader>d "_d
|
||||
vnoremap <leader>d "_d
|
||||
|
||||
" Paste without yanking
|
||||
nnoremap <leader>p "_dP
|
||||
|
||||
" Disable deselection when indenting in visual mode
|
||||
vnoremap <silent> < <gv
|
||||
vnoremap <silent> > >gv
|
||||
|
||||
" Keybinds to make split navigation easier.
|
||||
" Use arrow keys to switch between windows
|
||||
nnoremap <silent> <Left> <C-w><C-h>
|
||||
vnoremap <silent> <Left> <C-w><C-h>
|
||||
nnoremap <silent> <Right> <C-w><C-l>
|
||||
vnoremap <silent> <Right> <C-w><C-l>
|
||||
nnoremap <silent> <Down> <C-w><C-j>
|
||||
vnoremap <silent> <Down> <C-w><C-j>
|
||||
nnoremap <silent> <Up> <C-w><C-k>
|
||||
vnoremap <silent> <Up> <C-w><C-k>
|
||||
|
||||
" Keybinds to make buffer navigation easier
|
||||
nnoremap <silent> gb :bn<CR>
|
||||
nnoremap <silent> gB :bp<CR>
|
||||
|
||||
" Keybinds to make tab navigation easier
|
||||
nnoremap gT :tabprevious<CR>
|
||||
nnoremap gt :tabnext<CR>
|
||||
nnoremap <Leader>t :tabnew<CR>
|
||||
nnoremap <Leader><S-Tab> :tabprevious<CR>
|
||||
nnoremap <Leader><Tab> :tabnext<CR>
|
||||
Reference in New Issue
Block a user