electro-music.org   Dedicated to experimental electro-acoustic
and electronic music
 
 Front Page  |  Radio  |  Forum  |  Media  |  Playlists  |  Wiki
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Syntax highlight in Vim
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [16 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
ilSignorCarlo



Joined: Sep 17, 2007
Posts: 28
Location: Bologna

PostPosted: Wed Jul 16, 2008 3:02 am    Post subject: Syntax highlight in Vim Reply with quote  Mark this post and the followings unread

Hi,
I like the Vim editor and I'd like to use it efficiently with ChucK.

On the wiki page I've seen there is a syntax file to download (Ck.vim). I've followed intructions, but it doesn't seem to work.

I have Vim 7.1.
I put the file in this directory:
copy this file into /usr/share/vim/vim71/syntax

Then it says to add the following line in /usr/share/vim/filetype.vim,

au BufNewFile,BufRead *.ck setf ck

I didn't have such file, so I created it. But nothing happened.

I still see the code black on white, which is my default colour scheme. There is no auto indentation.

Any idea?

Thanks,
Carlo

_________________
Self-referential phrases, like this one, are not so funny or good for a forum signature.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Yellow Onion



Joined: Jul 14, 2008
Posts: 7
Location: Christchurch, New Zealand

PostPosted: Thu Jul 24, 2008 8:23 am    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
Then it says to add the following line in /usr/share/vim/filetype.vim,

au BufNewFile,BufRead *.ck setf ck


try /usr/share/vim/vim71/filetype.vim instead[/quote]
Back to top
View user's profile Send private message
ilSignorCarlo



Joined: Sep 17, 2007
Posts: 28
Location: Bologna

PostPosted: Thu Jul 24, 2008 9:38 am    Post subject: Reply with quote  Mark this post and the followings unread

Yellow Onion wrote:
Quote:
Then it says to add the following line in /usr/share/vim/filetype.vim,

au BufNewFile,BufRead *.ck setf ck


try /usr/share/vim/vim71/filetype.vim instead


Ok, thanks Very Happy

That was the problem. And the fact that the syntax file was Ck.vim instead of ck.vim.

Now I have coloured syntax, but no auto-indentation. Maybe it isn't supported, anyway. Is there any way to activate it?

_________________
Self-referential phrases, like this one, are not so funny or good for a forum signature.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Yellow Onion



Joined: Jul 14, 2008
Posts: 7
Location: Christchurch, New Zealand

PostPosted: Fri Jul 25, 2008 6:21 am    Post subject: Reply with quote  Mark this post and the followings unread

I'm kinda new to vim my self, but I would probably try turning on C-style indending
Back to top
View user's profile Send private message
Slinky



Joined: Jan 09, 2009
Posts: 15
Location: Sweden

PostPosted: Sun Jan 11, 2009 12:02 pm    Post subject: Reply with quote  Mark this post and the followings unread

ilSignorCarlo wrote:
Now I have coloured syntax, but no auto-indentation. Maybe it isn't supported, anyway. Is there any way to activate it?


You can also add the au BufNewFile... line to ~/.vimrc file.

As for auto-indenting, I use the following (add to your .vimrc file, at your home directory):

Code:
autocmd FileType ck  :inoremap <Tab> <Esc>{=}<C-O><C-O>a
filetype indent on
set ai


Then, when hitting the "tab" key, you get auto-indentation!

_________________
"Mortal immortals, immortal mortals, living their death and dying their life."
--Heraclitus, Fragment 62, Hippolytus Ref. Ix, 10,6
Back to top
View user's profile Send private message Visit poster's website
zynthetix



Joined: Jun 12, 2003
Posts: 838
Location: nyc
Audio files: 10
G2 patch files: 13

PostPosted: Sun Jan 11, 2009 3:45 pm    Post subject: Reply with quote  Mark this post and the followings unread

IMHO, the vim editor is the opposite of efficiency when used in context of the modern computer. It's an editor that was designed for and rooted in computers that did not have mice, windowing systems, or even computer monitors in some cases (teletypes in the ed days).

If you're on Windows, I'd recommend trying notepad++ or even gVim.

If you're on a unix-like system such an OSX or Linux, I highly recommend the acme editor from Bell-labs. All of those pesky commands and modes from vim are amazingly replaced with simple use of the mouse.
You can get it by installing the plan9 tools:
http://swtch.com/plan9port/

As for syntax highlighting, if you're familiar with photography, you know that black-and-white photographs enable the human mind to focus more the subject of the photograph since there is no color to distract the mind with.

Due to a similar effect, I recommend trying to code without syntax highlighting. You will be able to catch small errors better since the code will be more readable. It will also be less hard on your eyes for longer hours of time.

Also, a friendly disclaimer, but I am not looking to get into an editor/holy war here with anybody. Use what you feel like using. The prior statements are just my opinion after using lots of different tools and workstations extensively for a day job, etc.
Back to top
View user's profile Send private message AIM Address
Slinky



Joined: Jan 09, 2009
Posts: 15
Location: Sweden

PostPosted: Mon Jan 12, 2009 3:14 am    Post subject: Reply with quote  Mark this post and the followings unread

zynthetix wrote:
If you're on Windows, I'd recommend trying notepad++ or even gVim.


Yeah, those instructions were actually for GVim (7.1 version).

Just out of curiousity, Zynthetix, what does your desktop look like when you do stuff? I'm dying to know (as your thoughts on the subject are nearly fully opposite of mine Smile )

_________________
"Mortal immortals, immortal mortals, living their death and dying their life."
--Heraclitus, Fragment 62, Hippolytus Ref. Ix, 10,6
Back to top
View user's profile Send private message Visit poster's website
zynthetix



Joined: Jun 12, 2003
Posts: 838
Location: nyc
Audio files: 10
G2 patch files: 13

PostPosted: Mon Jan 12, 2009 5:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

This is what acme looks like in full screen mode. I am running it on OSX, note that you can't see the menu / dock when in full screen mode.

Acme is split into 2 columns. You can make windows within these columns and treat them as text editors or terminals. This is sort of like split windows in Vim. I usually work with code in the left column and directories and terminals on the right column.

Every piece of text visible can be clicked on and executed using different mouse buttons. There is no equivalent to this in other editors. Right clicking opens folders or files or finds the next occurrence of the text you clicked. Middle clicking any text executes it as if you typed it on the terminal.

To give you an idea of the work flow , the top right window is the first one that was open (as specified in a my rc file). The contents of this window is a listing of the directory you see specified in the header of the window. From there, I right clicked on 'audio_midi_test.py' in the directory listing. That opened the window you see in the left column. I also right clicked on the text 'test.py', which opened the window below it in the right column.

After that, I wrote the words "python" and "wav_test1.wav" around the text "test.py". (It is the highlighted text.) I then highlighted it with my middle mouse button (which executes text) and it ran created the terminal window in the bottom right corner and ran "python test.py wav_test1.wav".

I'm not sure my explanation is very thorough or good. There are some good tutorials in the documentation in my plan9 link above. It would take some reading to get familiar with acme, but it requires a fraction of the reading and memorization that an editor like Vim or Emacs does.


Picture 2.png
 Description:
 Filesize:  96.4 KB
 Viewed:  429 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

Picture 2.png


Back to top
View user's profile Send private message AIM Address
zynthetix



Joined: Jun 12, 2003
Posts: 838
Location: nyc
Audio files: 10
G2 patch files: 13

PostPosted: Mon Jan 12, 2009 5:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

to better illustrate, here is a comparison of Vim and acme ways of doing things off the top of my head:


Vim - moving around:
h, j, k, l, w, b, $, ^, arrow keys, etc.

acme - moving around:
click where you want to be with the mouse

Vim - page up / down:
ctrl-d, ctrl-u, ctrl-e, etc.

acme - page up / down:
up and down arrows, scroll wheel


Vim - split pane:
<esc>:sp

Acme - split pane:
Middle click the word 'New' anywhere you can see it or type it

Vim - switch between panes:
Ctrl-WW

Acme - switch between panes
hover your mouse cursor to the pane you want

Vim - execute shell command
<esc>!r <command>

Acme - execute shell command
type and middle click any text you want to run on the shell

Vim - copy and paste text:
set mark (ma), move to location (see above), set another mark (mo), <esc>:'a,'od, move to location, paste text (p). Alternatively, you could use visual mode, but I'm not getting into that.

Acme - copy and paste text:
drag select text, then middle click. You have cut the text. Click where you want to paste the text and press right mouse button at the same time. You have pasted the text.

This list goes on and on. It's amazing how a mouse and 3-6 different ways of clicking on things replace dozens of esoteric text and key commands.
Back to top
View user's profile Send private message AIM Address
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Mon Jan 12, 2009 8:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

I do find that for programs I use a lot (sound editors, text editors, web browsers....) I'll slowly shift from using the mouse a lot to gradually using more and more keyboard shortcuts; while programming I only very rarely use the mouse, in SoundForge I sometimes use it, on the web I still use it a lot.

I too, BTW, recommend Notepad++ which I found supports that exact development in usage very well at every stage so there is no real disagreement there. I do feel that keyboard shortcuts only look "esoteric" if you need to learn a few dozen at once (I'm looking at you here, Emacs), when you can simply look up one every time you notice you use that command often I found I hardly noticed the learning curve. That's just a note on my own usage, not some great universal truth. I'm not interested in editor wars at all either though I do like to hear about the advantages of different ones (and have actually been trying to get into terminal-mode Emacs because I do suspect it might end up being faster for me in the end).

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 373
G2 patch files: 100

PostPosted: Tue Jan 13, 2009 10:18 am    Post subject: Reply with quote  Mark this post and the followings unread

Acme looks interesting. I personally feel that we need to advance beyond the mouse before I'll start to forget about keyboard shortcuts - the mouse is to much of an extra roadblock between my brain and the computer. I have great hopes for touch screen, once it becomes more cheap and generally available.

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Slinky



Joined: Jan 09, 2009
Posts: 15
Location: Sweden

PostPosted: Tue Jan 13, 2009 11:52 am    Post subject: Reply with quote  Mark this post and the followings unread

The Acme concept sure looks interesting. And I like the very minimal window manager theme, looks something like Ion or Ratpoison.

But to me the mouse really gets in the way. It breaks my focus and "flow" of using the computer. It's like a minor context switch in task processing, something like someone interrupting ever so often. That's why I like Vim. It's second nature by now. Copy-pasting is esc-v-move cursor to the end of the area-y-move cursor to new place-p. By the time I take my hands off the keyboard and grab the mouse, I'm basically done with copying and almost with pasting.

The focus-issue is also why I can't use high-contrast screen when coding, dark backgrounds with syntax highlighting work best for me. But that's just me.

Anyway, I say: let each use the tool they are most efficient with! "The best tool for the job" is the key. And how does one find these new tools? Through discussions about editors etc., those are often quite heated ones, but that must not always be the case Smile

Antimon wrote:
Acme looks interesting. I personally feel that we need to advance beyond the mouse before I'll start to forget about keyboard shortcuts - the mouse is to much of an extra roadblock between my brain and the computer. I have great hopes for touch screen, once it becomes more cheap and generally available.


(Now I'm gonna be off topic a bit... feel free to skip...)
General-purpose, adaptive touch screens like they use in Star Trek (TNG, DS9, Voyager) with the "LCARS" UI - now that would be something!

Basically those are just a touch-sensitive portable screens, capable of displaying the best UI for whatever purpose and not being limited to some given windowing paradigm, toolkits, or lack thereof. Yet, they have a standardized look. Although it's fiction, it's actually a very clever idea which I hope to see become reality.

When Sony demoed flexible OLED screens at CES, I heard they had also shown some of their ideas how an upcoming mobile computer could look like. And the form factor? Like the aforementioned Star Trek PADDs, just a screen, more or less!

What a long reply - back to ChucKing now.

_________________
"Mortal immortals, immortal mortals, living their death and dying their life."
--Heraclitus, Fragment 62, Hippolytus Ref. Ix, 10,6
Back to top
View user's profile Send private message Visit poster's website
zynthetix



Joined: Jun 12, 2003
Posts: 838
Location: nyc
Audio files: 10
G2 patch files: 13

PostPosted: Tue Jan 13, 2009 5:29 pm    Post subject: Reply with quote  Mark this post and the followings unread

In response to the "mouse getting in the way," I know exactly where you guys are coming from. I increased my productivity on the keyboard a lot by learning the Dvorak keymap in addition to the Qwerty keymap for touch-typing. I also hacked a lot of the scripting language called "autohotkey" over the past couple years to speed up my productivity with macros.

Despite all of that, I gave acme a shot. I ran out of major things to learn from unix and it's tools, so I decided to really dig into it's successor. After all, I reason that the guys who either directly made these editors or heavily inspired them might have a good shot at improving the concepts after some 30+ years of using them.

Here is what they have to say about their new tools requiring mouse use:
http://netlib.bell-labs.com/wiki/plan9/Mouse_vs._keyboard/index.html

Here is an exceprt:

Quote:

The most common complaint is that using the mouse is slow compared with cursoring around, whether via arrow keys or via hjkl (in vi, etc.). This simply isn't true. The mouse seems slow but is actually faster:

* http://www.asktog.com/TOI/toi06KeyboardVMouse1.html
* http://www.asktog.com/TOI/toi22KeyboardVMouse2.html
* http://www.asktog.com/SunWorldColumns/S02KeyboardVMouse3.html

The basic summary is cursoring around required a higher level of mental planning to organize the interaction, which apparently obscures the perception of the passage of time--think of being deeply engaged in something and being surprised when you look at a clock-- whereas the use of the mouse was done at a lower, mechanical level that left the mind free for higher things, such as complaining about the mouse.


It's funny, but after years of learning ed, vi, vim, emacs, gvim, etc. I was very against the mouse. Then I started using tools that use it very effectively (much more so than basic context menus, etc.). While continuing to be forced to use those terminal tools on a near-daily basis, I suddenly perceive them as slow now that I have something fair to compare them against.

To adhere to my previous statements, I'm going to retire from commenting on the thread anymore. (I don't want to make this a cold war.) In conclusion, you will be far more happy and (therefore) productive using whatever editor you like. Being productive is the important part here.

Also, apologies to ilSignorCarlo, my additions to this thread have been unnecessary and tangential to the original question. By all means, spend more time using ChucK than playing with new editors, and have fun doing so.
Back to top
View user's profile Send private message AIM Address
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Tue Jan 13, 2009 8:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

Interesting, but I'm sceptical. To me these texts seem to ignore that in practice mouse operations will be interspersed between regular typing. It also seems to focus on word processors; not text editors. Personally I never print anything and leave layout to professionals so I have no use for word processors at all. I'm doubly sceptical about this because it's apparently the result of Apple's research into interfaces. I recognise that many people like Apple's interfaces but for me they simply don't work.

I'm especially sceptical about graphical interfaces for musical applications. I find I can listen to music in more detail with my eyes closed which was one reason to abstain from using graphical feedback at all in my own sequencer but before that I was already using things like wave editors with my eyes closed, using hotkeys. With the mouse you will always have to look at the screen, making you listen in a different way.

Interestingly on a different page ( http://www.asktog.com/columns/035SquanAdv.html ) the same guy says;

Quote:

The clutter of words, icons, and buttons that obscure our screens today are the result of the severely limited vocabulary of the mouse. The only word it knows is "click," so you have to find an instance of the word you want to convey to the computer, then say "click" while you hover over it.

Consider how many words you would have to paste up in your office to be able to carry out a conversation using this method. And consider how slow and frustrating that conversation would be.


Admittedly he says this in order to plead for another type of GUI, but still, this is very much how I perceive the GUI on most modern OS's; cluttered and obscure.

So; I'm not sold on this, at least not based on these texts.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 270

PostPosted: Wed Jan 14, 2009 3:04 am    Post subject: Reply with quote  Mark this post and the followings unread

Hmmm, I'm not going to jump into the fray of whatever this thread is about, I just wanted to chime in and say that I like vim a lot. I use it to edit HTML and Perl source, and it's to me kind of nostalgic. I like it if only for the nostalgia of it. For ChucK I use miniAudicle though. Now back to whatever this thread is about... Smile (I should have read it but hey, it's late and I'm tired)...
_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Jan 14, 2009 11:19 am    Post subject: Reply with quote  Mark this post and the followings unread

Last night I thought about the linked articles some more.

This finding (about replacing "|" with "e") is really quite interesting. One thing I tried is how long the same replacement would take me. For a screen worth of text, using just the keyboard to navigate the menu of the standard Gnome Texteditor that's under 10 seconds. Of course I cheated and used the build in search&replace.

I know that's not "fair" but it does point out that this test is rather synthetic, it's really quite rare to have to replace many instances of a single character with a another single character. Most notably; entering a single character many times over can easily be done with a single finger on the keyboard. I wonder what would happen if instead of that the test would involve the need to enter a short function, including characters that need modifiers to type and indentation. If we do assume that it takes 2 seconds to locate the mouse, how many does it take to move the hand back?

I also noted that this test only compared between using the cursor keys and the mouse yet didn't go into page-up/down keys, the influence of the keyboard repeat-rate/delay settings or "jump to line" commands. For larger files, if we know what line we want to jump to (for example because of a error we got) I find it quite hard to believe that the mouse will be faster.

He rightly points out that higher level commands will take more mental overhead as well, taking some time off their usefulness but clearly that's sometimes a fair trade, for example in the case of a command to replace hundreds of letters with a different character.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [16 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Log in
Username:     Password:      Log me on automatically each visit    


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2026 by electro-music.org