neilChenXie / neilChenXie.github.io

Blog, include Management, Apps, Linux, Java, BigData, Everything ^_^
1 stars 0 forks source link

atom editor #39

Open neilChenXie opened 7 years ago

neilChenXie commented 7 years ago

最好的一点,所有功能都能通过ctrl+shift+p的搜索获得;不用刻意被hot-key,搜的次数多了,自然就记住了。符合使用习惯。 #搜索引擎是未来

neilChenXie commented 7 years ago

vim-mode-plus Clipboard Bug

ctrl+c doesn't work

I use "Packages -> Vim Mode -> Settings -> Use Clipboard As Default Register" and just use the standard Vi copy/paste commands to copy in/out of Atom. I would argue that this should be the default setting for Vim Mode.

neilChenXie commented 7 years ago

Timestamp Autoinput

configured init.coffee to add a script:

atom.commands.add 'atom-workspace',
  'custom:insert-timestamp': ->
    offset = 8;
    now = new Date(new Date().getTime() + offset * 3600 * 1000);
    atom.workspace.getActiveTextEditor().insertText(now.toISOString().replace('T',' ').split('.')[0])

and then added a custom shortcut keymap.cson for markdown:

'atom-text-editor':
  'ctrl-alt-t': 'custom:insert-timestamp

Reference

neilChenXie commented 7 years ago

Paragraph Start indent

init.coffee

    textEditor = atom.workspace.getActiveTextEditor()
    # cursorPosition = textEditor.getCursorBufferPosition()
    # endColumn = textEditor.indentationForBufferRow(cursorPosition.row)
    # if textEditor.getSoftTabs() then endColumn *= textEditor.getTabLength()
    # endPosition = cursorPosition.translate([0, endColumn - cursorPosition.column])
    # textEditor.selectToBufferPosition(endPosition)
    textEditor.moveToBeginningOfLine();
    textEditor.insertText("    ");

keymap.cson

'atom-text-editor':
  'ctrl-alt-s': 'custom:insert-paragraphStart'

Reference