diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/vim-options.vim | 487 |
1 files changed, 64 insertions, 423 deletions
diff --git a/plugin/vim-options.vim b/plugin/vim-options.vim index cbcd5e0..2b72899 100644 --- a/plugin/vim-options.vim +++ b/plugin/vim-options.vim @@ -1,32 +1,20 @@ -"----------------------------------------------------------------------------------------------------------------------- " General Settings -"---------------------------------------------------------------------------------------------------------------------- filetype plugin on " Enable default plugins -let mapleader="\<Space>" -" Vim options that neovim has turned on but vim has off/ignores -set backspace=indent,eol,start -set nocompatible " Vim is non-compatible with vi. Neovim ignores this -set wildmenu " Turn on wildmenu for vim, Neovim defaults to on -set incsearch " Shows results for '/' search as you are typing the search -set hlsearch " After a '/' search, highlight the matches -" Regular settings -" Don't be a fool, setting path will make all kinds of funky things happen -" with the autocomplete -"set path=** " Set path to look at all directories under current root -set wildignore=*/app/cache,*/vendor,*/env,*.pyc,*/venv,*/__pycache__ " Wildmenu will ignore these folder/file types -set expandtab " Expand tabs into spaces -set tabstop=4 " Default to 4 spaces +set nocompatible " Disable vi-compatible +set wildmenu " Enable autocomple menu +set incsearch " Show search results as typing string +set hlsearch " Highlight matches to previos search string +set expandtab " In Insert mode: Use the appropriate number of spaces to insert <Tab>. +set tabstop=4 "Number of spaces that a <Tab> counts for set shiftwidth=0 " Make shiftwidth value the same as tabstop -set history=1000 " Set number of ':' commands -set relativenumber " Use relative numbers in the sidebar -set number " Show line numbers in side bar +set relativenumber " Use relative numbers in the side bar set nowrap " Turn off text wrapping long lines +set history=1000 " Set number of ':' commands set wildmode=list:full " wildmenu show list complete to first result set splitright " New windows split to the right of current one set splitbelow " New windows split below the current one -set sessionoptions+=globals " Append globals to the default session options -set foldmethod=indent " Fold on Indent levels -set foldlevel=99 " Open all folds when entering file +set completeopt-=preview " Hide the preview/scratch window + " Custom status line set statusline= set statusline+=%1*\ %02c\ " Color @@ -34,112 +22,42 @@ set statusline+=%2*\ » " RIGHT-POINTING DOUBLE ANGLE QUO set statusline+=%3*\ %<%F\ " File+path set statusline+=%2*\« " LEFT-POINTING DOUBLE ANGLE QUOTATION MARK set statusline+=%2*\ %=\ %l/%L\ (%02p%%)\ " Rownumber/total (%) -" Set spacing of file types -autocmd FileType html setlocal tabstop=2 -autocmd FileType htmljinja setlocal tabstop=2 -autocmd FileType htmldjango setlocal tabstop=2 -autocmd FileType php setlocal tabstop=4 -autocmd FileType python setlocal tabstop=4 -autocmd FileType sh setlocal tabstop=4 -autocmd FileType javascript setlocal tabstop=4 -autocmd FileType json setlocal tabstop=4 + +" Set spacing of filetypes +autocmd FileType sh,python setlocal tabstop=4 autocmd FileType make setlocal tabstop=4 noexpandtab -autocmd FileType scss setlocal tabstop=2 autocmd FileType ledger setlocal tabstop=2 autocmd FileType vim setlocal tabstop=2 -autocmd FileType mkd setlocal tw=80 -" Make netrw prettier -let g:netrw_banner = 0 " Hide the banner -let g:netrw_liststyle = 3 " Tree view -let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+' " Hide dotfiles -"----------------------------------------------------------------------------------------------------------------------- - - -"----------------------------------------------------------------------------------------------------------------------- -" Color/Theming Options -"----------------------------------------------------------------------------------------------------------------------- -" 0 = dark background // 1 = red -" 2 = green // 3 = yellow -" 4 = light blue // 5 = pink -" 6 = cyan // 7 = beige -" 8 = dark blue // 9 = orange -" 10 = dark grey // 11 = grey -" 12 = light grey // 13 = purple -" 14 = grey // 15 = white -" 16 = black -syntax enable " Enable syntax highlighiting of files +" Setup colorscheme +syntax enable colorscheme gruvbox " Set the colorscheme set background=dark " Use dark colorscheme + " Set vimdiff colors, make it easier to read highlight DiffAdd cterm=BOLD ctermfg=NONE ctermbg=22 highlight DiffDelete cterm=BOLD ctermfg=NONE ctermbg=52 highlight DiffChange cterm=BOLD ctermfg=NONE ctermbg=23 highlight DiffText cterm=BOLD ctermfg=NONE ctermbg=23 -" Set syntax of files that vim doesn't recognize -au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm set ft=jinja -au BufNewFile,BufRead *.yml set filetype=yaml -au BufNewFile,BufRead *.sls set filetype=yaml -au BufNewFile,BufRead *.inc set filetype=php -au BufNewFile,BufRead *.module set filetype=php -au BufRead,BufNewFile *.ejs set syntax=htmljinja -au BufRead,BufNewFile *.md set filetype=markdown -" Highligh current cursorline -hi CursorLineNR cterm=bold ctermfg=226 -" Status line colors per mode -hi User1 ctermfg=NONE ctermbg=NONE cterm=bold -hi User3 ctermfg=NONE ctermbg=NONE -hi User2 ctermfg=NONE ctermbg=NONE -" Change gutter color -highlight SignColumn cterm=NONE ctermfg=0 ctermbg=None -" Highlight long lines at 80 mark -highlight ColorColumn ctermbg=cyan -au BufNewFile,BufRead * call matchadd('ColorColumn', '\%81v', 100) -" Highlight super long lines -au BufNewFile,BufRead * call matchadd('Error', '\%121v', 100) -" Disable background colors for transparency -hi Normal guibg=NONE ctermbg=NONE -"----------------------------------------------------------------------------------------------------------------------- - +" Highlight lines at 80 mark/120 mark +highlight ColorColumn ctermbg=cyan +autocmd FileType python call matchadd('ColorColumn', '\%81v', 100) +autocmd FileType python call matchadd('Error', '\%121v', 100) -"----------------------------------------------------------------------------------------------------------------------- -" Vim vs Neovim settings -"----------------------------------------------------------------------------------------------------------------------- +" Neovim (Docker) vs Vim if has('nvim') let $HOME='/root/.vimcache' let $EditorDir='/root/.config/nvim/' let $SessionDir='.vimcache' silent! execute '!mkdir -p .vimcache/backup' - " Set Backup dirs - set backupdir=.vimcache/backup/ - set directory=.vimcache/swp/ - let g:syntastic_python_python_exec = '/usr/bin/python3' - set completeopt=menu,noinsert " default is menu,preview. Don't insert text until selection is made - nnoremap <leader>er :call RestoreSession()<CR> - nnoremap <leader>y :call system('nc -w 1 172.17.0.1 41401', @0)<CR> - tnoremap <A-h> <C-\><C-N><C-w>h - tnoremap <A-j> <C-\><C-N><C-w>j - tnoremap <A-k> <C-\><C-N><C-w>k - tnoremap <A-l> <C-\><C-N><C-w>l - nmap <F5> :!isort %<CR> - nmap <F6> <C-w>s<C-w>k:edit term://bash<CR>i - nmap <F7> <C-w>s<C-w>k:edit term://htop<CR><C-w>j else let $EditorDir=$HOME.'/.vim/' let $SessionDir='.' - " Set Backup dirs - set backupdir=~/.vim/vim-files/backups/ - set directory=~/.vim/vim-files/swaps/ - let g:vimwiki_list = [{'path': '~/Wiki/wiki', 'path_html': '~/Wiki/wiki_html/', 'ext': '.wiki'}] - nnoremap <leader>y :call system('nc -w 1 localhost 41401', @0)<CR> endif - - -"----------------------------------------------------------------------------------------------------------------------- -" Custom functions -"----------------------------------------------------------------------------------------------------------------------- +" My Shorcuts +let mapleader="\<Space>" " type jj to get out of insert mode inoremap jj <ESC> " Ctags for python project @@ -148,36 +66,17 @@ command! MakeTagsPython !ctags --languages=python --python-kinds=-i -R . map <leader>hi :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#")<CR> " Turn off syntax highlighting nnoremap <leader><leader> :noh<CR> -" Shortcuts for window +" New tab nnoremap <C-w>t :tabnew<CR> -" Shorcut for stubbing out find command -" should be in fzf command block -nnoremap <leader>s :Files<CR> -nnoremap <leader>b :Buffers<CR> -nnoremap <leader>t :Tags<CR> -" Formating a json file -com! Formatjson %!python -m json.tool " Visually select pasted text nnoremap gp `[v`] -" Yank withouth newline -nmap yY ^y$$ " Vimdiff commands nnoremap <leader>du :diffupdate<CR> nnoremap <leader>dd :diffget<CR> nnoremap <leader>df :diffput<CR> nnoremap _ [c nnoremap = ]c -" Function for saving session -function! SaveSession() - :mksession! $SessionDir/session.vim - :echo 'Session Saved!' -endfunction -nnoremap <leader>ee :call SaveSession()<CR> -" Function for restoring session -function! RestoreSession() - :source $SessionDir/session.vim -endfunction -" Functions for deleting, changing, yanking 'in-line' +" Visually select line without ending nnoremap <leader>v ^v$h " Some very useful shortcuts for editing Ledger entries " Copy the last entry @@ -190,56 +89,8 @@ nnoremap <leader>ln {jV}y}p10l nnoremap <leader>ld j^f$lC " After searching pull entry to current position nnoremap <leader>ly vapy<C-o>p{{jvEy}jvEpl -" Snippets -nnoremap <leader>,date :-1read !date +\%F<CR> -nnoremap <leader>,fabfile :-1read $EditorDir/plugged/vim-options/snippets/python/fabfile.py<CR> -nnoremap <leader>,cutf8 :-1read $EditorDir/plugged/vim-options/snippets/python/cutf8.py<CR>jf.i -nnoremap <leader>,pudb :-1read $EditorDir/plugged/vim-options/snippets/python/pudb.py<CR>V -nnoremap <leader>,pydef :-1read $EditorDir/plugged/vim-options/snippets/python/pydef.py<CR>/jump<CR>V12j -nnoremap <leader>,pyclass :-1read $EditorDir/plugged/vim-options/snippets/python/pyclass.py<CR>/jump<CR> -" Arrow keys move windows -inoremap <Up> <C-\><C-N><C-w>h -inoremap <Down> <C-\><C-N><C-w>j -inoremap <Up> <C-\><C-N><C-w>k -inoremap <Right> <C-\><C-N><C-w>l -noremap <Up> <C-w>k -noremap <Down> <C-w>j -noremap <Left> <C-w>h -noremap <Right> <C-w>l -" Faster next functions -nnoremap [q :cprev<CR> -nnoremap ]q :cnext<CR> -" Some formatting shortcuts -nnoremap g1 V:s/\<./\u&/g<CR>:noh<CR> -nnoremap g2 V:s/-/ /g<CR>:noh<CR> -nnoremap g3 ^v$:s/\%V /-/g<CR>:noh<CR> -nnoremap g4 V:s/ /_/g<CR>:noh<CR> -nnoremap g5 ^v$:s/\%V /_/g<CR>:noh:<CR> -function! WordsToChoices() - python3 << EOF -import vim -buf = vim.current.buffer -(lnum1, col1) = buf.mark('<') -(lnum2, col2) = buf.mark('>') -lspaces = len(buf[lnum1]) - len(buf[lnum1].lstrip(' ')) -start_choices = lnum1 + (lnum2 - lnum1) -end_choices = lnum2 + (lnum2 - lnum1) -end_line = end_choices + 1 -choices_and_values = [] -for line_num in range(lnum1-1, lnum2): - word = buf[line_num].strip() - line = buf[line_num] - buf[line_num] = "{} = '{}'".format(line.upper(), word) - choices_and_values.append((word.upper(), "'{}'".format(word))) -buf[lnum2] = '{}TEST_CHOICES = ('.format(' ' * lspaces) -for line_num in range(start_choices + 1, end_choices + 2): - choice, value = choices_and_values.pop(0) - buf[line_num] = "{}({}, ({})),".format(' ' * (lspaces + 4), choice, value) -buf[end_choices + 2] = '{})'.format(' ' * lspaces) -EOF -endfunction -nnoremap <F4> `>o<ESC>p`]o<ESC>`<:call WordsToChoices()<CR> -"----------------------------------------------------------------------------------------------------------------------- +" Accept current autocomplete suggestion +inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" @@ -248,7 +99,7 @@ nnoremap <F4> `>o<ESC>p`]o<ESC>`<:call WordsToChoices()<CR> "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/ack.vim/plugin/ack.vim')) nnoremap <leader>/ :call AckSearch()<CR> - noremap <leader>a :Ack <cword><cr> + noremap <leader>ea :Ack <cword><cr> function! AckSearch() call inputsave() let term = input('Search: ') @@ -269,19 +120,7 @@ endif " Argwrap "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/vim-argwrap/plugin/argwrap.vim')) - nnoremap <silent> <leader>w :ArgWrap<CR> -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" CamelCaseMotion -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/CamelCaseMotion/plugin/camelcasemotion.vim')) - map <silent> ,w <Plug>CamelCaseMotion_w - map <silent> ,e <Plug>CamelCaseMotion_e - map <silent> ,b <Plug>CamelCaseMotion_b + nnoremap <leader>ew :ArgWrap<CR> endif "----------------------------------------------------------------------------------------------------------------------- @@ -291,7 +130,7 @@ endif " Fugitive "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/vim-fugitive/plugin/fugitive.vim')) - " Command for toggling git status + " Command for toggling git status function! ToggleGStatus() if buflisted(bufname('.git/index')) bd .git/index @@ -309,7 +148,22 @@ endif "----------------------------------------------------------------------------------------------------------------------- -" Indent Lines Plugin +" fzf.vim +"----------------------------------------------------------------------------------------------------------------------- +if !empty(glob($EditorDir.'plugged/fzf.vim/plugin/fzf.vim')) + nnoremap <leader>ff :Files<CR> + nnoremap <leader>fb :Buffers<CR> + nnoremap <leader>ft :Tags<CR> + nnoremap <leader>fm :Marks<CR> + nnoremap <leader>fc :Commits<CR> + nnoremap <leader>fg :GFiles?<CR> +endif +"----------------------------------------------------------------------------------------------------------------------- + + + +"----------------------------------------------------------------------------------------------------------------------- +" Indent Guides "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/vim-indent-guides/plugin/indent_guides.vim')) let g:indent_guides_enable_on_vim_startup = 1 @@ -319,76 +173,9 @@ if !empty(glob($EditorDir.'plugged/vim-indent-guides/plugin/indent_guides.vim')) let g:indent_guides_guide_size = 1 autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=235 autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=237 - autocmd VimEnter,Colorscheme * :IndentGuidesEnable -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Ledger -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/SimpylFold/ftplugin/python/SimpylFold.vim')) - au BufNewFile,BufRead *.ldg,*.ledger setf ledger | comp ledger -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Markdown -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vim-markdown/indent/markdown.vim')) - let g:vim_markdown_folding_disabled=1 -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Python-Syntax -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/python-syntax/syntax/python.vim')) - let python_highlight_all = 1 -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Syntastic -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/syntastic/plugin/syntastic.vim')) - let g:syntastic_php_checkers = ['php', 'phpcs'] - let g:syntastic_javascript_checkers = ['eslint'] - let g:syntastic_python_checkers = ['pyton3', 'flake8', 'mypy'] - let g:syntastic_scss_checkers = ['sass_lint'] - let g:syntastic_php_phpcs_args = "--standard=/root/PEARish.xml,PSR2,Symfony2" - let g:syntastic_always_populate_loc_list = 0 - let g:syntastic_auto_loc_list = 0 - let g:syntastic_check_on_wq = 0 - let g:syntastic_check_on_open = 0 - let g:syntastic_aggregate_errors = 1 - let g:syntastic_mode_map = { 'mode': 'active' } - function! ToggleSyntasticMode() -python << EOF -import vim -import ast -value = dict(vim.eval('g:syntastic_mode_map')) -vim.command('let l:syntastic_current_mode = \''+value['mode']+'\'') -EOF - SyntasticToggleMode - if l:syntastic_current_mode == 'passive' - SyntasticCheck - let g:syntastic_check_on_wq = 0 - let g:syntastic_check_on_open = 0 - else - let g:syntastic_check_on_wq = 1 - let g:syntastic_check_on_open = 1 - endif - endfunction - " nnoremap <leader>a :call ToggleSyntasticMode()<CR> - " nnoremap <leader>a :SyntasticCheck<CR> + autocmd FileType python :IndentGuidesEnable + autocmd FileType html :IndentGuidesEnable + autocmd FileType jinja :IndentGuidesEnable endif "----------------------------------------------------------------------------------------------------------------------- @@ -398,7 +185,6 @@ endif " Taboo "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/taboo.vim/plugin/taboo.vim')) - au BufNewFile,BufRead *.ldg,*.ledger setf ledger | comp ledger function! RenameTab() call inputsave() let term = input('Tabname: ') @@ -407,70 +193,7 @@ if !empty(glob($EditorDir.'plugged/taboo.vim/plugin/taboo.vim')) execute ":TabooRename " . term endif endfunction -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Vdebug Plugin -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vdebug/plugin/vdebug.vim')) - let g:vdebug_options = { - \ "watch_window_style" : 'compact', - \ "port" : 9000, - \ "path_maps" : { - \ "/var/www/html": "/Users/hiarc/myprojectdir", - \ }, - \} - "Delete all breakpoints - :command! BR BreakpointRemove * -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Vim JSON -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vim-json/indent/json.vim')) - let g:vim_json_syntax_conceal = 0 -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Vim EasyMotion Incsearch -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/incsearch-easymotion.vim/plugin/incsearch/easymotion.vim')) - " You can use other keymappings like <C-l> instead of <CR> if you want to - " use these mappings as default search and somtimes want to move cursor with - " EasyMotion. - function! s:incsearch_config(...) abort - return incsearch#util#deepextend(deepcopy({ - \ 'modules': [incsearch#config#easymotion#module({'overwin': 1})], - \ 'keymap': { - \ "\<C-l>": '<Over>(easymotion)' - \ }, - \ 'is_expr': 0 - \ }), get(a:, 1, {})) - endfunction - noremap <silent><expr> / incsearch#go(<SID>incsearch_config()) - noremap <silent><expr> ? incsearch#go(<SID>incsearch_config({'command': '?'})) - noremap <silent><expr> g/ incsearch#go(<SID>incsearch_config({'is_stay': 1})) -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" EasyMotion -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vim-easymotion/autoload/EasyMotion.vim')) - " <Leader>f{char} to move to {char}{char} - map <Leader>f <Plug>(easymotion-bd-f2) - nmap <Leader>f <Plug>(easymotion-overwin-f2) + nnoremap <leader>er :call RenameTab()<CR> endif "----------------------------------------------------------------------------------------------------------------------- @@ -487,18 +210,8 @@ if !empty(glob($EditorDir.'plugged/ale/autoload/ale.vim')) let g:ale_history_enabled = 0 highlight clear ALEErrorSign highlight clear ALEWarningSign -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Tagbar -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/tagbar/plugin/tagbar.vim')) - nmap <F8> :TagbarToggle<CR> - let g:tagbar_foldlevel = 1 - autocmd VimEnter * nested :TagbarOpen + " Change gutter color + highlight SignColumn cterm=NONE ctermfg=0 ctermbg=None endif "----------------------------------------------------------------------------------------------------------------------- @@ -535,40 +248,20 @@ endif "----------------------------------------------------------------------------------------------------------------------- -" SuperTab Plugin -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/supertab/plugin/supertab.vim')) - let g:SuperTabDefaultCompletionType = "<c-n>" -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- " Pymode "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/python-mode/plugin/pymode.vim')) - " I like my coloring better + let g:pymode_run = 1 + let g:pymode_indent = 1 + let g:pymode_motion = 1 let g:pymode_options_colorcolumn = 0 - let g:pymode_warnings = 1 - let g:pymode_python = 'python3' - let g:pymode_breakpoint = 0 let g:pymode_lint = 0 let g:pymode_rope = 0 - let g:pymode_doc_bind = '<c-k>' - let g:pymode_motion = 0 -endif -"----------------------------------------------------------------------------------------------------------------------- - - - -"----------------------------------------------------------------------------------------------------------------------- -" Dasht -"----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vim-dasht/plugin/dasht.vim')) - nnoremap K :Dasht<Space> - let g:dasht_filetype_docsets = {} - let g:dasht_filetype_docsets['python'] = ['django', 'python_3'] + let g:pymode_doc = 0 + let g:pymode_breakpoint = 0 + let g:pymode_lint = 0 + let g:pymode_folding = 0 + let g:pymode_motion = 0 " Disable error when using fzf to switch files endif "----------------------------------------------------------------------------------------------------------------------- @@ -580,68 +273,16 @@ endif if !empty(glob($EditorDir.'plugged/ranger.vim/plugin/ranger.vim')) let g:ranger_map_keys = 0 nnoremap <leader>n :Ranger<CR> - " Ranger plugin disables relative numbering - " (https://github.com/francoiscabrol/ranger.vim/issues/29) - nnoremap <leader>ds :set rnu<CR> + let g:ranger_replace_netrw = 1 " open ranger when vim open a directory endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- -" Pencil (Markdown files +" Jinja Highlighting "----------------------------------------------------------------------------------------------------------------------- -if !empty(glob($EditorDir.'plugged/vim-pencil/plugin/pencil.vim')) - autocmd FileType markdown,mk call pencil#init({'wrap': 'hard'}) +if !empty(glob($EditorDir.'plugged/vim-jinja2-syntax/indent/jinja.vim')) + au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm set ft=jinja endif "----------------------------------------------------------------------------------------------------------------------- - - -"----------------------------------------------------------------------------------------------------------------------- -" Basic movements (h, j, k, l) require a number prefix. Break bad habits -"----------------------------------------------------------------------------------------------------------------------- -function! DisableIfNonCounted(move) range - if v:count - return a:move - else - " You can make this do something annoying like: - " echoerr "Count required!" - " sleep 2 - return "" - endif -endfunction - -function! SetDisablingOfBasicMotionsIfNonCounted(on) - let keys_to_disable = get(g:, "keys_to_disable_if_not_preceded_by_count", ["j", "k", "l", "h"]) - if a:on - for key in keys_to_disable - execute "noremap <expr> <silent> " . key . " DisableIfNonCounted('" . key . "')" - endfor - let g:keys_to_disable_if_not_preceded_by_count = keys_to_disable - let g:is_non_counted_basic_motions_disabled = 1 - else - for key in keys_to_disable - try - execute "unmap " . key - catch /E31:/ - endtry - endfor - let g:is_non_counted_basic_motions_disabled = 0 - endif -endfunction - -function! ToggleDisablingOfBasicMotionsIfNonCounted() - let is_disabled = get(g:, "is_non_counted_basic_motions_disabled", 0) - if is_disabled - call SetDisablingOfBasicMotionsIfNonCounted(0) - else - call SetDisablingOfBasicMotionsIfNonCounted(1) - endif -endfunction - -command! ToggleDisablingOfNonCountedBasicMotions :call ToggleDisablingOfBasicMotionsIfNonCounted() -command! DisableNonCountedBasicMotions :call SetDisablingOfBasicMotionsIfNonCounted(1) -command! EnableNonCountedBasicMotions :call SetDisablingOfBasicMotionsIfNonCounted(0) - -" Call this function to enable Hard Mode -"DisableNonCountedBasicMotions |