etc/dot/file/vimrc
2023-06-14 19:50:53 +03:00

102 lines
2.7 KiB
VimL

" k1574's shitty vimrc.
" 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 noswapfile
set nowrap
set number
set autoindent
set smartindent
let g:python_recommended_style=1
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.
set cursorline
if has("gui_running")
colorscheme vividchalk
else
" My colorscheme based on 'slate'.
colorscheme jien
"colorscheme torte
endif
" Syntax.
syntax on
" Backup.
" set swapfile
" set dir=~/tmp
" Maps.
" Folds.
noremap <2-LeftMouse> za
" Nerd-Tree.
nmap \nt :NERDTree . <enter>
" Commenting
noremap <leader>/ :Commentary<cr>
" 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.
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
nmap + <C-W>+
nmap - <C-W>-
nmap <C-@> 4<C-w>>
cnoremap <C-A> <Home>
cnoremap <C-F> <Right>
cnoremap <C-B> <Left>
cnoremap <Esc>b <S-Left>
cnoremap <Esc>f <S-Right>
vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
" vimrc interaction.
nnoremap confe :e $MYVIMRC<CR>
nnoremap confr :source $MYVIMRC<CR>
" 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
autocmd FileType html setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=0
autocmd FileType htmldjango setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=0
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=0
" Jump to the last pos.
" 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