Update linebreak settings with vim

This commit is contained in:
Thomas Dehaeze 2020-11-05 17:04:10 +01:00
parent 8e8122b9c8
commit e17e650295

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