I feel like I often name files in such a way that my computer constantly beeps while I program because the tab completion is ambiguous. Before doing a lot of Unix programming, I tended to name related files with the same prefix to indicate their relation. Now I must re-think my approach to folder and file structures and names to program more effectively.
What heuristics or rules do you apply when programming to simplify tab completion? Do you use any tools to make tab completion smoother (e.g., emacs icicles)?
EDIT: Wow, thanks for the fantastic insights. I think every possible weakspot of mine was accounted for in the answers. I accepted the one that seems like the best productivity improvement, although they're all worth reading.
The name can contain up to 1023 characters including alphanumeric characters (A-Z, a-z, and 0-9), blanks, mathematical symbols (+ - = | ~ ( ) < > { } \), punctuation marks (? , . ! ; : ' " / [ ]), and the following special characters: &, %, $, #, @, ^, *, and _. For example, /etc/ftp.
Only alphanumeric characters, periods, underscores and hyphens and don't use symbols like “%”, “$”, and so forth. Keep the file names short and descriptive.
A File Naming Convention (FNC) is a framework for naming your files in a way that describes what they contain and how they relate to other files. Developing an FNC is done through identifying the key elements of the project, the important differences and commonalities between your files.
I've generally worked on projects where related files are all in the same directory, and the file names themselves are specialized to indicate their contents.
Of course, this begs the question, why are you doing tab completion on file names? If you're perusing source code, there are TAGS, CEDET, and a plethora of other utilities that will let you bypass the file name and jump directly the the function/variable you're really after.
It all depends on what you're really trying to do, and finding a particular file is usually the means to a different end.
In general,
setterm -blength 0
will disable the terminal's beep. GNU screen and some graphical terminals have their own beep notification settings.
Specifically for Bash and other Readline-using software, tab completion behavior can be changed using $INPUTRC
, /etc/inputrc
, and ~/.inputrc
configuration files. For example,
bell-style none # never ring the bell
bell-style visible # use visual bell, if available
show-all-if-ambiguous on # list all completions instead of ringing the bell
I must admit that I names my files without regard to tab completion and instead adjust my urge to hit tab until I know that I have typed enough characters to not get tab-silly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With