nixos/vimrc

150 lines
4.1 KiB
VimL
Raw Normal View History

unlet! skip_defaults_vim
" source $VIMRUNTIME/defaults.vim
" fix for wsl starting with REPLACE mode
nnoremap <esc>^[ <esc>^[
" disable mouse so that clipboard works properly
2022-04-27 10:43:48 +01:00
set mouse=nv
set t_TI=""
set t_TE=""
set t_ut=""
2021-03-31 08:54:35 +01:00
set noswapfile
set updatetime=1000
set signcolumn=yes
2022-04-27 10:39:34 +01:00
set rtp+=~/.fzf
map ; :Files<CR>
2022-04-27 11:37:30 +01:00
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
colorscheme onehalfdark
2021-02-22 09:45:12 +00:00
if exists('+termguicolors') && ($COLORTERM == "24bit" || $COLORTERM == "truecolor")
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
let g:terminal_ansi_colors = [
\ '#282c34',
\ '#e06c75',
\ '#98c379',
\ '#e5c07b',
\ '#61afef',
\ '#c678dd',
\ '#56b6c2',
\ '#dcdfe4',
\ '#282c34',
\ '#e06c75',
\ '#98c379',
\ '#e5c07b',
\ '#61afef',
\ '#c678dd',
\ '#56b6c2',
\ '#dcdfe4'
\ ]
endif
set cursorline
set laststatus=2
let mapleader=","
2022-04-29 13:14:13 +01:00
set number
set relativenumber
2020-12-18 09:18:50 +00:00
set listchars=trail:.,tab:>_
set list
2020-12-21 08:52:45 +00:00
set wrap
set linebreak
set autoread
set colorcolumn=+1
set shiftwidth=2
set softtabstop=2
2020-12-15 21:01:32 +00:00
au BufRead,BufNewFile *.ipynb setlocal filetype=json
au BufRead,BufNewFile *.md setlocal spell
au BufRead,BufNewFile *.code-workspace setlocal filetype=json
2021-10-13 09:16:04 +01:00
au BufRead,BufNewFile *.csv setlocal nowrap
au BufRead,BufNewFile *.service[a-zA-Z0-9]* setlocal filetype=systemd
2022-04-28 14:27:37 +01:00
au TermOpen * setlocal nonumber norelativenumber
2020-12-15 21:01:32 +00:00
syntax on
if &diff
highlight! link DiffText MatchParen
endif
au OptionSet diff highlight! link DiffText MatchParen
2020-12-15 21:01:32 +00:00
set expandtab
2020-12-15 21:01:32 +00:00
set autoindent
set smartindent
filetype plugin indent on
2020-12-15 21:01:32 +00:00
2021-01-04 09:08:22 +00:00
imap jk <Esc>
command Bd b# | bd #
command! BufOnly silent! execute "%bd|e#|bd#"
nnoremap <Leader>b :buffers<CR>:buffer<Space>
2022-04-27 10:43:48 +01:00
nnoremap <Leader>i :!zimports %<CR>:!black %<CR><CR>
2022-04-27 10:56:28 +01:00
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
2022-04-27 11:37:30 +01:00
nnoremap <Leader>a :Ack!<Space>
2022-04-27 10:56:28 +01:00
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
2021-01-04 09:08:22 +00:00
2020-12-15 21:01:32 +00:00
set splitbelow
set splitright
function! GitStatus()
let [a,m,r] = GitGutterGetHunkSummary()
return printf('%s +%d ~%d -%d', FugitiveHead(), a, m, r)
endfunction
2021-01-26 10:34:44 +00:00
let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
2021-01-26 10:48:17 +00:00
let g:python_highlight_all = 1
let g:lightline = { 'colorscheme': 'onehalfdark' }
let g:lightline.component_expand = {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_infos': 'lightline#ale#infos',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ }
let g:lightline.component_type = {
\ 'linter_checking': 'right',
\ 'linter_infos': 'right',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'right',
\ }
let g:lightline.component_function = {
\ 'gitstatus': 'GitStatus'
\ }
let g:lightline.active = {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitstatus', 'readonly', 'filename', 'modified' ] ],
\ 'right': [ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok', 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype' ] ]
\ }
set noshowmode
2021-02-04 08:46:53 +00:00
" Load all plugins now.
" Plugins need to be added to runtimepath before helptags can be generated.
packloadall
if has('python3')
packadd! jedi-vim
endif
2021-02-04 08:46:53 +00:00
" Load all of the helptags now, after plugins have been loaded.
" All messages and errors will be ignored.
2022-04-27 10:39:34 +01:00
" silent! helptags ALL