Comments (3)
Interesting. But this not disabled others plugins?
from vim-bootstrap.
I don't think disabling plugins is useful, but disable their usage is.
Below a simple script to do that, i hope the code is clear :
fu! s:ProcessCommandList(alist)
for l:opt_set in a:alist
exe l:opt_set
endfor
endfu
" file is large over 10mb; small under 24kb
let g:LargeFileSize = 1024 * 1024 * 10
let g:MediumFileSize = 1024 * 24
let s:LargeFileMsg = 'The file is larger than '
\. (g:LargeFileSize / 1024 / 1024)
\. ' MB, so some options are changed (see g:LargeFileSize).'
let g:SmallFileActionsOpen=['set eventignore-=Filetype']
let g:SmallFileActionsEnter=[]
let g:MediumFileActionsOpen=['set eventignore-=Filetype']
let g:MediumFileActionsEnter=[]
let g:LargeFileActionsEnter=[]
let g:LargeFileActionsOpen=[
\ 'set eventignore+=Filetype',
\ 'setlocal bufhidden=unload',
\ 'setlocal buftype=nowrite',
\ 'setlocal undolevels=-1',
\ 'au VimEnter * echo "'.s:LargeFileMsg.'"'
\]
fu! s:LargeFileSupport(...)
if len(a:000)
let b:filesize=a:000[0]
let l:event='Open'
elseif exists('b:filesize')
let l:event='Enter'
else
return
endif
let l:size = ((b:filesize > g:LargeFileSize
\ || b:filesize == -2) ? 'Large' :
\ (b:filesize > g:MediumFileSize ? 'Medium' : 'Small'))
echo 'call s:ProcessCommandList(g:'.l:size.'FileActions'.l:event.')'
exe 'call s:ProcessCommandList(g:'.l:size.'FileActions'.l:event.')'
endfu
augroup LargeFile
autocmd BufReadPre * silent call s:LargeFileSupport(getfsize(expand("<afile>")))
autocmd BufWinEnter * silent call s:LargeFileSupport()
augroup END
The script allows customization.
For example, in vim config file, you can say you want to see line numbers only in small files :
let g:SmallFileActionsOpen+=['setlocal nu']
from vim-bootstrap.
We can use vim -u NONE
to disable plugins on large files, or script above. Thanks @luffah !
from vim-bootstrap.
Related Issues (20)
- Top bar text not visible on mobile devices
- Add theme Dogrun HOT 1
- Rust language icon is not "selected".
- Add a name or description for each language icon HOT 1
- Error detected while processing BufWinEnter Autocommands HOT 3
- Can't yank a line in Nvim
- Dracula theme with brown background HOT 1
- Tema sainnhe/sonokai não encontrado
- Theme badwolf not found
- Is this should we like this? card Sizes HOT 3
- style: horizontal overflow due to theme selector
- Invalid HTML markup in the template file
- Order of commands in dracula theme does not apply background colour well. If you change the order, it works HOT 3
- `:E` returns `ambiguous use of user-defined command`
- neovim config in lua HOT 2
- no autocomplete in go HOT 1
- vim-airline's display not right
- `:Gbrowse` command has been removed HOT 1
- "Make your .vimrc now" Button Hover Effect Design Enhancement HOT 1
- Theme catppuccin not found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-bootstrap.