From db4873128605c523a51897c585c98af527c1f7f8 Mon Sep 17 00:00:00 2001 From: Simon Martens Date: Thu, 2 Oct 2025 12:49:41 +0200 Subject: [PATCH] +vimrc --- .vimrc | 212 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 .vimrc diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..41dcfd8 --- /dev/null +++ b/.vimrc @@ -0,0 +1,212 @@ +" Options +"----------------------------------------------------------------------------------------------- +" Set 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 ,p "0p +vnoremap ,p "0p +nnoremap ,P "0P +vnoremap ,P "0P + +" Normal behaviour of j and k in wrapped lines +nnoremap j gj +vnoremap j gj +nnoremap k gk +vnoremap k gk + +" Replace word I am on in the whole file +nnoremap rw :%s/\<\>//g + +" Allow moving selected text vertically in visual mode +vnoremap K :m '<-2gv=gv +vnoremap J :m '>+1gv=gv + +" Clear highlight on pressing in normal mode: +nnoremap :nohlsearch + +" 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 zz +nnoremap zz +nnoremap n nzzzv +nnoremap N Nzzzv + +" Delete without yanking +nnoremap d "_d +vnoremap d "_d + +" Paste without yanking +nnoremap p "_dP + +" Disable deselection when indenting in visual mode +vnoremap < > >gv + +" Keybinds to make split navigation easier. +" Use arrow keys to switch between windows +nnoremap +vnoremap +nnoremap +vnoremap +nnoremap +vnoremap +nnoremap +vnoremap + +" Keybinds to make buffer navigation easier +nnoremap gb :bn +nnoremap gB :bp + +" Keybinds to make tab navigation easier +nnoremap gT :tabprevious +nnoremap gt :tabnext +nnoremap t :tabnew +nnoremap :tabprevious +nnoremap :tabnext