Moved from nvim to vim

This commit is contained in:
Johannes Olzem 2025-02-15 13:48:42 +01:00
parent 3cd5f4c0f4
commit 5e54bf92bf
Signed by: jolzem
GPG Key ID: DB5485828E95A447
2 changed files with 88 additions and 0 deletions

View File

@ -61,6 +61,12 @@ for option in "$@"; do
[ ! -d "$HOME/.local/bin" ] && mkdir -p "$HOME/.local/bin"
cp scripts/* "$HOME/.local/bin"
;;
vim)
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
link "$PWD/vim/vimrc" "$HOME/.vim/vimrc"
vim +PluginInstall +qall
vim "+Copilot auth" +qall
;;
yay)
link "$PWD/yay/config.json" "$HOME/.config/yay/config.json"
;;

82
vim/vimrc Normal file
View File

@ -0,0 +1,82 @@
set nocompatible
filetype off
syntax on " enable syntax highlighting
set number relativenumber " relative line numbers
set ai " Sets auto-indentation
set si " Sets smart-indentation
set cursorline " Highlight current cursor line
set tabstop=2 " Tab equal 2 spaces (default 4)
set shiftwidth=2 " Arrow function (>>) creates 2 spaces
set expandtab " Use spaces instead of a tab charater on TAB
set smarttab " Be smart when using tabs
set hlsearch " When searching (/), highlights matches as you go
set incsearch " When searching (/), display results as you type (instead of only upon ENTER)
set smartcase " When searching (/), automatically switch to a case-sensitive search if you use any capital letters
set ttyfast " Boost speed by altering character redraw rates to your terminal
set showmatch " Show matching brackets when text indicator is over them
set noerrorbells " Silence the error bell
set novisualbell " Visually hide the error bell
set encoding=utf8 " Set text encoding as utf8
set clipboard+=unnamedplus " Use the OS clipboard by default
set showtabline=2 " Use tabline
set splitright " split to the right instead of left
set textwidth=80 " Limit to 80 characters in width
set colorcolumn=80 " Colored Column after 80 Characters
set wrap " enable line wrap
set bg=dark " set dark background
set wildmode=longest,list,full
set mouse=a " enable mouse
set splitright " always split right
" 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')
Plugin 'VundleVim/Vundle.vim' " Let Vundle manage Vundle
Plugin 'sheerun/vim-polyglot' " Syntax highlighting
Plugin 'jiangmiao/auto-pairs' " Pair completion
Plugin 'lervag/vimtex' " LaTeX tools
Plugin 'vim-airline/vim-airline' " Nicer info line
Plugin 'junegunn/goyo.vim' " Zen Workspace
Plugin 'morhetz/gruvbox' " Color scheme
Plugin 'https://github.com/ap/vim-css-color' " highlight color codes in their color
Plugin 'https://github.com/907th/vim-auto-save.git' " auto save
Plugin 'https://github.com/github/copilot.vim' " github copilot
call vundle#end()
colorscheme gruvbox
filetype plugin indent on
let g:auto_save = 1
let g:AutoPairsShortcutToggle = '<C-P>' " Press Ctrl+P to disable pair completion
let g:vimtex_view_method = 'zathura'
let g:airline#extensions#tabline#enabled = 1
" REMAPPING
" jump to last known position when opening a file
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
map <C-g> :Goyo<CR>
imap <C-g> <esc>:Goyo<CR>a
" indent with tab
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
vnoremap <Tab> >>
inoremap <Tab> <Esc>>>a
nnoremap <Tab> >>
inoremap <S-Tab> <Esc><<a
nnoremap <S-Tab> <<
" jump to beginning of selection when exiting visual mode
vnoremap <Esc> o<Esc>
autocmd BufWritePre,BufRead *.tex :VimtexCompile " autocompile tex docs
autocmd VimLeave *.tex :!texclear % " clear tex junk when closing tex file
autocmd BufWritePre * %s/\s\+$//e " auto delete trailing white space on save
autocmd BufWritePost *.vim source %