Newbie to Atom questions


#1

How do I open files in separate tabs from the projects pane? If I have a project open on the left, it keeps opening html file selections into the same tab. If I try to drag to a new tab slot nothing happens. What if I want to search and replace something in 30 files? I think dragging from Caja works, but then what is the point of the project pane?

Also, is there a way to convert text to html paragraph tags? Either a package or regex option is fine.

I just discovered Atom, so I am brand new to the software.

Thank you!


#2

If you single-click on a file, the default is to open a pending tab indicated by an italicized title. If you double-click on the file, or if you make a change inside a pending tab, it will be made permanent until you close it.

How do you intend to tell Atom which text is to be converted?


#3

Thanks! Learning.

I would like to start with an empty file, copy text from Word, and then have Atom create paragraph tags for all paragraphs. I can do this with PSPad or Dreamweaver in Windows easily.


#4

Atom can be programmed to do anything. How comfortable are you with JavaScript or CoffeeScript?


#5

I do not have the time to customize the program. I was just asking if it could be done in the current state with regex perhaps.


#6

When it comes to GUI-based find and replace operations with regex, Atom is just as capable as Notepad++. If you’re just processing one large file, that’s perfectly fine (and I’ve done that in N++ plenty of times, myself). However, if this is a process that’s going to be repeated, the addition to Atom of a command that formats a whole document at once would be pretty simple and completely eliminate that time expenditure going forward.


#7

I am really falling in love with Atom, and have started using it in Linux and Windows exclusively. I keep customizing it more and more, and that is such a huge plus.


#8

I’m glad to hear that you changed your mind about Atom. :slight_smile: If you’re interested in discussing what you’ve done or what you wish you could do, I’m always happy to work with people who are trying to find new ways of working with Atom.


#9

I think finding a UI and Syntax theme is important. I gravitate towards light themes, but it seems like people prefer the dark ones. This is something that I may just keep changing moving forward.

Important to me:

  1. minimap - it makes getting around way easier
  2. wrap in tag - this makes it easier to add tags to content
  3. projects - I am using them now and had to change my workflow of constantly hitting folders
  4. Snippets - I figured out how to use this effectively. I really hate snippets in proprietary programs and usually just have an html file housing them…BUT this is not proprietary and they are easy to access.
  5. multiplatform - I can use the same text editor in Linux and Windows

What I missing and would love to find an alternative:

  1. Search and Replace macro - I think this may be considered keystroke macro. I have about 5 search and replace items for what could be two different macros. This is easy to do in a Windows text editor. There is a package in the list that claims to do this but it fails to install. Examples of what is in my macro:

Replace special characters with html equivalents. Add styles to paragraph tags, blockquotes, etc. Clean 2 spaces with 1 space throughout the document.

I found html-special-character-replacer and swapped the default list with my own list. Most of the stuff that I wanted to replace was special characters, but I do not need the huge list provided. Big thanks for the person that developed this package: BRiL1201. I think he can rebrand it as a search and replace tool, and provide instructions how to customize it. It would be nice if it had an option to choose between js files. This is a start for me. Manually, someone could start Atom with different js files if more than one is needed.

C:\Users\windowsusername.atom\packages\html-special-character-replacer\lib\html-special-character-replacer.js

function doreplacement(text)
{

text = text.replace(/“/g,’“’);
text = text.replace(/”/g,’”’);
text = text.replace(/…/g,’…’);
text = text.replace(/–/g,’–’);
text = text.replace(/—/g,’—’);

return text;

};


#10

I’m not sure exactly what you are talking about with “different JS files”, but here is a template you can use to customise the search and replace stuff in your own init.js file (or you can translate to CoffeeScript if you prefer).

const { CompositeDisposable } = require("atom");

function replaceFunc() {
  console.log("replacing text...");
  let editor = atom.workspace.getActiveTextEditor();
  let text = editor.getText();
  let replacedText = escapeEverything(text) // do stuff with text
  editor.setText(replacedText);
}

function escapeEverything(text) {
  return text; // you would define the actual replacements here
}

function otherReplaceFunc() {
  console.log("other command...");
}

let bindings = { // add the commands here to register them as keyboard shortcuts
  ".workspace": {
    "cmd-shift-e": "user:my-replace",
    "cmd-shift-space": "user:my-other-replace"
  }
}

let disposables = new CompositeDisposable();
disposables.add(
  // each command needs to be added here for the keybinding to work.
  atom.commands.add(".workspace", "user:my-replace", replaceFunc),
  atom.commands.add(".workspace", "user:my-other-replace", otherReplaceFunc),
  // The bindings variable is defined above. This sets up the keyboard shortcuts.
  atom.keymaps.add("user:my-replace-keybindings", bindings)
);

#11

Thanks! I was referring to the plugin html-special-character-replacer.js.