Mercurial > ec-dotfiles
view rc/vimrc @ 657:91d7c2e5936c
Remove need to manually switch directory with sud
author | nanaya <me@nanaya.pro> |
---|---|
date | Sun, 25 Jul 2021 21:36:52 +0900 |
parents | 6ca63cec0879 |
children | be98916b55df |
line wrap: on
line source
if $TERM == 'screen' set t_Co=256 endif set nocompatible set showmode " shows mode insert/replace/visual set showcmd " shows last command on screen set nomodeline " disallow automatic vim command execution on arbitrary file set autoindent set lazyredraw set vb t_vb= " disables visual bell set ruler set backspace=2 " make backspace work like most other apps set esckeys set noerrorbells set backupcopy=yes set scrolloff=5 set softtabstop=4 tabstop=4 shiftwidth=4 expandtab set copyindent set title set incsearch set ignorecase set smartcase set hlsearch set ls=2 " always show status line set hidden " it's buffer time? set list listchars=tab:>-,trail:.,extends:>,nbsp:? if has("autocmd") autocmd colorscheme * highlight specialkey ctermfg=gray autocmd colorscheme * highlight linenr ctermfg=gray ctermbg=black endif set number " http://stackoverflow.com/questions/14635295/vim-takes-a-very-long-time-to-start-up set clipboard=exclude:.* if has("eval") execute pathogen#infect() endif if has('filetype') filetype plugin indent on endif map <C-t><up> :tabr<cr> map <C-t><down> :tabl<cr> map <C-t><left> :tabp<cr> map <C-t><right> :tabn<cr> map <C-t>p :tabp<cr> map <C-t>n :tabn<cr> map <C-t><C-t> :NERDTreeToggle<cr> map <C-t><C-m> :NERDTreeMirror<cr> " clears out highlight nmap <esc>[13~ <esc>:nohlsearch<cr> " toggles paste mode nmap <esc>[14~ <esc>:set paste!<cr> " removes prefix for windows copypasta nmap <esc>[15~ <esc>:set number! list!<cr> " format JSON map <leader>j <esc>:%!python -m json.tool<cr> " visual navigation instead of logical nmap j gj nmap k gk "autocmd VimEnter * NERDTree "autocmd BufEnter * NERDTreeMirror if has('syntax') syntax on set foldmethod=manual set nofoldenable set background=dark colorscheme srcery-drk endif if has("autocmd") function In2() set softtabstop=2 tabstop=2 shiftwidth=2 expandtab endfunction function In4() set softtabstop=4 tabstop=4 shiftwidth=4 expandtab endfunction function In4t() set softtabstop=4 tabstop=4 shiftwidth=4 noexpandtab endfunction " required by syntax file " reference: https://github.com/elzr/vim-json/blob/master/ftplugin/json.vim let g:vim_json_syntax_conceal = 1 autocmd BufNewFile,BufRead *.json set filetype=json autocmd BufNewFile,BufRead *.jsonp set filetype=json autocmd BufRead,BufNewFile *.blade.php set filetype=blade autocmd BufRead,BufNewFile *.coffee set filetype=coffee autocmd BufRead,BufNewFile *.erb set filetype=eruby autocmd BufRead,BufNewFile *.less set filetype=less autocmd BufRead,BufNewFile *.scss set filetype=scss autocmd BufRead,BufNewFile *.slim set filetype=slim autocmd BufRead,BufNewFile Gemfile set filetype=ruby autocmd BufRead,BufNewFile Vagrantfile set filetype=ruby autocmd BufRead,BufNewFile config.ru set filetype=ruby autocmd BufRead,BufNewFile supervisord.conf set filetype=dosini autocmd BufRead,BufNewFile php-fpm.conf set filetype=dosini autocmd BufRead,BufNewFile */php-fpm.d/* set filetype=dosini " stolen from https://github.com/leafgarland/typescript-vim/blob/master/ftdetect/typescript.vim " use `set filetype` to override default filetype=xml for *.ts files autocmd BufNewFile,BufRead *.ts set filetype=typescript autocmd BufNewFile,BufRead *.tsx set filetype=typescript autocmd BufRead,BufNewFile *.nginx set ft=nginx autocmd BufRead,BufNewFile */etc/nginx/* set ft=nginx autocmd BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx autocmd BufRead,BufNewFile */opt/nginx/conf/* set ft=nginx autocmd BufRead,BufNewFile nginx.conf set ft=nginx autocmd FileType coffee call In2() autocmd FileType css call In2() autocmd FileType eruby call In2() autocmd FileType ruby call In2() autocmd FileType scss call In2() autocmd FileType less call In2() autocmd FileType yaml call In2() autocmd FileType json call In2() autocmd FileType javascript call In2() autocmd FileType typescript call In2() autocmd FileType typescriptreact call In2() autocmd FileType nginx setlocal commentstring=#\ %s autocmd FileType nginx setlocal iskeyword& endif if has('autocmd') "Restore cursor position set viminfo='50,\"1000,<1000,:100,%,h,n~/.viminfo function! ResCur() if line("'\"") <= line("$") normal! g`" return 1 endif endfunction augroup resCur autocmd! autocmd BufWinEnter * call ResCur() augroup END autocmd BufWinEnter */.git/COMMIT_EDITMSG exe "normal! gg" autocmd BufWinEnter .git/COMMIT_EDITMSG exe "normal! gg" endif if has('statusline') " Status line detail: " %f file path " %y file type between braces (if defined) " %([%R%M]%) read-only, modified and modifiable flags between braces " %{'!'[&ff=='default_file_format']} " shows a '!' if the file format is not the platform " default " %{'$'[!&list]} shows a '*' if in list mode " %{'~'[&pm=='']} shows a '~' if in patchmode " (%{synIDattr(synID(line('.'),col('.'),0),'name')}) " only for debug : display the current syntax item name " %= right-align following items " #%n buffer number " %l/%L,%c%V line number, total number of lines, and column number function SetStatusLineStyle() if &stl == '' || &stl =~ 'synID' let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}%{'~'[&pm=='']}%=#%n %l/%L,%c%V " else let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=#%n %l/%L,%c%V " endif endfunc " Switch between the normal and vim-debug modes in the status line nmap _ds :call SetStatusLineStyle()<CR> call SetStatusLineStyle() " Window title if has('title') if &term == "screen" set t_ts=]0; set t_fs= endif set title let &titlestring = $user endif endif if filereadable($HOME."/.vimrc.local") source $HOME/.vimrc.local endif