640ad1959549

moare
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 06 Sep 2013 12:21:38 -0400
parents 45a5bbee63bd
children 8bcaac8a526e
branches/tags (none)
files .hgsub .hgsubstate bin/sort-scala-imports ctags dotcss/simple.com.css vim/vimrc

Changes

--- a/.hgsub	Mon Aug 26 11:56:19 2013 -0400
+++ b/.hgsub	Fri Sep 06 12:21:38 2013 -0400
@@ -2,7 +2,9 @@
 mercurial/histedit               = [hg]https://bitbucket.org/durin42/histedit
 mercurial/templates              = [hg]https://bitbucket.org/sjl/mercurial-cli-templates
 vim/bundle/AnsiEsc.vim           = [git]git://github.com/sjl/AnsiEsc.vim.git
+vim/bundle/YouCompleteMe         = [git]git://github.com/Valloric/YouCompleteMe.git
 vim/bundle/abolish               = [git]git://github.com/tpope/vim-abolish.git
+vim/bundle/argumentative         = [git]git://github.com/PeterRincker/vim-argumentative.git
 vim/bundle/ack                   = [git]git://github.com/mileszs/ack.vim.git
 vim/bundle/badwolf               = [hg]https://bitbucket.org/sjl/badwolf/
 vim/bundle/clam                  = [hg]https://bitbucket.org/sjl/clam.vim/
@@ -34,7 +36,6 @@
 vim/bundle/sparkup               = [git]git://github.com/sjl/vim-sparkup.git
 vim/bundle/splice                = [hg]https://bitbucket.org/sjl/splice.vim
 vim/bundle/strftimedammit        = [hg]https://bitbucket.org/sjl/strftimedammit.vim/
-vim/bundle/supertab              = [git]git://github.com/ervandew/supertab.git
 vim/bundle/surround              = [git]git://github.com/tpope/vim-surround.git
 vim/bundle/syntastic             = [git]git://github.com/scrooloose/syntastic.git
 vim/bundle/tslime                = [git]git://github.com/sjl/tslime.vim.git
--- a/.hgsubstate	Mon Aug 26 11:56:19 2013 -0400
+++ b/.hgsubstate	Fri Sep 06 12:21:38 2013 -0400
@@ -2,8 +2,10 @@
 b0da16490f168f68072973b45dbc27a74fb7b529 mercurial/histedit
 4d95cb18a3b420154ef978c53de1d2e692f8343d mercurial/templates
 64981213be2efd939e6e6e109e2b32c24e95fd95 vim/bundle/AnsiEsc.vim
+7cc399a017a0f20c230a50a4f05d58ab7ef9dca4 vim/bundle/YouCompleteMe
 d64ce06650cf9b098b5a01c0db53864965d9310b vim/bundle/abolish
 f183a345a0c10caed7684d07dabae33e007c7590 vim/bundle/ack
+6c4663589e73e21e77a9ea8403dcf2bf6cf9c11c vim/bundle/argumentative
 db3707cbd8706f4bb054959ecc5cee82ac45687b vim/bundle/badwolf
 8533fffd9fbb690dfc8e334f91a10c72e35a6dce vim/bundle/clam
 949adf73ae1a82c48cd951677c055bd38a30af99 vim/bundle/clojure-static
@@ -34,7 +36,6 @@
 c6197a10ace82e0fe0c08e5cf5c017b7069a978e vim/bundle/sparkup
 01e68795c7a14b97ec2ebbd70b0fcb42d1adac61 vim/bundle/splice
 6eec2c131213850ed65fd6da494dfd1a0d620a4e vim/bundle/strftimedammit
-7ee7f774dd1288ea2e7c57b63cb069a07d425ca0 vim/bundle/supertab
 1a73f607f8f5477d6942df2eb6e7245c4864f4d3 vim/bundle/surround
 0a7b21d6021a3a565db066e7b8f7f158c918037c vim/bundle/syntastic
 2dee007ddae8156735cbae7f0cd4e0a24ba7287b vim/bundle/tslime
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/sort-scala-imports	Fri Sep 06 12:21:38 2013 -0400
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+
+import sys
+from operator import attrgetter
+
+
+def next_line():
+    return sys.stdin.readline().rstrip('\n')
+
+l = next_line()
+
+while not l.startswith('import '):
+    sys.stdout.write(l + '\n')
+    l = next_line()
+
+class ImportGroup(object):
+    def __init__(self, line):
+        self.main_line = line.rstrip()
+        self.guts = []
+
+    def slurp(self):
+        global l
+        if self.main_line.endswith('}'):
+            # This is a line like: import foo.{ a, b, c }
+            prefix, rest = self.main_line.split('{', 1)
+            guts = [item.strip() for item in
+                    rest.rstrip('}, ').split(',')]
+            guts.sort(key=lambda s: s.lower())
+            self.main_line = '%s{ %s }' % (prefix, ', '.join(guts))
+            l = next_line()
+        elif self.main_line.endswith('{'):
+            while True:
+                l = next_line()
+                if l.rstrip().endswith('}'):
+                    l = next_line()
+                    break
+                else:
+                    self.guts.append(l.strip().rstrip(','))
+        else:
+            l = next_line()
+
+    def spit(self):
+        sys.stdout.write(self.main_line + '\n')
+
+        if self.guts:
+            self.guts.sort(key=lambda g: g.lower())
+            sys.stdout.write('  ' +
+                             ',\n  '.join(self.guts) +
+                             '\n}\n')
+
+    def key(self):
+        return self.main_line.lower().replace('{', '@')
+
+imports = []
+while l.startswith('import '):
+    ig = ImportGroup(l)
+    ig.slurp()
+    imports.append(ig)
+
+imports.sort(key=lambda ig: ig.key())
+
+for i in imports:
+    i.spit()
+
+sys.stdout.write(l + '\n')
+
+for l in sys.stdin.readlines():
+    sys.stdout.write(l)
+
--- a/ctags	Mon Aug 26 11:56:19 2013 -0400
+++ b/ctags	Fri Sep 06 12:21:38 2013 -0400
@@ -1,6 +1,7 @@
 --python-kinds=cfm
 --javascript-kinds=cm
 --fields=-s
+--fields=+l
 
 --languages=-html
 --languages=-javascript
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dotcss/simple.com.css	Fri Sep 06 12:21:38 2013 -0400
@@ -0,0 +1,1 @@
+#payment-goals-message { display: none !important; }
--- a/vim/vimrc	Mon Aug 26 11:56:19 2013 -0400
+++ b/vim/vimrc	Fri Sep 06 12:21:38 2013 -0400
@@ -1057,9 +1057,10 @@
 augroup ft_scala
     au!
     au Filetype scala setlocal foldmethod=marker foldmarker={,}
+    au Filetype scala setlocal textwidth=100
     au Filetype scala compiler maven
     au Filetype scala let b:dispatch = 'mvn -B package install'
-    au Filetype scala nnoremap <buffer> <localleader>s :SortScalaImports<cr>
+    au Filetype scala nnoremap <buffer> <localleader>s mz:%!sort-scala-imports<cr>`z
     au Filetype scala nnoremap <buffer> M :call scaladoc#Search(expand("<cword>"))<cr>
     au Filetype scala vnoremap <buffer> M "ry:call scaladoc#Search(@r)<cr>
     au Filetype scala nmap <buffer> <localleader>( ysiwbi
@@ -1464,6 +1465,11 @@
 endfunction
 
 " }}}
+" YouCompleteMe {{{
+
+let g:ycm_min_num_of_chars_for_completion = 4
+
+" }}}
 
 " }}}
 " Text objects ------------------------------------------------------------ {{{