about summary refs log blame commit diff stats
path: root/mu.vim
blob: a51386e959f07dcbce9a78cf7fc518b941ea0a4b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                              






                                                                    




















                                                                                                                                                     
" Vim syntax file
" Language:    mu
" Maintainer:  Kartik Agaram <mu@akkartik.com>
" URL:         http://github.com/akkartik/mu
" License:     public domain
"
" Copy this into your ftplugin directory, and add the following to your vimrc:
"   autocmd BufReadPost,BufNewFile *.mu,*.test set filetype=mu

let s:save_cpo = &cpo
set cpo&vim

" todo: why does this periodically lose syntax, like on file reload?
"   $ vim x.mu
"   :e
"? if exists("b:syntax")
"?   finish
"? endif
"? let b:syntax = "mu"

setlocal iskeyword=@,48-57,?,!,_,$,-

syntax match muComment /;.*$/
highlight link muComment Comment
syntax match muSalientComment /;;.*$/
highlight link muSalientComment SalientComment
set comments-=:;
set comments+=n:;
syntax match CommentedCode ";? .*"
let b:cmt_head = ";? "

syntax region muString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
highlight link muString String

syntax match muDelimiter "[{}\[\]]" | highlight link muDelimiter Delimiter
syntax match muAssign "<-" | highlight link muAssign SpecialChar
syntax match muAssign "\<raw\>"
syntax keyword muFunc next-input input reply jump jump-if jump-unless loop loop-if loop-unless break-if break-unless | highlight link muFunc Function

let &cpo = s:save_cpo
lass="n">SettingsAware from test import Fake from os.path import realpath, join, dirname from subprocess import Popen, PIPE TESTDIR = realpath(join(dirname(__file__), '/usr/include')) def skip(x): return def raw_load_content(self): """ The method which is used in a Directory object to load stuff. Keep this up to date! """ from os.path import join, isdir, basename from os import listdir import ranger.ext.mount_path self.loading = True self.load_if_outdated() try: if self.exists and self.runnable: # 0.003s: self.mount_path = ranger.ext.mount_path.mount_path(self.path) # 0.1s: filenames = [] for fname in listdir(self.path): if not self.settings.show_hidden: hfilter = self.settings.hidden_filter if hfilter: if isinstance(hfilter, str) and hfilter in fname: continue if hasattr(hfilter, 'search') and \ hfilter.search(fname): continue if isinstance(self.filter, str) and self.filter \ and self.filter not in fname: continue filenames.append(join(self.path, fname)) # --- self.load_content_mtime = os.stat(self.path).st_mtime marked_paths = [obj.path for obj in self.marked_items] # 2.85s: files = [] for name in filenames: if isdir(name): try: item = self.fm.env.get_directory(name) except: item = Directory(name) else: item = File(name) item.load_if_outdated() files.append(item) # 0.2s self.disk_usage = sum(f.size for f in files if f.is_file) self.scroll_offset = 0 self.filenames = filenames self.files = files self._clear_marked_items() for item in self.files: if item.path in marked_paths: self.mark_item(item, True) else: self.mark_item(item, False) self.sort() if len(self.files) > 0: if self.pointed_obj is not None: self.sync_index() else: self.move(to=0) else: self.filenames = None self.files = None self.cycle_list = None self.content_loaded = True self.determine_infostring() self.correct_pointer() finally: self.loading = False class benchmark_load(object): def __init__(self): self.loader = Loader() fm = OpenStruct(loader=self.loader) SettingsAware.settings = Fake() FileManagerAware.fm = fm self.dir = Directory(TESTDIR) def bm_run(self, n): for _ in range(n): self.dir.load_content(schedule=True) while self.loader.has_work(): self.loader.work() @skip class benchmark_raw_load(object): def __init__(self): SettingsAware.settings = Fake() self.dir = Directory(TESTDIR) def bm_run(self, n): generator = self.dir.load_bit_by_bit() for _ in range(n): raw_load_content(self.dir) def bm_loader(n): """Do some random calculation""" tloader = benchmark_load(N) traw = benchmark_raw_load(N) class benchmark_load_varieties(object): def bm_ls(self, n): for _ in range(n): Popen(["ls", '-l', TESTDIR], stdout=open(os.devnull, 'w')).wait() def bm_os_listdir_stat(self, n): for _ in range(n): for f in os.listdir(TESTDIR): path = os.path.join(TESTDIR, f) os.stat(path) def bm_os_listdir(self, n): for _ in range(n): for f in os.listdir(TESTDIR): path = os.path.join(TESTDIR, f) def bm_os_listdir_stat_listdir(self, n): for _ in range(n): for f in os.listdir(TESTDIR): path = os.path.join(TESTDIR, f) os.stat(path) if os.path.isdir(path): os.listdir(path)