zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.87k stars 1.17k forks source link

Q: How to check/change compiler options? #1179

Open indianakernick opened 6 years ago

indianakernick commented 6 years ago

When I create a new C++ file.

micro test.cpp

and write some C++17 code.

template <int... N>
struct sum {
  static constexpr int value = (N + ...);
};

When I save the file by pressing Ctrl-S, the code is compiled and I get a warning,

Fold expressions are a C++17 extension

I'd rather not get this warning. Is there so way that I can see the compiler options that micro is using and change them? I'd like to pass the flag -std=c++17 (and maybe -Wall -Wextra -pedantic if they aren't already) to the compiler. I couldn't find any mention of this in the documentation.

Commit hash: 1856891 OS: MacOS Terminal: iTerm2

djmzp commented 6 years ago

I believe the way to do this is by editing the linter.lua plugin file directly: https://github.com/zyedidia/micro/blob/d2b51a59d6468bd895d93021cd333769b9b8e173/runtime/plugins/linter/linter.lua#L24-L25 Just change the parameters passed to gcc in the lint() function call.

Maybe in the future adding a linter-specific configuration file of some sort to facilitate this kind of customization should be considered. Right now, this is the only way (as far as I know).

liorean commented 2 years ago

Where can this linter.lua be found? It's not in ~/.config/micro/plug, and a quick find command gave me no results.

dustdfg commented 10 months ago

Where can this linter.lua be found? It's not in ~/.config/micro/plug, and a quick find command gave me no results.

As written in README of the one of the parents of the file it is embedded to go binary.

README:

Runtime files for Micro

This directory will be embedded in the Go binary for portability, but it may just as well be put in ~/.config/micro. If you would like to make your own colorschemes and syntax files, you can put them in ~/.config/micro/colorschemes and ~/.config/micro/syntax respectively.

Can it be changed by manually placing the copy of edited lint file there? I tried. Now I get the following message each time I open micro. And it doesn't work, it still gives me errors about c++ concepts as wrong syntax:

linter:1: attempt to call a non-function object
stack traceback:
    linter:1: in main chunk
    [G]: ?

Press enter to continue

P.S The issues is old so if someone know the solution please say it...