vim: Split vimrc into vimrc.d/
This commit is contained in:
@@ -1,283 +0,0 @@
|
||||
" Set leader key
|
||||
let mapleader = "\<Space>"
|
||||
let maplocalleader = mapleader
|
||||
|
||||
" Plugins ######################################################################
|
||||
" ARM assembly syntax highlighting
|
||||
autocmd BufNewFile,BufRead *.s,*.S packadd! arm-syntax-vim | set filetype=arm
|
||||
" Auto completion
|
||||
" needs vim >= 8.1.1719 to support features like popup and text property.
|
||||
if (has('patch-8.1.1719') || has('nvim'))
|
||||
let g:coc_global_extensions =
|
||||
\ ['coc-clangd', 'coc-sh', 'coc-python', 'coc-vimtex']
|
||||
packadd! coc.nvim
|
||||
source $XDG_CONFIG_HOME/vim/coc.nvim.vim
|
||||
endif
|
||||
" Automatically close parentheses, brackets, quotes, etc.
|
||||
packadd! delimitMate
|
||||
" Fuzzy finder
|
||||
packadd! fzf
|
||||
packadd! fzf.vim
|
||||
nmap <leader>f :Files<CR>
|
||||
" Theme
|
||||
packadd! onedark.vim
|
||||
" LaTeX
|
||||
autocmd BufNewFile,BufRead *.tex packadd! vimtex
|
||||
\ | source $XDG_CONFIG_HOME/vim/vimtex.vim
|
||||
" Git information
|
||||
packadd! vim-gitgutter
|
||||
" ctags
|
||||
packadd! vim-gutentags
|
||||
nmap <leader>t :Tags<CR>
|
||||
" Surround text with parentheses, brackets, quotes, tags, etc.
|
||||
let g:surround_no_mappings = 1
|
||||
packadd! vim-surround
|
||||
source $XDG_CONFIG_HOME/vim/vim-surround.vim
|
||||
|
||||
" Settings #####################################################################
|
||||
" hybrid linenumbers
|
||||
set number relativenumber
|
||||
" no timeout when exiting insert-mode
|
||||
" (see https://www.johnhawthorn.com/2012/09/vi-escape-delays/)
|
||||
set timeoutlen=1000 ttimeoutlen=0
|
||||
" smart case insensitive search (insens: /copy /Copy\c; sens: /Copy /copy\C)
|
||||
set ignorecase smartcase
|
||||
" Tab size
|
||||
set tabstop=4
|
||||
" Shift the same amount as tabstop
|
||||
set shiftwidth=0
|
||||
" Highlight current line
|
||||
set cursorline
|
||||
" Auto-wrap text and comments; automatically add comment leader when creating
|
||||
" new lines and delete it when joining; do not break already too long lines;
|
||||
" allow formatting with gq.
|
||||
set formatoptions=tcroqlj
|
||||
" Autoindent new lines
|
||||
set autoindent
|
||||
" Copy structure of the existing lines indent when autoindenting a new line
|
||||
set copyindent
|
||||
" Keep lines under 80 characters.
|
||||
set textwidth=80
|
||||
" Do not insert two spaces before a new sentence when formatting
|
||||
set nojoinspaces
|
||||
" see :help persistent-undo
|
||||
set undofile
|
||||
" Update every 300ms for better experience with plugins like gitgutter and coc
|
||||
set updatetime=300
|
||||
" Check for spelling in comments and strings
|
||||
set spell spelllang=en
|
||||
" Show the effect of a command while typing (substitute)
|
||||
if (has('nvim'))
|
||||
set inccommand=nosplit
|
||||
endif
|
||||
" Put new window below/right of current
|
||||
set splitbelow splitright
|
||||
" What is ce there for? cw should include whitespace like dw.
|
||||
if (has('nvim'))
|
||||
set cpoptions-=_
|
||||
else
|
||||
nmap cw dwi
|
||||
nmap cW dWi
|
||||
endif
|
||||
" Show ruler at 80 columns
|
||||
set colorcolumn=80
|
||||
" Show menu for possible matches when using command-line completing.
|
||||
if (has('wildmenu'))
|
||||
set wildmenu
|
||||
endif
|
||||
" Command-line completion tab behavior:
|
||||
" First: Complete longest common string and show wildmenu
|
||||
" Second: Complete each full match (Cycle through the menu)
|
||||
set wildmode=longest:full,full
|
||||
" Show typed (partial) command on screen.
|
||||
if (has('cmdline_info'))
|
||||
set showcmd
|
||||
endif
|
||||
" Show whitespace characters
|
||||
set list
|
||||
set listchars=tab:>·
|
||||
" Keep current line away from top/bottom borders of the buffer when scrolling
|
||||
set scrolloff=15
|
||||
" Enable mouse in normal and visual mode
|
||||
set mouse=nv
|
||||
|
||||
" Keybindings ##################################################################
|
||||
" Stop highlighting search result when pressing Return
|
||||
nnoremap <silent> <CR> :nohlsearch<CR><CR>
|
||||
|
||||
" Indentation jump
|
||||
" https://vim.fandom.com/wiki/Move_to_next/previous_line_with_same_indentation
|
||||
noremap <silent> <C-k> :call search('^'. matchstr(getline('.'), '\(^\s*\)') .'\%<' . line('.') . 'l\S', 'be')<CR>
|
||||
noremap <silent> <C-j> :call search('^'. matchstr(getline('.'), '\(^\s*\)') .'\%>' . line('.') . 'l\S', 'e')<CR>
|
||||
|
||||
" Split view navigation
|
||||
" Create new panes
|
||||
nnoremap <C-w>N :vsplit<CR>
|
||||
nnoremap <C-w>n :split<CR>
|
||||
" Move between panes
|
||||
nnoremap <C-h> <C-w><C-h>
|
||||
nnoremap <C-j> <C-w><C-j>
|
||||
nnoremap <C-k> <C-w><C-k>
|
||||
nnoremap <C-l> <C-w><C-l>
|
||||
|
||||
" Substitute command
|
||||
if (exists('+inccommand') && &inccommand != '')
|
||||
nnoremap S :%s/
|
||||
vnoremap S :s/
|
||||
else
|
||||
" This does not work with live previewing commands (inccommand) since the
|
||||
" replace pattern is already defined and thus everything matching the search
|
||||
" pattern is just deleted.
|
||||
nnoremap S :%s//gc<Left><Left><Left>
|
||||
vnoremap S :s//gc<Left><Left><Left>
|
||||
endif
|
||||
|
||||
" Interact with the system clipboard
|
||||
if (has('clipboard') || has('nvim'))
|
||||
noremap <leader>y "+y
|
||||
noremap <leader>d "+d
|
||||
noremap <leader>p "+p
|
||||
noremap <leader>P "+P
|
||||
endif
|
||||
|
||||
" Ctrl-Backspace should delete words in insert mode and on command-line.
|
||||
noremap! <C-H> <C-W>
|
||||
|
||||
" Correct word with best/first suggestion.
|
||||
noremap <leader>c 1z=
|
||||
|
||||
" Toggle spell, cycle and set spelllang
|
||||
map <leader>st :set spell=!&spell<CR>
|
||||
map <leader>sc :call CycleSpellLang()<CR>
|
||||
map <leader>ss :set spelllang=
|
||||
" Umlaute and sz in Insert and Command-line mode when spelllang is set to de
|
||||
autocmd OptionSet spelllang call NewSpellLang(v:option_new, v:option_old)
|
||||
function! NewSpellLang(new_lang, old_lang)
|
||||
let mappings = {
|
||||
\ 'ae': 'ä',
|
||||
\ 'Ae': 'Ä',
|
||||
\ 'oe': 'ö',
|
||||
\ 'Oe': 'Ö',
|
||||
\ 'ue': 'ü',
|
||||
\ 'Ue': 'Ü',
|
||||
\ 'sz': 'ß',
|
||||
\ }
|
||||
if (a:new_lang == 'de')
|
||||
for [key, value] in items(mappings)
|
||||
execute 'map! <buffer>' key value
|
||||
endfor
|
||||
elseif (a:old_lang == 'de')
|
||||
for key in keys(mappings)
|
||||
execute 'unmap! <buffer>' key
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Jump through jump table but center
|
||||
noremap <Tab> <Tab>zz
|
||||
noremap <C-O> <C-O>zz
|
||||
nmap <S-Tab> <C-O>
|
||||
|
||||
" Terminal
|
||||
if (has('nvim'))
|
||||
" tnoremap <Esc> <C-\><C-n>
|
||||
nmap <leader><CR> :split +terminal<CR>i
|
||||
nmap <leader>v<CR> :vsplit +terminal<CR>i
|
||||
elseif (has('terminal'))
|
||||
nmap <leader><CR> :terminal<CR>
|
||||
endif
|
||||
|
||||
" Aesthetics ###################################################################
|
||||
" Use 24-bit (true-color) mode
|
||||
if (has('termguicolors'))
|
||||
set termguicolors
|
||||
" https://github.com/vim/vim/issues/993
|
||||
if (&term != 'xterm-256color')
|
||||
" set Vim-specific sequences for RGB colors
|
||||
let &t_8f = "\e[38;2;%lu;%lu;%lum"
|
||||
let &t_8b = "\e[48;2;%lu;%lu;%lum"
|
||||
endif
|
||||
endif
|
||||
" use onedark as theme for syntax highlighting
|
||||
syntax on
|
||||
colorscheme onedark
|
||||
|
||||
" get transparent background of the terminal back
|
||||
" (at least in nvim, i can't get it to work in vanilla)
|
||||
if (has('nvim'))
|
||||
highlight Normal guibg=NONE
|
||||
highlight NonText guibg=NONE
|
||||
endif
|
||||
|
||||
" Commands #####################################################################
|
||||
command! DiffOrig vert new | set buftype=nofile | read ++edit # | 0d_ | diffthis
|
||||
\ | wincmd p | diffthis
|
||||
|
||||
" Functions ####################################################################
|
||||
" Toggle spell language between German and English
|
||||
function! CycleSpellLang()
|
||||
if (&spelllang == 'en')
|
||||
set spelllang=de
|
||||
else
|
||||
set spelllang=en
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Autocommands #################################################################
|
||||
" Highlight trailing whitespaces
|
||||
" (https://vim.fandom.com/wiki/Highlight_unwanted_spaces)
|
||||
" Create highlight group
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
" Associate with patter (trailing whitespaces)
|
||||
match ExtraWhitespace /\s\+$/
|
||||
" apply not only to the first window
|
||||
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
|
||||
" Do not match when typing at the end of a line
|
||||
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
|
||||
" Reset when leaving insert mode
|
||||
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
|
||||
" Clear all matches
|
||||
autocmd BufWinLeave * call clearmatches()
|
||||
|
||||
" Terminal
|
||||
if (has('nvim'))
|
||||
" Disable spellcheck
|
||||
autocmd TermOpen * setlocal nospell
|
||||
endif
|
||||
|
||||
" change cursor shape depending on mode
|
||||
if (has('nvim'))
|
||||
" Beam when exiting
|
||||
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
||||
else
|
||||
" https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes
|
||||
" https://github.com/tmux/tmux/issues/1593
|
||||
if exists('$TMUX')
|
||||
" Start insert mode - vertical bar/beam
|
||||
let &t_SI = "\ePtmux;\e\e[5 q\e\\"
|
||||
" Start replace mode - horizontal bar/underline
|
||||
let &t_SR = "\ePtmux;\e\e[3 q\e\\"
|
||||
" End insert or replace mode - block
|
||||
let &t_EI = "\ePtmux;\e\e[1 q\e\\"
|
||||
|
||||
" Block when entering
|
||||
autocmd VimEnter * silent !echo -ne "\ePtmux;\e\e[1 q\e\\"
|
||||
" Beam when exiting
|
||||
autocmd VimLeave * silent !echo -ne "\ePtmux;\e\e[5 q\e\\"
|
||||
else
|
||||
" Start insert mode - vertical bar/beam
|
||||
let &t_SI = "\e[5 q"
|
||||
" Start replace mode - horizontal bar/underline
|
||||
let &t_SR = "\e[3 q"
|
||||
" End insert or replace mode - block
|
||||
let &t_EI = "\e[1 q"
|
||||
|
||||
" Block when entering
|
||||
autocmd VimEnter * silent !echo -ne "\e[1 q"
|
||||
" Beam when exiting
|
||||
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
||||
endif
|
||||
endif
|
||||
|
||||
" Load filetype plugins
|
||||
filetype plugin indent on
|
||||
3
.config/vim/vimrc.d/10-leaderkey.vim
Normal file
3
.config/vim/vimrc.d/10-leaderkey.vim
Normal file
@@ -0,0 +1,3 @@
|
||||
" Set leader key
|
||||
let mapleader = "\<Space>"
|
||||
let maplocalleader = mapleader
|
||||
34
.config/vim/vimrc.d/20-plugins.vim
Normal file
34
.config/vim/vimrc.d/20-plugins.vim
Normal file
@@ -0,0 +1,34 @@
|
||||
" Plugins ######################################################################
|
||||
" ARM assembly syntax highlighting
|
||||
autocmd BufNewFile,BufRead *.s,*.S packadd! arm-syntax-vim | set filetype=arm
|
||||
" Auto completion
|
||||
" needs vim >= 8.1.1719 to support features like popup and text property.
|
||||
if (has('patch-8.1.1719') || has('nvim'))
|
||||
let g:coc_global_extensions =
|
||||
\ ['coc-clangd', 'coc-sh', 'coc-python', 'coc-vimtex']
|
||||
packadd! coc.nvim
|
||||
source $XDG_CONFIG_HOME/vim/coc.nvim.vim
|
||||
endif
|
||||
" Automatically close parentheses, brackets, quotes, etc.
|
||||
packadd! delimitMate
|
||||
" Fuzzy finder
|
||||
packadd! fzf
|
||||
packadd! fzf.vim
|
||||
nmap <leader>f :Files<CR>
|
||||
" Theme
|
||||
packadd! onedark.vim
|
||||
" LaTeX
|
||||
autocmd BufNewFile,BufRead *.tex packadd! vimtex
|
||||
\ | source $XDG_CONFIG_HOME/vim/vimtex.vim
|
||||
" Git information
|
||||
packadd! vim-gitgutter
|
||||
" ctags
|
||||
packadd! vim-gutentags
|
||||
nmap <leader>t :Tags<CR>
|
||||
" Surround text with parentheses, brackets, quotes, tags, etc.
|
||||
let g:surround_no_mappings = 1
|
||||
packadd! vim-surround
|
||||
source $XDG_CONFIG_HOME/vim/vim-surround.vim
|
||||
|
||||
" Load filetype plugins
|
||||
filetype plugin indent on
|
||||
66
.config/vim/vimrc.d/30-settings.vim
Normal file
66
.config/vim/vimrc.d/30-settings.vim
Normal file
@@ -0,0 +1,66 @@
|
||||
" Settings #####################################################################
|
||||
" hybrid linenumbers
|
||||
set number relativenumber
|
||||
" no timeout when exiting insert-mode
|
||||
" (see https://www.johnhawthorn.com/2012/09/vi-escape-delays/)
|
||||
set timeoutlen=1000 ttimeoutlen=0
|
||||
" smart case insensitive search (insens: /copy /Copy\c; sens: /Copy /copy\C)
|
||||
set ignorecase smartcase
|
||||
" Tab size
|
||||
set tabstop=4
|
||||
" Shift the same amount as tabstop
|
||||
set shiftwidth=0
|
||||
" Highlight current line
|
||||
set cursorline
|
||||
" Auto-wrap text and comments; automatically add comment leader when creating
|
||||
" new lines and delete it when joining; do not break already too long lines;
|
||||
" allow formatting with gq.
|
||||
set formatoptions=tcroqlj
|
||||
" Autoindent new lines
|
||||
set autoindent
|
||||
" Copy structure of the existing lines indent when autoindenting a new line
|
||||
set copyindent
|
||||
" Keep lines under 80 characters.
|
||||
set textwidth=80
|
||||
" Do not insert two spaces before a new sentence when formatting
|
||||
set nojoinspaces
|
||||
" see :help persistent-undo
|
||||
set undofile
|
||||
" Update every 300ms for better experience with plugins like gitgutter and coc
|
||||
set updatetime=300
|
||||
" Check for spelling in comments and strings
|
||||
set spell spelllang=en
|
||||
" Show the effect of a command while typing (substitute)
|
||||
if (has('nvim'))
|
||||
set inccommand=nosplit
|
||||
endif
|
||||
" Put new window below/right of current
|
||||
set splitbelow splitright
|
||||
" What is ce there for? cw should include whitespace like dw.
|
||||
if (has('nvim'))
|
||||
set cpoptions-=_
|
||||
else
|
||||
nmap cw dwi
|
||||
nmap cW dWi
|
||||
endif
|
||||
" Show ruler at 80 columns
|
||||
set colorcolumn=80
|
||||
" Show menu for possible matches when using command-line completing.
|
||||
if (has('wildmenu'))
|
||||
set wildmenu
|
||||
endif
|
||||
" Command-line completion tab behavior:
|
||||
" First: Complete longest common string and show wildmenu
|
||||
" Second: Complete each full match (Cycle through the menu)
|
||||
set wildmode=longest:full,full
|
||||
" Show typed (partial) command on screen.
|
||||
if (has('cmdline_info'))
|
||||
set showcmd
|
||||
endif
|
||||
" Show whitespace characters
|
||||
set list
|
||||
set listchars=tab:>·
|
||||
" Keep current line away from top/bottom borders of the buffer when scrolling
|
||||
set scrolloff=15
|
||||
" Enable mouse in normal and visual mode
|
||||
set mouse=nv
|
||||
85
.config/vim/vimrc.d/40-keybindings.vim
Normal file
85
.config/vim/vimrc.d/40-keybindings.vim
Normal file
@@ -0,0 +1,85 @@
|
||||
" Keybindings ##################################################################
|
||||
" Stop highlighting search result when pressing Return
|
||||
nnoremap <silent> <CR> :nohlsearch<CR><CR>
|
||||
|
||||
" Indentation jump
|
||||
" https://vim.fandom.com/wiki/Move_to_next/previous_line_with_same_indentation
|
||||
noremap <silent> <C-k> :call search('^'. matchstr(getline('.'), '\(^\s*\)') .'\%<' . line('.') . 'l\S', 'be')<CR>
|
||||
noremap <silent> <C-j> :call search('^'. matchstr(getline('.'), '\(^\s*\)') .'\%>' . line('.') . 'l\S', 'e')<CR>
|
||||
|
||||
" Split view navigation
|
||||
" Create new panes
|
||||
nnoremap <C-w>N :vsplit<CR>
|
||||
nnoremap <C-w>n :split<CR>
|
||||
" Move between panes
|
||||
nnoremap <C-h> <C-w><C-h>
|
||||
nnoremap <C-j> <C-w><C-j>
|
||||
nnoremap <C-k> <C-w><C-k>
|
||||
nnoremap <C-l> <C-w><C-l>
|
||||
|
||||
" Substitute command
|
||||
if (exists('+inccommand') && &inccommand != '')
|
||||
nnoremap S :%s/
|
||||
vnoremap S :s/
|
||||
else
|
||||
" This does not work with live previewing commands (inccommand) since the
|
||||
" replace pattern is already defined and thus everything matching the search
|
||||
" pattern is just deleted.
|
||||
nnoremap S :%s//gc<Left><Left><Left>
|
||||
vnoremap S :s//gc<Left><Left><Left>
|
||||
endif
|
||||
|
||||
" Interact with the system clipboard
|
||||
if (has('clipboard') || has('nvim'))
|
||||
noremap <leader>y "+y
|
||||
noremap <leader>d "+d
|
||||
noremap <leader>p "+p
|
||||
noremap <leader>P "+P
|
||||
endif
|
||||
|
||||
" Ctrl-Backspace should delete words in insert mode and on command-line.
|
||||
noremap! <C-H> <C-W>
|
||||
|
||||
" Correct word with best/first suggestion.
|
||||
noremap <leader>c 1z=
|
||||
|
||||
" Toggle spell, cycle and set spelllang
|
||||
map <leader>st :set spell=!&spell<CR>
|
||||
map <leader>sc :call CycleSpellLang()<CR>
|
||||
map <leader>ss :set spelllang=
|
||||
" Umlaute and sz in Insert and Command-line mode when spelllang is set to de
|
||||
autocmd OptionSet spelllang call NewSpellLang(v:option_new, v:option_old)
|
||||
function! NewSpellLang(new_lang, old_lang)
|
||||
let mappings = {
|
||||
\ 'ae': 'ä',
|
||||
\ 'Ae': 'Ä',
|
||||
\ 'oe': 'ö',
|
||||
\ 'Oe': 'Ö',
|
||||
\ 'ue': 'ü',
|
||||
\ 'Ue': 'Ü',
|
||||
\ 'sz': 'ß',
|
||||
\ }
|
||||
if (a:new_lang == 'de')
|
||||
for [key, value] in items(mappings)
|
||||
execute 'map! <buffer>' key value
|
||||
endfor
|
||||
elseif (a:old_lang == 'de')
|
||||
for key in keys(mappings)
|
||||
execute 'unmap! <buffer>' key
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Jump through jump table but center
|
||||
noremap <Tab> <Tab>zz
|
||||
noremap <C-O> <C-O>zz
|
||||
nmap <S-Tab> <C-O>
|
||||
|
||||
" Terminal
|
||||
if (has('nvim'))
|
||||
" tnoremap <Esc> <C-\><C-n>
|
||||
nmap <leader><CR> :split +terminal<CR>i
|
||||
nmap <leader>v<CR> :vsplit +terminal<CR>i
|
||||
elseif (has('terminal'))
|
||||
nmap <leader><CR> :terminal<CR>
|
||||
endif
|
||||
21
.config/vim/vimrc.d/50-aesthetics.vim
Normal file
21
.config/vim/vimrc.d/50-aesthetics.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
" Aesthetics ###################################################################
|
||||
" Use 24-bit (true-color) mode
|
||||
if (has('termguicolors'))
|
||||
set termguicolors
|
||||
" https://github.com/vim/vim/issues/993
|
||||
if (&term != 'xterm-256color')
|
||||
" set Vim-specific sequences for RGB colors
|
||||
let &t_8f = "\e[38;2;%lu;%lu;%lum"
|
||||
let &t_8b = "\e[48;2;%lu;%lu;%lum"
|
||||
endif
|
||||
endif
|
||||
" use onedark as theme for syntax highlighting
|
||||
syntax on
|
||||
colorscheme onedark
|
||||
|
||||
" get transparent background of the terminal back
|
||||
" (at least in nvim, i can't get it to work in vanilla)
|
||||
if (has('nvim'))
|
||||
highlight Normal guibg=NONE
|
||||
highlight NonText guibg=NONE
|
||||
endif
|
||||
3
.config/vim/vimrc.d/60-commands.vim
Normal file
3
.config/vim/vimrc.d/60-commands.vim
Normal file
@@ -0,0 +1,3 @@
|
||||
" Commands #####################################################################
|
||||
command! DiffOrig vert new | set buftype=nofile | read ++edit # | 0d_ | diffthis
|
||||
\ | wincmd p | diffthis
|
||||
9
.config/vim/vimrc.d/70-functions.vim
Normal file
9
.config/vim/vimrc.d/70-functions.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Functions ####################################################################
|
||||
" Toggle spell language between German and English
|
||||
function! CycleSpellLang()
|
||||
if (&spelllang == 'en')
|
||||
set spelllang=de
|
||||
else
|
||||
set spelllang=en
|
||||
endif
|
||||
endfunction
|
||||
55
.config/vim/vimrc.d/80-autocommands.vim
Normal file
55
.config/vim/vimrc.d/80-autocommands.vim
Normal file
@@ -0,0 +1,55 @@
|
||||
" Autocommands #################################################################
|
||||
" Highlight trailing whitespaces
|
||||
" (https://vim.fandom.com/wiki/Highlight_unwanted_spaces)
|
||||
" Create highlight group
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
" Associate with patter (trailing whitespaces)
|
||||
match ExtraWhitespace /\s\+$/
|
||||
" apply not only to the first window
|
||||
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
|
||||
" Do not match when typing at the end of a line
|
||||
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
|
||||
" Reset when leaving insert mode
|
||||
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
|
||||
" Clear all matches
|
||||
autocmd BufWinLeave * call clearmatches()
|
||||
|
||||
" Terminal
|
||||
if (has('nvim'))
|
||||
" Disable spellcheck
|
||||
autocmd TermOpen * setlocal nospell
|
||||
endif
|
||||
|
||||
" change cursor shape depending on mode
|
||||
if (has('nvim'))
|
||||
" Beam when exiting
|
||||
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
||||
else
|
||||
" https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes
|
||||
" https://github.com/tmux/tmux/issues/1593
|
||||
if exists('$TMUX')
|
||||
" Start insert mode - vertical bar/beam
|
||||
let &t_SI = "\ePtmux;\e\e[5 q\e\\"
|
||||
" Start replace mode - horizontal bar/underline
|
||||
let &t_SR = "\ePtmux;\e\e[3 q\e\\"
|
||||
" End insert or replace mode - block
|
||||
let &t_EI = "\ePtmux;\e\e[1 q\e\\"
|
||||
|
||||
" Block when entering
|
||||
autocmd VimEnter * silent !echo -ne "\ePtmux;\e\e[1 q\e\\"
|
||||
" Beam when exiting
|
||||
autocmd VimLeave * silent !echo -ne "\ePtmux;\e\e[5 q\e\\"
|
||||
else
|
||||
" Start insert mode - vertical bar/beam
|
||||
let &t_SI = "\e[5 q"
|
||||
" Start replace mode - horizontal bar/underline
|
||||
let &t_SR = "\e[3 q"
|
||||
" End insert or replace mode - block
|
||||
let &t_EI = "\e[1 q"
|
||||
|
||||
" Block when entering
|
||||
autocmd VimEnter * silent !echo -ne "\e[1 q"
|
||||
" Beam when exiting
|
||||
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
||||
endif
|
||||
endif
|
||||
@@ -44,4 +44,7 @@ set runtimepath-=~/.vim runtimepath^=$XDG_CONFIG_HOME/vim
|
||||
set runtimepath-=~/.vim/after runtimepath+=$XDG_CONFIG_HOME/vim/after
|
||||
set packpath-=~/.vim packpath^=$XDG_CONFIG_HOME/vim
|
||||
|
||||
source $XDG_CONFIG_HOME/vim/vimrc
|
||||
" Source everything in vimrc.d/
|
||||
for file in split(glob($XDG_CONFIG_HOME . '/vim/vimrc.d/**/*.vim'), '\n')
|
||||
execute 'source' file
|
||||
endfor
|
||||
|
||||
Reference in New Issue
Block a user