Notepad ++ configuration skills

Source: Internet
Author: User
Tags strtok

1. Global Variables

$ (FULL_CURRENT_PATH): E: \ my Web \ main \ welcome.html
$ (CURRENT_DIRECTORY): E: \ my Web \ main
$ (FILE_NAME): welcome.html
$ (NAME_PART): welcome
$ (EXT_PART): html
$ (NPP_DIRECTORY): the full path of notepad ++ 's directory
$ (CURRENT_WORD): word (s) you selected in Notepad ++
$ (CURRENT_LINE): current line number
$ (CURRENT_COLUMN): current column number
Second, configure the run macro ("Run" submenu of the "Run" menu)

1. Compile the currently open java source file

cmd / K cd / D $ (CURRENT_DIRECTORY) && javac $ (FILE_NAME)
2. Execute the class file corresponding to the currently opened java source file

cmd / K cd / D $ (CURRENT_DIRECTORY) && java $ (NAME_PART)
3. Compile and run the currently opened java source file

cmd / K cd / D $ (CURRENT_DIRECTORY) && javac $ (FILE_NAME) && java $ (NAME_PART)
Three, crazy transformation

1. Compile the C source code below to exec_head.exe and place it in the installation directory of notepad ++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static int buf_i = 0;
static int buf_size = 0;
static char * buf = NULL;
static void _buf_add (char c) {
if (c == -1) {
if (buf_i> 0) buf_i--;
return;
}
if (buf == NULL || buf_i == buf_size) {
buf_size + = 1024;
buf = (char *) realloc (buf, buf_size);
if (buf == NULL) exit (1);
}
buf [buf_i ++] = c;
}

static int _fgetc (FILE * file)
{
char c = fgetc (file);
if (c == '\ n') {
if (fgetc (file)! = '/' || fgetc (file)! = '/')
return EOF;
else c = fgetc (file);
}
if (c == '\ n' || c == '#') {
return EOF;
}
return c;
}

int main (int argc, char * argv [])
{
if (argc <2) return 1;
The
FILE * file = fopen (argv [1], "r");
if (! file) return 1;
The
if (fgetc (file)! = '/' || fgetc (file)! = '/' || fgetc (file)! = '#')
return 1;
The
char c = _fgetc (file);
while (c == '' || c == '\ t') c = _fgetc (file);
while (c! = EOF) {
if (c == '' || c == '\ t') {
do {c = _fgetc (file);} while (c == '' || c == '\ t');
if (c! = ';') _buf_add ('');
} else if (c == ';') {
do {c = _fgetc (file);} while (c == '' || c == '\ t');
if (c! = EOF) _buf_add (';');
} else {
_buf_add (c);
c = _fgetc (file);
}
}
fclose (file);
The
_buf_add ('\ 0');
The
char * cmd = strtok (buf, ";");
while (cmd) {
printf ("# exec:% s \ n", cmd);
system (cmd);
cmd = strtok (NULL, ";");
}
free (buf);
buf = NULL;
The
return 0;
}
2. Configure and run the macro, and set the shortcut keys Ctrl + Shift + H

cmd / K cd / D $ (CURRENT_DIRECTORY) && $ (NPP_DIRECTORY) /exec_head.exe $ (FILE_NAME)
3. If the currently opened file starts with "// #", the program will interpret the text from "// #" to "#" as a command and execute it. The command can be separated by ";"

// #
// javac Test.java;
// java Test
// #

public class Test {
public static void main (String [] args) {
System.out.println ("Hello");
}
}
4. Press the shortcut key Ctrl + Shift + H, a CMD window will pop up:

#exec: javac Test.java
#exec: java Test
Hello


 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.