Update linebreak settings with vim

This commit is contained in:
Thomas Dehaeze 2020-11-05 17:04:10 +01:00
parent d85f559b43
commit baaf2ee98d

584
vim.org
View File

@ -16,7 +16,7 @@
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script> #+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script> #+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script>
#+PROPERTY: header-args+ :comments none #+PROPERTY: header-args :comments none
#+PROPERTY: header-args+ :mkdirp yes #+PROPERTY: header-args+ :mkdirp yes
#+PROPERTY: header-args+ :tangle ~/.vimrc #+PROPERTY: header-args+ :tangle ~/.vimrc
:END: :END:
@ -165,15 +165,6 @@ Other nice themes are [[https://github.com/mhartington/oceanic-next][oceanic-nex
Plug 'vim-scripts/utl.vim' " Univeral Text Linking - Execute URLs, footnotes, open emails, organize ideas Plug 'vim-scripts/utl.vim' " Univeral Text Linking - Execute URLs, footnotes, open emails, organize ideas
#+end_src #+end_src
** Others / To test
#+begin_src vimrc
" Plug 'francoiscabrol/ranger.vim' " Ranger integration in vim and neovim
" Plug 'brooth/far.vim' " Find And Replace Vim plugin
" Plug 'justinmk/vim-gtfo' " Go to Terminal or File manager
" Plug 'sjl/gundo.vim', { 'on': 'GundoToggle' } " Vim plugin to visualize your Vim undo tree
" Plug 'drzel/vim-line-no-indicator' " Simple and expressive line number indicator
#+end_src
** Plug End ** Plug End
#+begin_src vimrc #+begin_src vimrc
call plug#end() call plug#end()
@ -182,133 +173,133 @@ Other nice themes are [[https://github.com/mhartington/oceanic-next][oceanic-nex
* Basic * Basic
** General ** General
#+begin_src vimrc #+begin_src vimrc
set runtimepath+=~/.vim set runtimepath+=~/.vim
" Sets how many lines of history VIM has to remember " Sets how many lines of history VIM has to remember
set history=500 set history=500
" Enable filetype plugins " Enable filetype plugins
filetype plugin on filetype plugin on
filetype indent on filetype indent on
" Set to auto read when a file is changed from the outside " Set to auto read when a file is changed from the outside
set autoread set autoread
" writes the content of the file automatically if you call :make " writes the content of the file automatically if you call :make
set autowrite set autowrite
" Share clipboard with system " Share clipboard with system
set clipboard+=unnamedplus set clipboard+=unnamedplus
" Define Leader Key as Space key " Define Leader Key as Space key
let mapleader = "\<Space>" let mapleader = "\<Space>"
let g:mapleader = "\<Space>" let g:mapleader = "\<Space>"
let maplocalleader = "," let maplocalleader = ","
#+end_src #+end_src
** VIM user interface ** VIM user interface
#+begin_src vimrc #+begin_src vimrc
" Set 7 lines to the cursor - when moving vertically using j/k " Set 7 lines to the cursor - when moving vertically using j/k
set so=7 set so=7
" Avoid garbled characters in Chinese language windows OS " Avoid garbled characters in Chinese language windows OS
let $LANG='en' let $LANG='en'
set langmenu=en set langmenu=en
" Set Timeout config " Set Timeout config
set timeout set timeout
set ttimeout set ttimeout
set timeoutlen=500 set timeoutlen=500
set ttimeoutlen=50 set ttimeoutlen=50
" Turn on the wild menu " Turn on the wild menu
set wildmenu set wildmenu
" Ignore compiled files " Ignore compiled files
set wildignore=*.o,*~,*.pyc set wildignore=*.o,*~,*.pyc
if has("win16") || has("win32") if has("win16") || has("win32")
set wildignore+=.git\*,.hg\*,.svn\* set wildignore+=.git\*,.hg\*,.svn\*
else else
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
endif endif
set wildmode=full set wildmode=full
"Always show current position "Always show current position
set ruler set ruler
" Height of the command bar " Height of the command bar
set cmdheight=1 set cmdheight=1
" A buffer becomes hidden when it is abandoned " A buffer becomes hidden when it is abandoned
set hid set hid
" Configure backspace so it acts as it should act " Configure backspace so it acts as it should act
set backspace=eol,start,indent set backspace=eol,start,indent
set whichwrap+=<,>,h,l set whichwrap+=<,>,h,l
" Ignore case when searching " Ignore case when searching
set ignorecase set ignorecase
" When searching try to be smart about cases " When searching try to be smart about cases
set smartcase set smartcase
" Option for smarter completions that will be case aware " Option for smarter completions that will be case aware
set infercase set infercase
" Highlight search results " Highlight search results
set hlsearch set hlsearch
" Makes search act like search in modern browsers " Makes search act like search in modern browsers
set incsearch set incsearch
" Don't redraw while executing macros (good performance config) " Don't redraw while executing macros (good performance config)
set lazyredraw set lazyredraw
" For regular expressions turn magic on " For regular expressions turn magic on
set magic set magic
" Show matching brackets when text indicator is over them " Show matching brackets when text indicator is over them
set showmatch set showmatch
" Don't show tab line if there is only one tab " Don't show tab line if there is only one tab
set showtabline=1 set showtabline=1
" How tany tenths of a second to blink when matching brackets " How tany tenths of a second to blink when matching brackets
set mat=2 set mat=2
" No annoying sound on errors " No annoying sound on errors
set noerrorbells set noerrorbells
set novisualbell set novisualbell
set t_vb= set t_vb=
set tm=500 set tm=500
" Add a bit extra margin to the left " Add a bit extra margin to the left
set foldcolumn=0 set foldcolumn=0
" Improve VIM scrolling " Improve VIM scrolling
set ttyfast set ttyfast
" Relative Numbers " Relative Numbers
set relativenumber set relativenumber
" Smarter J and K navigation " Smarter J and K navigation
nnoremap <expr> j v:count ? (v:count > 5 ? "m'" . v:count : '') . 'j' : 'gj' nnoremap <expr> j v:count ? (v:count > 5 ? "m'" . v:count : '') . 'j' : 'gj'
nnoremap <expr> k v:count ? (v:count > 5 ? "m'" . v:count : '') . 'k' : 'gk' nnoremap <expr> k v:count ? (v:count > 5 ? "m'" . v:count : '') . 'k' : 'gk'
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults. " Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright set splitbelow splitright
#+end_src #+end_src
** Foldings ** Foldings
#+begin_src vimrc #+begin_src vimrc
if has('folding') if has('folding')
if has('windows') if has('windows')
let &fillchars='vert: ' " less cluttered vertical window separators let &fillchars='vert: ' " less cluttered vertical window separators
endif endif
set foldmethod=indent " not as cool as syntax, but faster set foldmethod=indent " not as cool as syntax, but faster
set foldlevelstart=99 " start unfolded set foldlevelstart=99 " start unfolded
endif endif
#+end_src #+end_src
** Colors and Fonts ** Colors and Fonts
@ -352,75 +343,82 @@ endif
** Files, backups and undo ** Files, backups and undo
#+begin_src vimrc #+begin_src vimrc
" Turn backup off, since most stuff is in SVN, git et.c anyway... " Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup set nobackup
set nowb set nowb
set noswapfile set noswapfile
#+end_src #+end_src
** Text, tab and indent related ** Text, tab and indent related
#+begin_src vimrc #+begin_src vimrc
" Use spaces instead of tabs " Use spaces instead of tabs
set expandtab set expandtab
" Be smart when using tabs " Be smart when using tabs
set smarttab set smarttab
" 1 tab == 4 spaces " 1 tab == 4 spaces
set shiftwidth=4 set shiftwidth=4
set tabstop=4 set tabstop=4
" Word wrap without line breaks " Enable Line Number
set wrap set number
set linebreak #+end_src
set nolist " list disables linebreak
set autoindent " Auto Indentation From https://stackoverflow.com/questions/36950231/auto-wrap-lines-in-vim-without-inserting-newlines.
set nosmartindent " No Smart Indentation #+begin_src vimrc
" Word wrap without line breaks
set textwidth=0
set wrapmargin=0
set wrap
set linebreak
" set columns=160
#+end_src
#+begin_src vimrc
set autoindent " Auto Indentation
set nosmartindent " No Smart Indentation
#+end_src #+end_src
** Moving around, tabs, windows and buffers ** Moving around, tabs, windows and buffers
#+begin_src vimrc #+begin_src vimrc
" Specify the behavior when switching between buffers " Specify the behavior when switching between buffers
try try
set switchbuf=useopen,usetab set switchbuf=useopen,usetab
catch catch
endtry endtry
" Return to last edit position when opening files (You want this!) " Return to last edit position when opening files (You want this!)
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
set splitbelow set splitbelow
set splitright set splitright
" This enables mouse in all modes " This enables mouse in all modes
set mouse=a set mouse=a
" Automatically equalize splits when Vim is resized " Automatically equalize splits when Vim is resized
autocmd VimResized * wincmd = autocmd VimResized * wincmd =
#+end_src #+end_src
** Misc ** Misc
#+begin_src vimrc #+begin_src vimrc
" Enable Line Number " Speed up cursor movments : http://superuser.com/a/625994/587300
set number set regexpengine=1 " https://github.com/xolox/vim-easytags/issues/88
" Speed up cursor movments : http://superuser.com/a/625994/587300 " Set the maximum column for syntax highlighting
set regexpengine=1 " https://github.com/xolox/vim-easytags/issues/88 set synmaxcol=250
" Set the maximum column for syntax highlighting
set synmaxcol=250
#+end_src #+end_src
** Helper functions ** Helper functions
#+begin_src vimrc #+begin_src vimrc
function! CmdLine(str) function! CmdLine(str)
exe "menu Foo.Bar :" . a:str exe "menu Foo.Bar :" . a:str
emenu Foo.Bar emenu Foo.Bar
unmenu Foo unmenu Foo
endfunction endfunction
function! VisualSelection(direction, extra_filter) range function! VisualSelection(direction, extra_filter) range
let l:saved_reg = @" let l:saved_reg = @"
execute "normal! vgvy" execute "normal! vgvy"
@ -435,11 +433,11 @@ function! VisualSelection(direction, extra_filter) range
let @/ = l:pattern let @/ = l:pattern
let @" = l:saved_reg let @" = l:saved_reg
endfunction endfunction
" Don't close window, when deleting a buffer " Don't close window, when deleting a buffer
command! Bclose call <SID>BufcloseCloseIt() command! Bclose call <SID>BufcloseCloseIt()
function! <SID>BufcloseCloseIt() function! <SID>BufcloseCloseIt()
let l:currentBufNum = bufnr("%") let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#") let l:alternateBufNum = bufnr("#")
@ -456,7 +454,7 @@ function! <SID>BufcloseCloseIt()
if buflisted(l:currentBufNum) if buflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum) execute("bdelete! ".l:currentBufNum)
endif endif
endfunction endfunction
#+end_src #+end_src
** GUI related ** GUI related
@ -473,11 +471,11 @@ endfunction
** Turn persistent undo on ** Turn persistent undo on
#+begin_src vimrc #+begin_src vimrc
try try
set undodir=~/.vim_runtime/temp_dirs/undodir set undodir=~/.vim_runtime/temp_dirs/undodir
set undofile set undofile
catch catch
endtry endtry
#+end_src #+end_src
* Mappings * Mappings
@ -504,47 +502,47 @@ endtry
** Visual mode related ** Visual mode related
#+begin_src vimrc #+begin_src vimrc
" Visual mode pressing / or ? searches for the current selection " Visual mode pressing / or ? searches for the current selection
vnoremap <silent> / :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR> vnoremap <silent> / :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
vnoremap <silent> ? :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR> vnoremap <silent> ? :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
" Re-select visual block after indenting " Re-select visual block after indenting
vnoremap < <gv vnoremap < <gv
vnoremap > >gv vnoremap > >gv
" Move visual block " Move visual block
vnoremap J :m '>+1<CR>gv=gv vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv vnoremap K :m '<-2<CR>gv=gv
#+end_src #+end_src
** Add some delimiters ** Add some delimiters
#+begin_src vimrc #+begin_src vimrc
" use $ as a delimiter " use $ as a delimiter
xnoremap i$ :<C-u>normal! T$vt$<CR> xnoremap i$ :<C-u>normal! T$vt$<CR>
xnoremap a$ :<C-u>normal! T$hvt$l<CR> xnoremap a$ :<C-u>normal! T$hvt$l<CR>
onoremap i$ :normal vi$<CR> onoremap i$ :normal vi$<CR>
onoremap a$ :normal va$<CR> onoremap a$ :normal va$<CR>
#+end_src #+end_src
** Command mode related ** Command mode related
#+begin_src vimrc #+begin_src vimrc
" Bash like keys for the command line " Bash like keys for the command line
cnoremap <C-A> <Home> cnoremap <C-A> <Home>
cnoremap <C-E> <End> cnoremap <C-E> <End>
cnoremap <C-K> <C-U> cnoremap <C-K> <C-U>
cnoremap <C-P> <Up> cnoremap <C-P> <Up>
cnoremap <C-N> <Down> cnoremap <C-N> <Down>
#+end_src #+end_src
** Terminal mode related ** Terminal mode related
#+begin_src vimrc #+begin_src vimrc
" tnoremap <Esc> <C-\><C-n> " tnoremap <Esc> <C-\><C-n>
tnoremap <C-w>h <C-\><C-n><C-w>h tnoremap <C-w>h <C-\><C-n><C-w>h
tnoremap <C-w>j <C-\><C-n><C-w>j tnoremap <C-w>j <C-\><C-n><C-w>j
tnoremap <C-w>k <C-\><C-n><C-w>k tnoremap <C-w>k <C-\><C-n><C-w>k
tnoremap <C-w>l <C-\><C-n><C-w>l tnoremap <C-w>l <C-\><C-n><C-w>l
#+end_src #+end_src
** Correct misspelled works ** Correct misspelled works
@ -562,19 +560,20 @@ Taken from: https://vi.stackexchange.com/questions/68/autocorrect-spelling-mista
* Filetypes * Filetypes
** Vim Which Key ** Vim Which Key
#+begin_src vimrc #+begin_src vimrc
nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR> nnoremap <silent> <leader> :WhichKey '<Space>'<cr>
let g:which_key_map_local = {} let g:which_key_map_local = {}
#+end_src #+end_src
** Mails ** Mails
#+begin_src vimrc #+begin_src vimrc
autocmd FileType mail set spell spelllang=en_us,fr autocmd FileType mail set spell spelllang=en_us,fr
#+end_src #+end_src
** MarkDown ** MarkDown
#+begin_src vimrc #+begin_src vimrc
" Automatically turn on spell-checking for Markdown files " Automatically turn on spell-checking for Markdown files
au BufRead,BufNewFile *.md setlocal spell spelllang=fr,en au BufRead,BufNewFile *.md setlocal spell spelllang=fr,en
#+end_src #+end_src
** LaTeX ** LaTeX
@ -607,11 +606,11 @@ au BufRead,BufNewFile *.md setlocal spell spelllang=fr,en
** Arduino ** Arduino
#+begin_src vimrc #+begin_src vimrc
au BufRead,BufNewFile *.pde set filetype=arduino au BufRead,BufNewFile *.pde set filetype=arduino
au BufRead,BufNewFile *.ino set filetype=arduino au BufRead,BufNewFile *.ino set filetype=arduino
" au FileType arduino map <leader>ac :!platformio run<CR> " au FileType arduino map <leader>ac :!platformio run<CR>
" au FileType arduino map <leader>au :!platformio run -s --target=upload<CR> " au FileType arduino map <leader>au :!platformio run -s --target=upload<CR>
" au FileType arduino map <leader>am :!platformio serialports monitor --port=/dev/cu " au FileType arduino map <leader>am :!platformio serialports monitor --port=/dev/cu
#+end_src #+end_src
** Python ** Python
@ -693,22 +692,22 @@ au BufRead,BufNewFile *.ino set filetype=arduino
** Save Which Key Configuration ** Save Which Key Configuration
#+begin_src vimrc #+begin_src vimrc
call which_key#register(',', "g:which_key_map_local") call which_key#register('<Space>', "g:which_key_map")
#+end_src #+end_src
* Plugins Config * Plugins Config
** junegunn/fzf ** junegunn/fzf
#+begin_src vimrc #+begin_src vimrc
" This is the default extra key bindings " This is the default extra key bindings
let g:fzf_action = { let g:fzf_action = {
\ 'ctrl-t': 'tab split', \ 'ctrl-t': 'tab split',
\ 'ctrl-h': 'split', \ 'ctrl-h': 'split',
\ 'ctrl-v': 'vsplit' } \ 'ctrl-v': 'vsplit' }
" [[B]Commits] Customize the options used by 'git log': " [[B]Commits] Customize the options used by 'git log':
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
let g:fzf_colors = let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'], \ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'], \ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'], \ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
@ -721,15 +720,15 @@ let g:fzf_colors =
\ 'spinner': ['fg', 'Label'], \ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] } \ 'header': ['fg', 'Comment'] }
function! s:fzf_statusline() function! s:fzf_statusline()
" Override statusline as you like " Override statusline as you like
highlight fzf1 ctermfg=161 ctermbg=251 highlight fzf1 ctermfg=161 ctermbg=251
highlight fzf2 ctermfg=23 ctermbg=251 highlight fzf2 ctermfg=23 ctermbg=251
highlight fzf3 ctermfg=237 ctermbg=251 highlight fzf3 ctermfg=237 ctermbg=251
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endfunction endfunction
autocmd! User FzfStatusLine call <SID>fzf_statusline() autocmd! User FzfStatusLine call <SID>fzf_statusline()
#+end_src #+end_src
** autozimu/LanguageClient-neovim ** autozimu/LanguageClient-neovim
@ -747,17 +746,17 @@ autocmd! User FzfStatusLine call <SID>fzf_statusline()
** JamshedVesuna/vim-markdown-preview ** JamshedVesuna/vim-markdown-preview
#+begin_src vimrc #+begin_src vimrc
let vim_markdown_preview_github=1 let vim_markdown_preview_github=1
let vim_markdown_preview_browser='Google Chrome' let vim_markdown_preview_browser='Google Chrome'
let vim_markdown_preview_temp_file=1 let vim_markdown_preview_temp_file=1
" let vim_markdown_preview_pandoc=1 " let vim_markdown_preview_pandoc=1
#+end_src #+end_src
** mhinz/vim-signify ** mhinz/vim-signify
#+begin_src vimrc #+begin_src vimrc
let g:signify_vcs_list = ['git'] let g:signify_vcs_list = ['git']
let g:signify_disable_by_default = 1 let g:signify_disable_by_default = 1
#+end_src #+end_src
** Deoplete ** Deoplete
@ -773,28 +772,28 @@ let g:signify_disable_by_default = 1
** SirVer/ultisnips ** SirVer/ultisnips
#+begin_src vimrc #+begin_src vimrc
let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnip' let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnip'
" inoremap <silent><expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" " inoremap <silent><expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
let g:UltiSnipsExpandTrigger="<C-j>" let g:UltiSnipsExpandTrigger="<C-j>"
" let g:UltiSnipsJumpForwardTrigger="<tab>" " let g:UltiSnipsJumpForwardTrigger="<tab>"
" let g:UltiSnipsJumpBackwardTrigger="<s-tab>" " let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
#+end_src #+end_src
** honza/vim-snippets ** honza/vim-snippets
#+begin_src vimrc #+begin_src vimrc
let g:snipMate = {} let g:snipMate = {}
let g:snipMate.scope_aliases = {} let g:snipMate.scope_aliases = {}
#+end_src #+end_src
** itchyny/lightline.vim ** itchyny/lightline.vim
#+begin_src vimrc #+begin_src vimrc
function! LightlineObsession() function! LightlineObsession()
return '%{ObsessionStatus("")}' return '%{ObsessionStatus("")}'
endfunction endfunction
" \ 'colorscheme': 'gruvbox', " \ 'colorscheme': 'gruvbox',
let g:lightline = { let g:lightline = {
\ 'colorscheme': 'solarized', \ 'colorscheme': 'solarized',
\ 'active': { \ 'active': {
\ 'left': [ [ 'mode', 'paste' ], \ 'left': [ [ 'mode', 'paste' ],
@ -811,25 +810,25 @@ let g:lightline = {
\ }, \ },
\ 'separator': { 'left': '', 'right': '' }, \ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': "|", 'right': "|" } \ 'subseparator': { 'left': "|", 'right': "|" }
\ } \ }
#+end_src #+end_src
** Autopairs ** Autopairs
#+begin_src vimrc #+begin_src vimrc
" Incompatibilité entre auto-pairs et clang-complete " Incompatibilité entre auto-pairs et clang-complete
let g:AutoPairsMapCR = 0 let g:AutoPairsMapCR = 0
imap <silent><CR> <CR><Plug>AutoPairsReturn imap <silent><CR> <CR><Plug>AutoPairsReturn
#+end_src #+end_src
** Yggdroot/indentLine ** Yggdroot/indentLine
#+begin_src vimrc #+begin_src vimrc
" :IndentLinesToggle toggles lines on and off. " :IndentLinesToggle toggles lines on and off.
let g:indentLine_color_term = 239 let g:indentLine_color_term = 239
#+end_src #+end_src
** ryanoasis/vim-devicons ** ryanoasis/vim-devicons
#+begin_src vimrc #+begin_src vimrc
let g:webdevicons_enable_ctrlp = 1 let g:webdevicons_enable_ctrlp = 1
#+end_src #+end_src
** junegunn/goyo.vim ** junegunn/goyo.vim
@ -842,8 +841,6 @@ let g:webdevicons_enable_ctrlp = 1
This is for soft line breaks This is for soft line breaks
#+begin_src vimrc #+begin_src vimrc
function! s:goyo_enter() function! s:goyo_enter()
set wrap linebreak nolist textwidth=0 wrapmargin=0
let b:quitting = 0 let b:quitting = 0
let b:quitting_bang = 0 let b:quitting_bang = 0
autocmd QuitPre <buffer> let b:quitting = 1 autocmd QuitPre <buffer> let b:quitting = 1
@ -871,20 +868,20 @@ Quit Vim if this is the only remaining buffer
** tpope/vim-surround ** tpope/vim-surround
#+begin_src vimrc #+begin_src vimrc
vmap Si S(i_<esc>f) vmap Si S(i_<esc>f)
au FileType mako vmap Si S"i${ _(<esc>2f"a) }<esc> au FileType mako vmap Si S"i${ _(<esc>2f"a) }<esc>
" surroung un visual mode : use S, then b to make the text bold in markdown " surroung un visual mode : use S, then b to make the text bold in markdown
let g:surround_{char2nr('b')} = "__\r__" let g:surround_{char2nr('b')} = "__\r__"
#+end_src #+end_src
** Vim-Markdown ** Vim-Markdown
#+begin_src vimrc #+begin_src vimrc
let g:vim_markdown_folding_disabled = 1 let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_conceal = 0 let g:vim_markdown_conceal = 0
let g:vim_markdown_toc_autofit = 1 let g:vim_markdown_toc_autofit = 1
let g:vim_markdown_toml_frontmatter = 1 let g:vim_markdown_toml_frontmatter = 1
let g:tex_conceal = "" let g:tex_conceal = ""
#+end_src #+end_src
** Neomake ** Neomake
@ -945,11 +942,6 @@ let g:tex_conceal = ""
let g:EditorConfig_exclude_patterns = ['fugitive://.*'] let g:EditorConfig_exclude_patterns = ['fugitive://.*']
#+end_src #+end_src
** Polyglot
#+begin_src vimrc
let g:polyglot_disabled = ['latex']
#+end_src
* Bindings * Bindings
** Vim Which Key ** Vim Which Key
#+begin_src vimrc #+begin_src vimrc
@ -1303,16 +1295,16 @@ let g:tex_conceal = ""
** Errors ** Errors
#+begin_src vimrc #+begin_src vimrc
let g:which_key_map.e = { 'name' : '+errors' } let g:which_key_map.e = { 'name' : '+errors' }
function! s:GetBufferList() function! s:GetBufferList()
redir =>buflist redir =>buflist
silent! ls silent! ls
redir END redir END
return buflist return buflist
endfunction endfunction
function! ToggleLocationList() function! ToggleLocationList()
let curbufnr = winbufnr(0) let curbufnr = winbufnr(0)
for bufnum in map(filter(split(s:GetBufferList(), '\n'), 'v:val =~ "Location List"'), 'str2nr(matchstr(v:val, "\\d\\+"))') for bufnum in map(filter(split(s:GetBufferList(), '\n'), 'v:val =~ "Location List"'), 'str2nr(matchstr(v:val, "\\d\\+"))')
if curbufnr == bufnum if curbufnr == bufnum
@ -1346,72 +1338,72 @@ function! ToggleLocationList()
" restore previous window " restore previous window
exec prevwinnr."wincmd w" exec prevwinnr."wincmd w"
exec winnr."wincmd w" exec winnr."wincmd w"
endfunction endfunction
" Error Toggle " Error Toggle
nnoremap <silent><leader>ee :call ToggleLocationList()<CR> nnoremap <silent><leader>ee :call ToggleLocationList()<CR>
let g:which_key_map.e.e = 'error-toggle' let g:which_key_map.e.e = 'error-toggle'
" Error Open " Error Open
nnoremap <silent><leader>eo :lopen<CR> nnoremap <silent><leader>eo :lopen<CR>
let g:which_key_map.e.o = 'error-open' let g:which_key_map.e.o = 'error-open'
" Error Close " Error Close
nnoremap <silent><leader>ec :lclose<CR> nnoremap <silent><leader>ec :lclose<CR>
let g:which_key_map.e.c = 'error-close' let g:which_key_map.e.c = 'error-close'
" Error Next " Error Next
nnoremap <silent><leader>en :lnext<CR> nnoremap <silent><leader>en :lnext<CR>
let g:which_key_map.e.n = 'error-next' let g:which_key_map.e.n = 'error-next'
" Error Previous " Error Previous
nnoremap <silent><leader>ep :lprevious<CR> nnoremap <silent><leader>ep :lprevious<CR>
let g:which_key_map.e.p = 'error-previous' let g:which_key_map.e.p = 'error-previous'
#+end_src #+end_src
** Text ** Text
#+begin_src vimrc #+begin_src vimrc
let g:which_key_map.x = { 'name' : '+text' } let g:which_key_map.x = { 'name' : '+text' }
" Start interactive EasyAlign in visual mode (e.g. vipga) and for a motion " Start interactive EasyAlign in visual mode (e.g. vipga) and for a motion
xmap <leader>xa <Plug>(EasyAlign) xmap <leader>xa <Plug>(EasyAlign)
nmap <leader>xa <Plug>(EasyAlign) nmap <leader>xa <Plug>(EasyAlign)
let g:which_key_map.x.a = 'text-align' let g:which_key_map.x.a = 'text-align'
" Indent all file " Indent all file
nnoremap <leader>x= mzgg=G`z nnoremap <leader>x= mzgg=G`z
" let g:which_key_map.x.= = 'text-indent-file' " let g:which_key_map.x.= = 'text-indent-file'
" Custom Multiple Cursor " Custom Multiple Cursor
" http://www.kevinli.co/posts/2017-01-19-multiple-cursors-in-500-bytes-of-vimscript/ " http://www.kevinli.co/posts/2017-01-19-multiple-cursors-in-500-bytes-of-vimscript/
let g:mc = "y/\\V\<C-r>=escape(@\", '/')\<CR>\<CR>" let g:mc = "y/\\V\<C-r>=escape(@\", '/')\<CR>\<CR>"
" Multiple Cursor " Multiple Cursor
nnoremap <leader>xm *``cgn nnoremap <leader>xm *``cgn
vnoremap <expr> <leader>xm g:mc . "``cgn" vnoremap <expr> <leader>xm g:mc . "``cgn"
let g:which_key_map.x.m = 'multiple-cursor' let g:which_key_map.x.m = 'multiple-cursor'
" Multiple Cursor - reserve direction " Multiple Cursor - reserve direction
nnoremap <leader>xM *``cgN nnoremap <leader>xM *``cgN
vnoremap <expr> <leader>xM g:mc . "``cgN" vnoremap <expr> <leader>xM g:mc . "``cgN"
let g:which_key_map.x.M = 'multiple-cursor-reverse' let g:which_key_map.x.M = 'multiple-cursor-reverse'
" Delete trainling Whitespaces " Delete trainling Whitespaces
fun! TrimWhitespace() fun! TrimWhitespace()
let l:save = winsaveview() let l:save = winsaveview()
keeppatterns %s/\s\+$//e keeppatterns %s/\s\+$//e
call winrestview(l:save) call winrestview(l:save)
endfun endfun
nnoremap <leader>xt :call TrimWhitespace()<CR> nnoremap <leader>xt :call TrimWhitespace()<CR>
let g:which_key_map.x.t = 'delete-trailing-whitespaces' let g:which_key_map.x.t = 'delete-trailing-whitespaces'
#+end_src #+end_src
** Config ** Config
#+begin_src vimrc #+begin_src vimrc
let g:which_key_map.c = { 'name' : '+config' } let g:which_key_map.c = { 'name' : '+config' }
let s:activatedsh = 0 let s:activatedsh = 0
function! ToggleSyntaxH() function! ToggleSyntaxH()
if s:activatedsh == 0 if s:activatedsh == 0
let s:activatedsh = 1 let s:activatedsh = 1
set synmaxcol=800 set synmaxcol=800
@ -1419,14 +1411,14 @@ function! ToggleSyntaxH()
let s:activatedsh = 0 let s:activatedsh = 0
set synmaxcol=100 set synmaxcol=100
endif endif
endfunction endfunction
" Toggle Syntax column " Toggle Syntax column
nnoremap <leader>cs :call ToggleSyntaxH()<CR> nnoremap <leader>cs :call ToggleSyntaxH()<CR>
let g:which_key_map.c.s = 'toggle-syntax-col' let g:which_key_map.c.s = 'toggle-syntax-col'
let s:activatedh = 0 let s:activatedh = 0
function! ToggleH() function! ToggleH()
if s:activatedh == 0 if s:activatedh == 0
let s:activatedh = 1 let s:activatedh = 1
match Search '\%>80v.\+' match Search '\%>80v.\+'
@ -1434,39 +1426,39 @@ function! ToggleH()
let s:activatedh = 0 let s:activatedh = 0
match none match none
endif endif
endfunction endfunction
" Toggle Highlight " Toggle Highlight
nnoremap <leader>ch :call ToggleH()<CR> nnoremap <leader>ch :call ToggleH()<CR>
let g:which_key_map.c.h = 'toggle-highlight' let g:which_key_map.c.h = 'toggle-highlight'
" Reload vim config " Reload vim config
noremap <Leader>cr :source $MYVIMRC<CR> noremap <Leader>cr :source $MYVIMRC<CR>
let g:which_key_map.c.e = 'reload-config' let g:which_key_map.c.e = 'reload-config'
" Edit vim config " Edit vim config
noremap <Leader>ce :e $MYVIMRC<CR> noremap <Leader>ce :e $MYVIMRC<CR>
let g:which_key_map.c.e = 'edit-config' let g:which_key_map.c.e = 'edit-config'
" Disable highlight " Disable highlight
noremap <silent> <leader>c<CR> :noh<CR> noremap <silent> <leader>c<CR> :noh<CR>
let g:which_key_map.c.enter = 'disable-highlight' let g:which_key_map.c.enter = 'disable-highlight'
" Theme " Theme
noremap <silent> <leader>ct :noh<CR> noremap <silent> <leader>ct :noh<CR>
let g:which_key_map.c.t = 'choose-theme' let g:which_key_map.c.t = 'choose-theme'
#+end_src #+end_src
** Insert ** Insert
#+begin_src vimrc #+begin_src vimrc
let g:which_key_map.i = { 'name' : '+insert' } let g:which_key_map.i = { 'name' : '+insert' }
" Insert Snippet " Insert Snippet
noremap <Leader>is :Snippets<CR> noremap <Leader>is :Snippets<CR>
let g:which_key_map.i.s = 'insert-snippet' let g:which_key_map.i.s = 'insert-snippet'
#+end_src #+end_src
** Save Which Key Configuration ** Save Which Key Configuration
#+begin_src vimrc #+begin_src vimrc
call which_key#register('<Space>', "g:which_key_map") call which_key#register('<Space>', "g:which_key_map")
#+end_src #+end_src