How to get BBedit to auto-continue a block-comment? - bbedit

I'm used to vim adding a * at the start of each line when typing a block comment in Javascript, C, or Go. I noticed that BBedit doesn't do this. Is there a way to get it to do that? I probably overlooked some setting somewhere. Thanks!

Related

Indentation in Emacs suddenly stopped working, how do I fix it?

I've been working on this source file for a while, and indenting it just fine, and now suddenly I cannot indent lines by any means (tab, M-x indent-region, etc). Restarting Emacs doesn't fix it, closing and reopening the file doesn't fix it, and the problem seems to be isolated to this particular file.
It's a cpp file if that matters. Yes, I am working in C++ mode. Yes, syntactic indentation is on.
Look at the last part of the file that you edited. Most likely Emacs is in fact indenting, but your source code is such that indenting at the position where you are trying to indent has no effect.
IOW, look at code that precedes the position where you are trying to indent. Look for syntax problems that might be making that position actually appear to be top-level. My guess is that a syntax problem is throwing off the indenting.
You can also narrow the buffer, using C-x n n, to particular parts of the buffer, to see just where indenting does what you expect and where it does not. That will help you find any syntax problems that might be interfering.

Tabbing comments in emacs py-mode?

I'm using python-mode.el, and when I try to indent comments, it always wants to put them all the way to the left. I want them indented in line with the rest of the code. Is there an easy way to achieve this?
Recent python-mode.el comes with a customizable variable
py-indent-comments
When t, comment lines are indented.
get it from
http://launchpad.net/python-mode
Also running python-mode.el and when I tab a comment it cycles through the indentation levels. What version of emacs are you using?
edit getting the behavior you describe if there is a non-space immediately following the #. I always put a space after, but it sounds like a bug to me. I'd ask on the python-mode.el list.

Is there a way for Emacs to autocorrect R commands

I'm a relatively new user to R and Emacs and was wondering if Emacs could automatically correct any R commands that i've typed wrong. I know about the alt-/, but I was more thinking along the lines of if i type read.tale, it corrects it to read.table.
Also, I was using emacs the other day and whenever i typed read.table, it showed the usage options (that bit from the help file) in the bottom bit of the window-the minibuffer?. anyway, its not there now, and i don't know what i did to make it go away.
Thanks for your help
Independently of emacs, you can examine your code with the checkUsage function in the codetools package. For example:
> foo <- function(data){
+ read.tale(data,file='temp.txt')
+ }
> checkUsage(foo)
<anonymous>: no visible global function definition for ´read.tale´
Also, you can emacs autocompletion functions (e.g. hippie-expand or dabbrev-expand) to fill in the rest of recently used function and variable names.
If you aint married to emacs, you should give Komodo edit with sciviews-R / sciviews-K a try.
So far it´s the best auto-completion coding I found for R. At least to me the configuration was much easier than emacs, particularly because of binding problems with my exotic (swiss) keyboard. sciviews-R / Komodo
EDIT: I realize this thread is still being read. So in meantinem I got to give it up for RStudio. It has really become THE editor for everyday use for most people. Nice autocompletion, available on all major OS and a really nice context help. Plus some easy export of pdf graphics and much much more. On top R Studio is easy to install – no need to worry how to fire up R from the editor.

Why isn't return bound to newline-and-indent by default on emacs

I have tried emacs on and off for a while now and every time I start emacs, I go through the same routine. Customizing. The first one is binding return to newline-and-indent. (g)Vim does this by default. Showing matching parenthesis is also done by default on (g)Vim. It is grea that I can customize emacs to my heart's content but why doesn't emacs have nice and easy defaults? For reference, I am now using Emacs 23 on a RHEL5 box.
Probably because RMS didn't want it, that and because changing long-standing defaults is just an issue of politics. Like vi, Emacs has a hard-core following and basic changes like these are minefields.
Note: if you saved your customizations, then you wouldn't have to re-do them every time...
To have those nice and easy defaults, install Emacs Starter Kit. It enables by default a bunch of useful and convenient features make even the advanced Emacs users more productive.
Otherwise, as TJ pointed out, Emacs Customization Mode (type M-x customize) allows you to save permanently any of the settings. You can even store them in a separate file from your dotemacs―(setq custom-file "~/.emacs-custom.el")―so you can use it in every computer you work on.
The title of your question doesn't really reflect what your question is (and has been answered by Trey and Torok), but I'll tell you why I like it being bound to just newline: useless whitespace. Say you are nested inside a conditional in a function etc. and hit return a couple times to leave a blank line. The blank line now has a bunch of space chars on it. Yes, you can (and I do) remove trailing whitespace before saving, but I also have visual whitespace mode on and I can see it there taunting me.

Is there any way to enable code completion for Perl in vim?

Surprisingly as you get good at vim, you can code even faster than standard IDEs such as Eclipse. But one thing I really miss is code completion, especially for long variable names and functions.
Is there any way to enable code completion for Perl in vim?
Ctrl-P (Get Previous Match) and Ctrl-N (Get Next Match) are kind of pseudo code completion. They basically search the file (Backwards for Ctrl-P, Forwards for Ctrl-N) you are editing (and any open buffers, and if you are using TAGS anything in your TAG file) for words that start with what you are typing and add a drop down list. It works surprisingly well for variables and function names, even if it isn't intellisense. Generally I use Ctrl-P as the variable or function I am looking for is usually behind in the code. Also if you keep the same copy of Vim open, it will search the files you have previously opened.
Vim 7 supports omni completion.
For example, I have this in my vimrc
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
and then, when I press Ctrl-X Ctrl-O in Insert mode, I get a dropdown list of autocomplete possibilities.
Here's an omnicfunc for perl. No idea how well it works though.
Well, Vim's generic completion mechanism is surprisingly good, just using Ctrl-N in insert mode. Also, line completion is very handy, using C-x C-l.
Also check out this vim script for perl.
The standard Ctrl+N and Ctrl+P works even better if you add the following to your ~/.vim/ftplugin/perl.vim file:
set iskeyword+=:
Then it will autocomplete module names, etc.
The .vimrc clip in one of the other answers is slightly wrong. To turn your tab key into an auto-complete key, use this code:
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
You can find this, and tons of other vim tricks in this thread at Perlmonks--which links to even more threads with lots more customizations.
You should look at the SuperTab plugin:
http://www.vim.org/scripts/script.php?script_id=1643
It let's you do completion (either the OmniCompletion or the regular completion) using tab and shift-tab instead of ^N and ^P.
https://github.com/c9s/perlomni.vim
Ctrl+N
This is explained in the Perl Hacks book, along with how to do Package completion. Highly recommended.