pub_vim_config/vimrc

382 lines
7.4 KiB
VimL
Raw Normal View History

2023-08-20 09:04:43 +00:00
" Maintainer: Jake Gooddwin<jakegoodwin@tutanota.com>
" Last change: 2023 Augest 20
" Version: Vim9.0
" When started as "evim", evim.vim will already have done these settings, bail
" out.
if v:progname =~? "evim"
finish
endif
" Get the defaults that most users want.
source $VIMRUNTIME/defaults.vim
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file (restore to previous version)
if has('persistent_undo')
set undofile " keep an undo file (undo changes after closing)
endif
endif
if &t_Co > 2 || has("gui_running")
" Switch on highlighting the last used search pattern.
set hlsearch
endif
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
augroup END
" Add optional packages.
"
" The matchit plugin makes the % command work better, but it is not backwards
" compatible.
" The ! means the package won't be loaded right away but when plugins are
" loaded during initialization.
if has('syntax') && has('eval')
packadd! matchit
endif
"NON-DEFAULT SETTINGS
syntax on
filetype plugin indent on
set nocompatible
set noerrorbells
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
set nu
set nowrap
set smartcase
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch
set backspace=2
set colorcolumn=80
"set foldmethod=indent
autocmd FileType vim setlocal foldmethod=marker
highlight ColorColumn ctermbg=0 guibg=lightgrey
"Leader key
let mapleader = ","
"Netrw - File explorer settings.
nmap <F2> :Vex<CR>
let g:netrw_liststyle = 3 " tree style browsing.
let g:netrw_browse_split=4 " Open in Previous window
let g:netrw_banner = 0 "Hide the banner
let g:netrw_winsize = 25 " Set the size
"wildmenu stuff.
set wildmenu
set wildmode=longest:list,longest
"Git: ft-gitcommit-plugin
"packadd ft-gitcommit-plugin
let g:ft_man_open_mode = 'tab' "Open in new tab.
let g:ft_man_folding_enable = 1 "Man page folding.
"RUST STUFF
" Built in rust stuff.
let g:rustc_path = $HOME."/.cargo/bin/rustc"
let g:rust_recommended_style = 1
let g:rust_fold = 1
" Rust fmt stuff
let g:rustfmt_command = 'rustfmt'
let g:rustfmt_autosave = 1
let g:rustfmt_emit_files = 1
let g:rustfmt_fail_silently = 0
call plug#begin('~/.vim/plugged')
"THEMES
Plug 'vim/colorschemes'
Plug 'kadekillary/skull-vim'
Plug 'morhetz/gruvbox'
Plug 'ghifarit53/tokyonight-vim'
Plug 'tomasr/molokai'
Plug 'ayu-theme/ayu-vim'
Plug 'srcery-colors/srcery-vim'
Plug 'altercation/vim-colors-solarized'
Plug 'catppuccin/vim', { 'as': 'catppuccin' }
"Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
"EDITING features
"Plug 'lyuts/vim-rtags'
"Plug 'junegunn/fzf'
"Plug 'https://github.com/ctrlpvim/ctrlp.vim.git'
"Plug 'godlygeek/tabular'
"Plug 'jremmen/vim-ripgrep'
"Plug 'tpope/vim-surround'
"Plug 'mbbill/undotree'
Plug 'vimwiki/vimwiki'
Plug 'majutsushi/tagbar'
"Code Completion
Plug 'yegappan/lsp'
"Plug 'prabirshrestha/vim-lsp'
"Plug 'mattn/vim-lsp-settings'
"File manager stuff.
"Plug 'https://github.com/tpope/vim-vinegar'
"Plug 'tpope/vim-fugitive'
"Plug 'scrooloose/nerdtree'
"Language Specific
Plug 'vim-utils/vim-man'
"Plug 'rust-lang/rust.vim'
"Plug 'StanAngeloff/php.vim'
Plug 'mattn/emmet-vim'
"Plug 'vim-ruby/vim-ruby'
"Plug 'mxw/vim-prolog'
"Plug 'dart-lang/dart-vim-plugin'
"Plug 'https://github.com/Raku/vim-raku'
Plug 'lervag/vimtex'
"KEYBOAD SPECIFIC (For my ergodox EZ layout.)
"Plug 'jooize/vim-colemak'
" Initialize plugin system
call plug#end()
"###########################
"# LSP: Language server protocol config
"############################
let lspServers = [
\ #{
\ name: 'clangd',
\ filetype: ['c', 'cpp'],
\ path: '/usr/local/bin/clangd15',
\ args: ['--background-index']
\ },
\ #{
\ name: 'rustlang',
\ filetype: ['rust'],
\ path: 'rust-analyzer',
\ args: [],
\ syncInit: v:true
\ },
\ #{
\ filetype: ['python'],
\ path: '/usr/local/bin/pylsp',
\ args: [],
\ },
\ #{
\ filetype: ['tex', 'latex'],
\ path: '/usr/local/bin/texlab',
\ args: [],
\ }
\ ]
autocmd VimEnter * call LspAddServer(lspServers)
let lspOpts = {'autoHighlightDiags': v:true, 'noNewlineInCompletion': v:true}
autocmd VimEnter * call LspOptionsSet(lspOpts)
"LSP shortcuts.
"nmap <Leader>d LspDiagCurrent<Esc>
nmap <leader>lc <ESC> :LspDiagCurrent<CR>
nmap <leader>ln <ESC> :LspDiagNext<CR>
nmap <leader>ls <ESC> :LspDiagShow<CR>
nmap <leader>le <ESC> :LspDiagHighlightEnable<CR>
nmap <leader>ld <ESC> :LspDiagHighlightDisable<CR>
nmap <leader>la <ESC> :LspCodeAction<CR>
"TagBar Settings
nmap <F6> :TagbarToggle<CR>
"###########################
" THEME: Config for themes.
"###########################
set termguicolors
"Settings for Gruvbox aka nier scheme.
"let g:gruvbox_contrast_light='soft'
"let g:gruvbox_contrast_dark='soft'
"let g:gruvbox_transparent_bg=1
"let g:gruvbox_enable_italic = 1
"colorscheme gruvbox
"Settings for Tokyonight scheme aka blade runner?
"let g:tokyonight_style = 'night'
"let g:tokyonight_enable_italic = 1
"colorscheme tokyonight
"Settings for Molokai theme
"colorscheme molokai
"let g:molokai_original = 1
"let g:rehash256 = 1
"Settings for Ayu theme
"set termguicolors
"let ayucolor="light"
"let ayucolor="mirage"
"let ayucolor="dark"
"colorscheme ayu
"Settings for Srcery theme
"colorscheme srcery
"None right now.
"Settings for cattiputin
colorscheme catppuccin_mocha
let g:lightline = {'colorscheme': 'catppuccin_mocha'}
let g:airline_theme = 'catppuccin_mocha'
"set background=dark
"set background=light
"colorscheme sorbet
"###########################
" SPLITS AND TABS
"###########################
set splitbelow
set splitright
" ----------------------
"Remap to the movement keys
noremap <C-W><Up> <C-W><K>
noremap <C-W><Down> <C-W><J>
noremap <C-W><Left> <C-W><L>
noremap <C-W><Right> <C-W><H>
"###########################
" VIMWIKI: Config
"###########################
"MD feels strange and isn't as supported as wiki syntax.
let wiki = { }
"let g:vimwiki_list =[{ 'syntax': 'markdown', 'ext': '.md'}]
let wiki.nested_syntaxes = {'python': 'python', 'c++': 'cpp'}
"###########################
" KEYBOAD: Config
"###########################
" COLMAK-DH mappings
" 164720
"up
"nnoremap n h
"down
"nnoremap e j
"left
"nnoremap i k
"right
"nnoremap o l
"insert
"nnoremap m i
"Forward word
"nnoremap t w
"Back word
"nnoremap s b
"nnoremap S B
" The keys I just mapped need to have their overwritten key mapped.
" keys: m, n, e, i, o, s, t,
"Forward word end
"nnoremap r e
"Backward word end
"nnoremap g a
"Append
"nnoremap a g
" My COLMAK-DH ReMAP
"For normal visual select and Operator-pending
"noremap f e
"noremap p r
"noremap b t
"noremap r s
"noremap s d
"noremap t f
"noremap d v
"noremap v b
"noremap j y
"noremap l u
"noremap u i
"noremap y o
"noremap ; p
"noremap m h
"noremap n j
"noremap e k
"noremap i l
"noremap o ;
"noremap k n
"noremap h m
"this is a test...
"Now for the caps
"noremap F E
"noremap P R
"noremap B T
"noremap R S
"noremap S D
"noremap T F
"noremap D V
"noremap V B
"noremap J Y
"noremap L U
"noremap U I
"noremap Y O
"noremap : P
"noremap M H
"noremap N J
"noremap E K
"noremap I L
"noremap O :
"noremap K N
"noremap H M