Skip to content

{{filecurrent}} rather than {{linkcurrent}} #360

Answered by jdeml
jdeml asked this question in Q&A
Discussion options

You must be logged in to vote

I found a solution to my own problem using a Templater function in the quickadd Capture Format. The function was posted by stefantigro on reddit (link to reddit post):

<%* function getLastOpenFile(){ const lastActiveFile = app.workspace.lastActiveFile; 
// If the last active file is different from the current one, then it can be used 
if (lastActiveFile !== null && lastActiveFile.basename !== tp.file.title ) { const lastActiveFileBaseName = lastActiveFile.basename; console.log(`No match on last active file, using it!. (${lastActiveFileBaseName} !== ${tp.file.title})`); return lastActiveFileBaseName; } 
// If it's the same, then in the history the last opened one can be retrieved. 
const l…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@erauner12
Comment options

@jdeml
Comment options

Answer selected by jdeml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants