etc/dot/file/vimrc

104 lines
2.7 KiB
VimL
Raw Normal View History

2020-11-04 02:03:20 +03:00
" k1574's shitty vimrc.
2022-10-11 17:52:39 +03:00
2020-11-04 02:03:20 +03:00
" Mouse.
" In many terminal emulators the mouse works just fine.
" By enabling it you can position the cursor,
" Visually select and scroll with the mouse.
if( has('mouse') )
set mouse=a
endif
" Set.
set nowrap
set number
set autoindent
set smartindent
2022-09-05 18:07:23 +03:00
let g:python_recommended_style=1
2020-11-04 02:03:20 +03:00
imap <S-Tab> <Space><Space><Space><Space>
set smarttab
set noet ci pi sw=4 ts=4
set showcmd
set showmatch
set ignorecase
set autowrite
set hlsearch
" List.
set list
set listchars=tab:\|\.,trail:.
match NonText /\t/
" Folding.
set foldenable
set foldmethod=indent
set foldnestmax=10
" GUI.
2022-09-05 18:07:23 +03:00
set cursorline
2020-11-04 02:03:20 +03:00
if has("gui_running")
colorscheme vividchalk
else
" My colorscheme based on 'slate'.
colorscheme jien
"colorscheme torte
endif
" Syntax.
syntax on
2022-11-22 11:20:17 +03:00
" Backup.
set swapfile
set dir=~/tmp
2020-11-04 02:03:20 +03:00
" Maps.
2022-09-02 11:20:23 +03:00
" Folds.
noremap <2-LeftMouse> za
2020-11-04 02:03:20 +03:00
" Nerd-Tree.
nmap \nt :NERDTree . <enter>
2022-09-05 18:07:23 +03:00
" Commenting
noremap <leader>/ :Commentary<cr>
2020-11-04 02:03:20 +03:00
" Disable highlight.
nmap \nl :if &cursorline==1<enter>set nocursorline<enter>else<enter>set cursorline<enter>endif<enter><enter>
nmap \nh :nohlsearch<enter>
nmap <Return> i<Return><Esc>
nmap <Tab> >>
nmap <S-Tab> <<
nmap <Space> i<Space><Esc>
nmap <Backspace> i<Backspace><Esc>l
imap <M-a> <Esc>
imap <C-Space> <Esc>
" Windows.
2020-11-04 02:03:20 +03:00
nmap <C-l> <C-w>l
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-V> <C-W>v
nmap <C-S> <C-W>s
2020-11-04 02:03:20 +03:00
nmap + <C-W>+
nmap - <C-W>-
2022-11-23 02:57:11 +03:00
nmap <C-]> 4<C-w>>
nmap <C-[> 4<C-w><
2020-11-04 02:03:20 +03:00
cnoremap <C-A> <Home>
cnoremap <C-F> <Right>
cnoremap <C-B> <Left>
cnoremap <Esc>b <S-Left>
cnoremap <Esc>f <S-Right>
2022-09-05 18:07:23 +03:00
vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
2022-10-11 17:52:39 +03:00
" vimrc interaction.
nnoremap confe :e $MYVIMRC<CR>
nnoremap confr :source $MYVIMRC<CR>
2022-09-05 18:07:23 +03:00
" File types.
autocmd FileType javascript setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=0
autocmd FileType javascriptreact setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=0
autocmd FileType scss setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=0
autocmd FileType css setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=0
2022-09-06 19:17:21 +03:00
autocmd FileType html setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=0
autocmd FileType htmldjango setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=0
2022-10-11 17:52:39 +03:00
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=0
2022-09-05 18:07:23 +03:00
" Jump to the last pos.
2020-11-04 02:03:20 +03:00
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on "gvim").
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Encoding.
set encoding=utf-8