Skip to content

Commit

Permalink
Remove non-relevant sensible settings
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerun committed Oct 19, 2020
1 parent ad2df97 commit 1d7f0e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 42 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A collection of language packs for Vim.
- It is also more secure (scripts loaded for every filetype are generated by vim-polyglot)
- Best syntax and indentation support (no other features). Hand-selected language packs.
- Automatically detects indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth), can be disabled)
- Includes defaults from [vim-sensible](https://github.com/tpope/vim-sensible), which are usually necessary for editing in any language (can be disabled)
- Includes some defaults from [vim-sensible](https://github.com/tpope/vim-sensible), which are usually necessary for editing in any language (can be disabled)

\*To be completely honest, optimized `ftdetect` script takes around `10ms` to load.

Expand Down
48 changes: 7 additions & 41 deletions plugin/polyglot.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,15 @@ endif

" Code taken from https://github.com/tpope/vim-sensible
" and (mostly comments) from https://github.com/sheerun/vimrc
"
" Only settings that matter for proper editing are left
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sensible')
" Autoindent when starting new line, or using `o` or `O`.
set autoindent

" Allow backspace in insert mode.
set backspace=indent,eol,start

" Don't scan included files. The .tags file is more performant.
set complete-=i

" Use 'shiftwidth' when using `<Tab>` in front of a line.
" By default it's used only for shift commands (`<`, `>`).
set smarttab

This comment has been minimized.

Copy link
@sheerun

sheerun Oct 19, 2020

Author Owner

smarttab is already set for "autoindent" functionality


" Disable octal format for number processing.
set nrformats-=octal

" Allow for mappings including `Esc`, while preserving
" zero timeout after pressing it manually.
" (only vim needs a fix for this)
Expand All @@ -43,33 +35,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sensible')
" Enable highlighted case-insensitive incremential search.
set incsearch

" Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
endif

" Always show window statuses, even if there's only one.
set laststatus=2

" Show the line and column number of the cursor position.
set ruler

" Autocomplete commands using nice menu in place of window status.
" Enable `Ctrl-N` and `Ctrl-P` to scroll through matches.
set wildmenu

" Keep 5 columns next to the cursor when scrolling horizontally.
if !&scrolloff
set scrolloff=1
endif
if !&sidescrolloff
set sidescrolloff=5
endif

" When 'wrap' is on, display last line even if it doesn't fit.
set display+=lastline

" Force utf-8 encoding
" Use utf-8 encoding by default
set encoding=utf-8

" Set default whitespace characters when using `:set list`
Expand All @@ -82,10 +48,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sensible')
set formatoptions+=j
endif

" Search upwards for tags file instead only locally
if has('path_extra')
setglobal tags-=./tags tags-=./tags; tags^=./tags;
endif
" Search upwards for tags file instead only locally
if has('path_extra')
setglobal tags-=./tags tags-=./tags; tags^=./tags;
endif

" Fix issues with fish shell
" https://github.com/tpope/vim-sensible/issues/50
Expand Down

3 comments on commit 1d7f0e4

@ipod825
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the settings are guarded now and others are sensible to me(but may offend others). It can be improved by echoing an warning message for unguarded settings:

function s:Warn()
echom "polyglot is changing some of your settings, to disable this message set g:disable_polyglot_warn" 
endfunction

if !&autoindent
 call s:Warn()
 set autoindent
end 

@sheerun
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not show warning, but change settings only if they haven't changed from defaults

@sheerun
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if someone likes the defaults, I'll watch issues on this repository or comments, and remove more settings. For now most of them are needed for pleasant language support

Please sign in to comment.