" map-leader if !exists('mapleader') let mapleader='q' nnoremap q nnoremap Q q endif if !exists('maplocalleader') let maplocalleader='qw' endif inoremap jk " file " save nnoremap :w inoremap :w " copy nnoremap C :w !pbcopy " tab edit nnoremap e :tabe nnoremap v :tabe $HOME/.vim/sup39/sup39.vimrc nnoremap V :tabe $MYVIMRC " search nnoremap / /\v nnoremap ? ?\v nnoremap sl :s/\v nnoremap se :.,$s/\v nnoremap ss :%s/\v nnoremap hh :set hlsearch! incsearch! nnoremap hc :nohlsearch " ale nnoremap r :ALERename nnoremap n :ALENext nnoremap p :ALEPrevious nnoremap :ALEHover nnoremap db :ALEGoToDefinition -tab nnoremap dm :ALEGoToDefinition nnoremap dl :ALEDetail " external nnoremap m :w:make " debug nnoremap X :exe getline('.') nnoremap H :echo synIDattr(synID(line("."),col("."),1),"name") " filetype-dependent augroup sup39_map autocmd! " vim " source autocmd Filetype vim noremap s :w:so % " c, cpp " macro autocmd Filetype c,cpp noremap h \:call setline('.', toupper(substitute(@%, '\.', '_', 'g'))) \yyI#ifndef p#define o#endifkki autocmd Filetype c,cpp noremap i \:call setline('.', \'#include "'.substitute(@%, '\.\zsc\ze\(pp\)\?$', 'h', '').'"')o " abbr autocmd Filetype c,cpp iabbrev #i #include " markdown " plugin nnoremap p :MarkdownPreview augroup END " basic filetype on syntax on set encoding=utf-8 set backspace=indent,eol,start set nocompatible set nofoldenable " indent set list listchars=tab:\▸\- set tabstop=2 shiftwidth=2 softtabstop=2 expandtab smarttab set autoindent smartindent let g:vim_indent_cont = 0 " completion set completeopt=menu,menuone,popup,noselect,noinsert " plugin call plug#begin('~/.vim/plugged') " basic Plug 'tpope/vim-sensible' " markdown syntax Plug 'plasticboy/vim-markdown' let g:vim_markdown_new_list_item_indent = 0 let g:vim_markdown_math = 1 " markdown preview Plug 'iamcco/markdown-preview.nvim', {'do': 'cd app & yarn install'} let g:mkdp_auto_start = 0 let g:mkdp_auto_close = 0 let g:mkdp_preview_options = { \ 'katex': { \ 'macros': { \ '\s': '\square', \ }, \ }, \} " ale Plug 'dense-analysis/ale' let g:ale_sign_error = '>>' let g:ale_sign_warning = '--' let g:ale_sign_column_always = 1 let g:ale_completion_enabled = 1 let g:ale_linters = { \ 'cpp': ['gcc'], \ 'swift': ['sourcekitlsp'], \ } call plug#end() " override augroup sup39_override autocmd! " override plugin autocmd Filetype * setlocal formatoptions-=ro " keyword autocmd Filetype javascript,typescript,vue setlocal iskeyword+=$ autocmd Filetype html,vue setlocal iskeyword+=- " tab autocmd FileType make,java,python setlocal noexpandtab " syntax autocmd FileType markdown,vue syntax sync fromstart augroup END