diff --git a/extension.js b/extension.js index 7b7530a..6336e7c 100644 --- a/extension.js +++ b/extension.js @@ -42,7 +42,7 @@ function activate(context) { vscode.window.showErrorMessage("next-note: failed to make directory: "+basedir); return; } - openNote(basedir +"/"+ formatWeekFilename(currentWeek())); + openNote(basedir +"/"+ formatWeekFilename(currentWeek()), true); })); context.subscriptions.push(vscode.commands.registerTextEditorCommand('extension.nextNoteOpenNextWeek', function () { @@ -68,13 +68,18 @@ exports.deactivate = deactivate; * opens filepath in the current window, creating the file if needed * * @param {String} filepath is the path of the new note file + * @param {Boolean} insertDate whether to insert the date stamp on creation * @return {undefined} */ -function openNote(filepath) { +function openNote(filepath, insertDate) { fs.access(filepath, fs.constants.R_OK | fs.constants.W_OK, (err) => { if (err) { try { - fs.writeFileSync(filepath, dateLine()); + if (insertDate) { + fs.writeFileSync(filepath, dateLine()); + } else { + fs.writeFileSync(filepath, ""); + } } catch (e) { vscode.window.showErrorMessage("next-note: failed to create "+ filepath); console.error(e); @@ -94,7 +99,7 @@ function openNote(filepath) { * @returns {String} */ function getBasedir() { - var basedir = process.env["NOTEDIR"]; + var basedir = process.env["NOTEDR"]; if (!basedir) { basedir = process.env["HOME"]+"/Notes"; diff --git a/package.json b/package.json index f10f0b0..00da06b 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "commands": [ { "command": "extension.nextNoteOpenPreviousWeek", - "title": "NextNote: Open Current Week" + "title": "NextNote: Open Previous Week" }, { "command": "extension.nextNoteOpenCurrentWeek", @@ -33,7 +33,7 @@ }, { "command": "extension.nextNoteOpenNextWeek", - "title": "NextNote: Open Current Week" + "title": "NextNote: Open Next Week" }, { "command": "extension.nextNoteInsertDate",