123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- " Copyright 2024 Henrique Paone
- "
- " This file is part of Vim-Markup.
- "
- " Vim-Markup is free software: you can redistribute it and/or modify it under the
- " terms of the GNU General Public License as published by the Free Software
- " Foundation, either version 3 of the License, or (at your option) any later
- " version.
- "
- " Vim-Markup is distributed in the hope that it will be useful, but WITHOUT ANY
- " WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- " PARTICULAR PURPOSE. See the GNU General Public License for more details.
- "
- " You should have received a copy of the GNU General Public License along with
- " Vim-Markup. If not, see <https://www.gnu.org/licenses/>.
- "------------------------------------------------------------------------------
- " Configuration
- "------------------------------------------------------------------------------
- " Folding
- set foldmethod=indent
- " Uses spaces instead of tabs
- set expandtab tabstop=2 shiftwidth=2
- " No autoclosing on '
- inoremap ' '
- " Formating options
- set fo+=t " Automatic formatting of text
- set fo+=n " Recognize numbered lists
- "-----------------------------------------------------------------------------
- " Toggle automatic formatting
- set fo-=a
- nnoremap <leader>f :call ToggleAutoFormat()<cr>
- fu! ToggleAutoFormat()
- if stridx(&fo, 'a') == -1
- set fo+=a
- else
- set fo-=a
- endif
- endf
- "-----------------------------------------------------------------------------
- " Make formatting work properly with bullet icon
- let &formatlistpat='^\s*\(\d\+[\]:.)}\t ]\|[•][\t ]\)\s*'
- "------------------------------------------------------------------------------
- "Special characters
- "------------------------------------------------------------------------------
- inoremap \Ep Σ
- inoremap \ep ε
- inoremap \Ee ∈
- inoremap \ee ϵ
- inoremap \delta ∆
- inoremap \fore ⸫
- inoremap \-> →
- inoremap \/> ↙
- inoremap \\> ↘
- inoremap \|> ↓
- inoremap \=> ⇒
- inoremap \. •<Space>
- inoremap \par ¶
- inoremap \sec §
- inoremap \_1 ₁
- inoremap \_2 ₂
- inoremap \^1 ¹
- "------------------------------------------------------------------------------
- " Syntax for text files
- "------------------------------------------------------------------------------
- syn match myTodo /^.*TODO:.*/
- hi myTodo cterm=bold ctermbg=red ctermfg=white
- "------------------------------------------------------------------------------
- " Poor man's markup
- "------------------------------------------------------------------------------
- " Only show hidden markup in insert mode
- setlocal conceallevel=2
- setlocal concealcursor=nvc
- " Bold
- syn region boldText matchgroup=boldDelim start=/\*/ end=/\*/ concealends
- hi boldText cterm=bold
- syn match escapedAsterisk /\\\*/ conceal cchar=*
- " Italic
- syn region italicText matchgroup=italicDelim start=/\// end=/\// concealends
- hi italicText cterm=italic
- syn match escapedItalic /\\\// conceal cchar=/
- " Underline
- syn region underlineText matchgroup=underlineDelim start=/_/ end=/_/ concealends
- hi underlineText cterm=underline
- syn match underlineText /\\_/ conceal cchar=_
- " Autoclosing markup symbols
- inoremap * **<left>
- inoremap / //<left>
- inoremap _ __<left>
- " Toggle showing concealed markup
- let g:conceal_on=1
- nnoremap <leader>m :call ToggleConceal()<cr>
- fu! ToggleConceal()
- if g:conceal_on
- set conceallevel=0
- let g:conceal_on=0
- else
- set conceallevel=2
- let g:conceal_on=1
- endif
- endf
- " Horizontal lines
- inoremap \hl <esc>:call FillLine('─')<cr>i
- inoremap \dl <esc>:call FillLine('-')<cr>i
- " Fills text width with passed char
- fu! FillLine(char)
- for i in range(0, &textwidth - 1)
- execute 'norm!i' .. a:char
- endfor
- endf
|