Vim syntax highlighting for ruby 1.9
Try the latest version from github:
http://github.com/vim-ruby/vim-ruby/blob/master/syntax/ruby.vim
It was updated in December of 2009, and seems to do the right thing with the new hash literals.
Need to refactor to the new Ruby 1.9 hash syntax
In the Ruby version 1.9 has been introduced a new syntax for hash literals whose keys are symbols. Hashes use the "hash rocket" operator to separate the key and the value:
a_hash = { :a_key => 'a_value' }
In Ruby 1.9 this syntax is valid, but whenever the key is a symbol it's also possible to write it as:
a_hash = { a_key: 'a_value' }
And as the Ruby style guide says, you should prefer to use the Ruby 1.9 hash literal syntax when your hash keys are symbols (see):
# bad
hash = { :one => 1, :two => 2, :three => 3 }
# good
hash = { one: 1, two: 2, three: 3 }
And as an additional hint: Don't mix the Ruby 1.9 hash syntax with hash rockets in the same hash literal. When you've got keys that are not symbols stick to the hash rockets syntax (see):
# bad
{ a: 1, 'b' => 2 }
# good
{ :a => 1, 'b' => 2 }
So you can try with:
service 'apache' do
supports status: true, restart: true, reload: true
end
If you want to see what's the Rubocop "way" you can run this in the command line, this will autocorrect your code only for the HashSyntax
warnings or flags:
rubocop --only HashSyntax --auto-correct
Vim(ruby):NoMethodError: undefined method `specifications'
I'm not sure if the problem is with one of the vim plugins. I just installed all the plugins you mentioned in win7 and I have no such problem. However I had a similar error reproduced when I had rubygems 1.8.5, and I tried to run a rake task. Here is a link to a forum that talks about that same rubygems error link
To find out your version, run
gem -v
The solution for us was to downgrade rubygems
gem update --system 1.7.2
EDIT:
@Tyler-long is telling me, that Ruby Gems fixed the problem, and an upgrade also fixes the bug. Then you can just do:
gem update --system
Fortran Namelist syntax highlighing in Vim?
Adding this to ~/.vimrc
allowed vim to recognise namelist files as fortran files, and the syntax highlighting that is applied is adequate:
if has("autocmd")
au BufNewFile,BufRead *.nml set filetype=fortran
au BufNewFile,BufRead *.namelist set filetype=fortran
endif
Full screen terminal application with ruby (or other languages)
This is a mode supported by most terminals through the XTerm control sequence specifications.
The specific screen-switching mode that can be activated using those specs is called the alternate screen buffer.
When you send the correct XTerm control sequence to the terminal then the terminal will switch into an alternate screen buffer. Once whatever program exits, it usually sends the commands to switch back to the original screen buffer. This way you get the effect of the application restoring your original terminal display.
The sequence for activating the alternate buffer is CSI ? 47 h
. CSI stands for Control Sequence Initiator, and it's usually ESC + [
. So by sending ESC [ ? 47 h
(without spaces) to the terminal it will switch to the alternate buffer.
You can test this by running the cat
command in your shell, hitting ESC and typing [?47h and hitting enter. You should see the screen clear (or switch to the other buffer).
The sequence to switch back to the normal screen buffer is CSI ? 47 l
, and you can test this the same way running the cat
command and typing the keys ESC [ ? 47 l
and hitting enter.
When programming complex terminal screen-based applications however, most people tend to use a library like curses or ncurses, which will take care of all the terminal handling stuff for you. See these for example:
Learning Ruby Curses
http://www.ruby-doc.org/stdlib-2.0.0/libdoc/curses/rdoc/Curses.html
I suspect a program like htop probably uses curses or ncurses too.
Related Topics
How to Use Fiddle to Pass or Return a Struct to Native Code
Compute Geo Distance in Elasticsearch
Package Configuration for Libffi Is Not Found in MACos While Installing Travis-Cli
Breaking a Large Rails App into Smaller Apps
How to Trigger Mouse Event in Capybara Test
Find Out Which Gems Require Native C Extensions from a Gemfile
Fast Fuzzy/Approximate Search in Dictionary of Strings in Ruby
How to Best Create a Random Float in a Range Between Two Floats
Carrierwave Cannot Remove Image
Testing Rake Task with Rspec with Rails Environment
How to Download a File Over Http Using Ruby
Access Translation File (I18N) from Inside Rails Model
Ruby, How to Add a Param to an Url That You Don't Know If It Has Any Other Param Already
Single Custom Param Name in Routes for Nested Resources Rails 4.1
Why Is Foreman Gem Ignoring the Port Environment Variable