fix(config): vim config

Signed-off-by: Ismo Vuorinen <ismo@ivuorinen.net>
This commit is contained in:
2025-02-28 17:08:06 +02:00
parent d6b24c27a1
commit 333995c7f4
2 changed files with 63 additions and 186 deletions

3
.gitignore vendored
View File

@@ -24,6 +24,8 @@ config/nvim/spell/*
!config/nvim/spell/.gitkeep
config/git/local.d/*
!config/git/local.d/.gitkeep
config/vim/fzf
config/vim/plugged/*
config/zed/*
!config/zed/settings.json
config/zsh/.zcompdump
@@ -39,3 +41,4 @@ config/fish/fish_variables
**/exports-secret.fish
config/fish/completions/asdf.fish
config/vim/.netrwhist
*.swp

View File

@@ -1,12 +1,6 @@
" vim-bootstrap 2024-04-26 07:50:42
" https://tlvince.com/vim-respect-xdg
set directory=$XDG_CACHE_HOME/vim,~/,/tmp
set backupdir=$XDG_CACHE_HOME/vim,~/,/tmp
set viminfo+=n$XDG_CACHE_HOME/vim/viminfo
set runtimepath=$XDG_CONFIG_HOME/vim,$XDG_CONFIG_HOME/vim/after,$VIM,$VIMRUNTIME
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
" This is my vimrc
"
"
"*****************************************************************************
"" Vim-Plug core
"*****************************************************************************
@@ -19,7 +13,7 @@ endif
let g:vim_bootstrap_langs = "go,html,javascript,lua,php,python,typescript"
let g:vim_bootstrap_editor = "vim" " nvim or vim
let g:vim_bootstrap_theme = "material"
let g:vim_bootstrap_theme = "minimalist"
let g:vim_bootstrap_frams = "vuejs"
if !filereadable(vimplug_exists)
@@ -38,15 +32,10 @@ endif
" Required:
call plug#begin(expand('$HOME/.config/vim/plugged'))
"*****************************************************************************
"" Plug install packages
"*****************************************************************************
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'vim-scripts/grep.vim'
Plug 'vim-scripts/CSApprox'
@@ -56,13 +45,13 @@ Plug 'dense-analysis/ale'
Plug 'Yggdroot/indentLine'
Plug 'editor-bootstrap/vim-bootstrap-updater'
Plug 'tpope/vim-rhubarb' " required by fugitive to :GBrowse
Plug 'kaicataldo/material.vim'
Plug 'dikiaap/minimalist'
Plug 'liuchengxu/vim-which-key'
if isdirectory('~/.local/bin/fzf')
if isdirectory('~/.config/vim/extra/fzf')
Plug '~/.local/bin/fzf' | Plug 'junegunn/fzf.vim'
else
Plug 'junegunn/fzf', { 'dir': '~/.local/bin/fzf', 'do': './install --bin' }
Plug 'junegunn/fzf', { 'dir': '~/.config/vim/fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
endif
let g:make = 'gmake'
@@ -75,19 +64,10 @@ Plug 'Shougo/vimproc.vim', {'do': g:make}
Plug 'xolox/vim-misc'
Plug 'xolox/vim-session'
"" Snippets
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
"*****************************************************************************
"" Custom bundles
"*****************************************************************************
" go
"" Go Lang Bundle
Plug 'fatih/vim-go', {'do': ':GoInstallBinaries'}
" html
"" HTML Bundle
Plug 'hail2u/vim-css3-syntax'
@@ -95,87 +75,80 @@ Plug 'gko/vim-coloresque'
Plug 'tpope/vim-haml'
Plug 'mattn/emmet-vim'
" javascript
"" Javascript Bundle
Plug 'jelera/vim-javascript-syntax'
" lua
"" Lua Bundle
Plug 'xolox/vim-lua-ftplugin'
Plug 'xolox/vim-lua-inspect'
" php
"" PHP Bundle
Plug 'phpactor/phpactor', {'for': 'php', 'do': 'composer install --no-dev -o'}
Plug 'stephpy/vim-php-cs-fixer'
" python
"" Python Bundle
Plug 'davidhalter/jedi-vim'
Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
" typescript
Plug 'leafgarland/typescript-vim'
Plug 'HerringtonDarkholme/yats.vim'
" vuejs
Plug 'posva/vim-vue'
Plug 'leafOfTree/vim-vue-plugin'
"*****************************************************************************
"*****************************************************************************
"" Include user's extra bundle
if filereadable(expand("~/.config/vim/vimrc.local.bundles"))
source ~/.config/vim/vimrc.local.bundles
endif
set nocompatible " disable compatibility mode with vi
filetype off " disable filetype detection (but re-enable later, see below)
set encoding=utf-8 " UTF-8
set number " Show line numbers
set relativenumber " Show relative line numbers
set laststatus=2 " Always show statusline (even with only single window)
set showmatch " Highlight matching brace
set visualbell " Use visual bell (no beeping)
set backspace=indent,eol,start " Backspace behaviour
set cindent " Use 'C' style program indenting
set cursorline " Highlight current line
set expandtab " Use spaces instead of tabs
set fileformats=unix,dos,mac
set ignorecase " Always case-insensitive
set incsearch " Searches for strings incrementally
set linespace=3
set modeline
set modelines=3
set mouse=a
set mousemodel=popup
set ruler " Show row and column ruler information
set scrolloff=5
set shiftwidth=4 " Number of auto-indent spaces
set smartcase " Enable smart-case search
set smartindent " Enable smart-indent
set smarttab " Enable smart-tabs
set softtabstop=4 " Number of spaces per Tab
set termguicolors
set undolevels=1000 " Number of undo levels
set wildmenu
call plug#end()
" Required:
filetype plugin indent on
"*****************************************************************************
"" Basic Setup
"*****************************************************************************"
"" Encoding
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8
set ttyfast
"" Fix backspace indent
set backspace=indent,eol,start
"" Tabs. May be overridden by autocmd rules
set tabstop=4
set softtabstop=0
set shiftwidth=4
set expandtab
"" Map leader to <space>
let mapleader=' '
"" Enable hidden buffers
set hidden
"" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
set fileformats=unix,dos,mac
if exists('$SHELL')
set shell=$SHELL
else
@@ -184,35 +157,20 @@ endif
" session management
let g:session_directory = "~/.local/state/vim/session"
let g:session_autoload = "no"
let g:session_autoload = "yes"
let g:session_autosave = "yes"
let g:session_command_aliases = 1
"*****************************************************************************
"" Visual Settings
"*****************************************************************************
syntax on
set ruler
set number
let no_buffers_menu=1
colorscheme material
" Better command line completion
set wildmenu
" mouse support
set mouse=a
set mousemodel=popup
set t_Co=256
set guioptions=egmrti
set gfn=Monospace\ 13
if has("gui_running")
if has("gui_mac") || has("gui_macvim")
set guifont=Menlo:h14
set macligatures
set guifont=JetBrains\ Mono:h14
set transparency=7
endif
else
@@ -224,7 +182,6 @@ else
let g:indentLine_char = '┆'
let g:indentLine_faster = 1
if $COLORTERM == 'gnome-terminal'
set term=gnome-256color
else
@@ -235,30 +192,15 @@ else
endif
if &term =~ '256color'
set t_ut=
endif
"" Disable the blinking cursor.
set gcr=a:blinkon0
set scrolloff=10
"" Status bar
set laststatus=2
"" Use modeline overrides
set modeline
set modelines=10
set title
set titleold="Terminal"
set titlestring=%F
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L)|
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
@@ -270,12 +212,13 @@ if exists("*fugitive#statusline")
endif
" vim-airline
let g:airline_theme = 'powerlineish'
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tagbar#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline_skip_empty_sections = 1
let g:airline_theme = 'minimalist'
"*****************************************************************************
"" Abbreviations
@@ -294,7 +237,7 @@ cnoreabbrev Qall qall
"" NERDTree configuration
let g:NERDTreeChDirMode=2
let g:NERDTreeIgnore=['node_modules','vendor','\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
let g:NERDTreeIgnore=['node_modules', 'vendor', '\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
let g:NERDTreeShowBookmarks=1
let g:nerdtree_tabs_focus_on_files=1
@@ -302,7 +245,7 @@ let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
let g:NERDTreeWinSize = 50
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite,*node_modules/,*vendor/
nnoremap <silent> <F2> :NERDTreeFind<CR>
nnoremap <silent> <F3> :NERDTreeToggle<CR>
nnoremap <silent> <leader>q :NERDTreeToggle<CR>
" grep.vim
nnoremap <silent> <leader>f :Rgrep<CR>
@@ -313,16 +256,21 @@ let Grep_Skip_Dirs = '.git node_modules vendor plugged'
" terminal emulation
nnoremap <silent> <leader>sh :terminal<CR>
" vim-which-key config
nnoremap <silent> <leader> :WhichKey '<Space>'<CR>
set timeoutlen=500 " By default timeoutlen=1000 (ms)
"*****************************************************************************
"" Commands
"*****************************************************************************
" remove trailing whitespaces
command! FixWhitespace :%s/\s\+$//e
"*****************************************************************************
"" Functions
"*****************************************************************************
if !exists('*s:setupWrapping')
function s:setupWrapping()
set wrap
@@ -334,6 +282,7 @@ endif
"*****************************************************************************
"" Autocmd Rules
"*****************************************************************************
"" The PC is fast enough, do syntax highlight syncing from start unless 200 lines
augroup vimrc-sync-fromstart
autocmd!
@@ -343,7 +292,7 @@ augroup END
"" Remember cursor position
augroup vimrc-remember-cursor-position
autocmd!
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
" autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
augroup END
"" txt
@@ -404,12 +353,6 @@ set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.pyc,__pycache__,vendor
let $FZF_DEFAULT_COMMAND = "find * -path '*/\.*' -prune -o -path 'node_modules/**' -prune -o -path 'target/**' -prune -o -path 'vendor/**' -prune -o -path 'dist/**' -prune -o -type f -print -o -type l -print 2> /dev/null"
" The Silver Searcher
if executable('ag')
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""'
set grepprg=ag\ --nogroup\ --nocolor
endif
" ripgrep
if executable('rg')
let $FZF_DEFAULT_COMMAND = 'rg --files --hidden --follow --glob "!.git/*"'
@@ -423,12 +366,6 @@ nnoremap <silent> <leader>e :FZF -m<CR>
"Recovery commands from history through FZF
nmap <leader>y :History:<CR>
" snippets
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
let g:UltiSnipsEditSplit="vertical"
" ale
let g:ale_linters = {}
@@ -455,6 +392,7 @@ if has('macunix')
" pbcopy for OSX copy/paste
vmap <C-x> :!pbcopy<CR>
vmap <C-c> :w !pbcopy<CR><CR>
vmap <C-v> :!pbpaste<CR>
endif
"" Buffer nav
@@ -554,15 +492,12 @@ augroup go
augroup END
" ale
:call extend(g:ale_linters, {
\"go": ['golint', 'go vet'], })
:call extend(g:ale_linters, {"go": [ 'golint', 'go vet' ]})
" html
" for html files, 2 spaces
autocmd Filetype html setlocal ts=2 sw=2 expandtab
" javascript
let g:javascript_enable_domhtmlcss = 1
@@ -572,10 +507,6 @@ augroup vimrc-javascript
autocmd FileType javascript setl tabstop=4|setl shiftwidth=4|setl expandtab softtabstop=4
augroup END
" lua
" php
" Phpactor plugin
" Include use statement
@@ -607,10 +538,7 @@ vmap <silent><Leader>em :<C-U>call phpactor#ExtractMethod()<CR>
" vim-python
augroup vimrc-python
autocmd!
autocmd FileType python setlocal expandtab
\ shiftwidth=4 tabstop=8 colorcolumn=79
\ formatoptions+=croq softtabstop=4
\ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 colorcolumn=79 formatoptions+=croq softtabstop=4 cinwords=if,elif,else,for,while,try,except,finally,def,class,with
augroup END
" jedi-vim
@@ -625,71 +553,17 @@ let g:jedi#completions_command = "<C-Space>"
let g:jedi#smart_auto_mappings = 0
" ale
:call extend(g:ale_linters, {
\'python': ['flake8'], })
" vim-airline
let g:airline#extensions#virtualenv#enabled = 1
:call extend(g:ale_linters, { 'python': [ 'flake8' ] })
" Syntax highlight
let python_highlight_all = 1
" typescript
let g:yats_host_keyword = 1
" vuejs
" vim vue
let g:vue_disable_pre_processors=1
" vim vue plugin
let g:vim_vue_plugin_load_full_syntax = 1
"*****************************************************************************
"*****************************************************************************
"" Include user's local vim config
if filereadable(expand("~/.config/vimrc.local"))
source ~/.config/vimrc.local
endif
"*****************************************************************************
"" Convenience variables
"*****************************************************************************
" vim-airline
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
if !exists('g:airline_powerline_fonts')
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline_left_sep = '▶'
let g:airline_left_alt_sep = '»'
let g:airline_right_sep = '◀'
let g:airline_right_alt_sep = '«'
let g:airline#extensions#branch#prefix = '⤴' "➔, ➥, ⎇
let g:airline#extensions#readonly#symbol = '⊘'
let g:airline#extensions#linecolumn#prefix = '¶'
let g:airline#extensions#paste#symbol = 'ρ'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
else
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
" powerline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
endif