Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: tools/vim/mojom/ftdetect/mojomfiletype.vim

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/vim/filetypes.vim ('k') | tools/vim/mojom/indent/mojom.vim » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 " Copyright 2015 The Chromium Authors. All rights reserved.
2 " Use of this source code is governed by a BSD-style license that can be
3 " found in the LICENSE file.
4 " We take care to preserve the user's fileencodings and fileformats,
5 " because those settings are global (not buffer local), yet we want
6 " to override them for loading mojom files, which should be UTF-8.
7 "
8 let s:current_fileformats = ''
9 let s:current_fileencodings = ''
10
11 " define fileencodings to open as utf-8 encoding even if it's ascii.
12 function! s:mojomfiletype_pre()
13 let s:current_fileformats = &g:fileformats
14 let s:current_fileencodings = &g:fileencodings
15 set fileencodings=utf-8 fileformats=unix
16 setlocal filetype=mojom
17 endfunction
18
19 " restore fileencodings as others
20 function! s:mojomfiletype_post()
21 let &g:fileformats = s:current_fileformats
22 let &g:fileencodings = s:current_fileencodings
23 endfunction
24
25 au BufNewFile *.mojom setlocal filetype=mojom fileencoding=utf-8 fileformat=unix
26 au BufRead *.mojom call s:mojomfiletype_pre()
27 au BufReadPost *.mojom call s:mojomfiletype_post()
OLDNEW
« no previous file with comments | « tools/vim/filetypes.vim ('k') | tools/vim/mojom/indent/mojom.vim » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698