Giter Club home page Giter Club logo

singlecompile's Introduction

singlecompile's People

Contributors

istepura avatar johntyree avatar lazywhite avatar luochen1990 avatar martin-ueding avatar mckelvin avatar mmontu avatar racklin avatar stardiviner avatar vishesh avatar xuhdev avatar zenbro avatar zhou13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

singlecompile's Issues

How to set -std option for gcc?

Hi,
To enable C99 standard,I use command like :
:SingleCompileRun -std=c99

It can compile normally,but the output remains the same as last time executed successfully.
Is there anything wrong to use this command?

Compile gcc not support pthread

  1. Add pthread lib to the default gcc
diff --git a/autoload/SingleCompile/templates/c.vim b/autoload/SingleCompile/templates/c.vim
index 0b17339..ff93d2c 100644
--- a/autoload/SingleCompile/templates/c.vim
+++ b/autoload/SingleCompile/templates/c.vim
@@ -77,7 +77,7 @@ function! SingleCompile#templates#c#Initialize()
         call SingleCompile#SetOutfile('c', 'bcc', g:SingleCompile_common_out_file)
     endif
     call SingleCompile#SetCompilerTemplate('c', 'gcc', 'GNU C Compiler',
-                \'gcc', '-g -o $(FILE_TITLE)$', g:SingleCompile_common_run_command)
+                \'gcc', '-pthread -g -o $(FILE_TITLE)$', g:SingleCompile_common_run_command)
     call SingleCompile#SetCompilerTemplateByDict('c', 'gcc', {
                 \ 'pre-do'  : function('SingleCompile#PredoGcc'),
                 \ 'priority' : 20,
  1. BTW, how to implement compile select code?

Command-Line Args

Hello,

How to pass command-line args? I am trying to compile and run this very simple program from within Vim and see the complete output ...

#include <stdio.h>

int main(int argc, char *argv[])
{
  int i =0;

  for (; i<argc; i++) {
    printf("Arg %d is %s\n", i, argv[i]);
  }

  return 0;
}

Thanks
Naga Vijayapuram

Unable to Choose Compiler js

using eclim and vim73 I have singleCompile working for python scripts.

When I have a name.js file open I press F10 however SC correctly states I have no interpreter for this file. So I used the SCChooseCompiler command.

SingleCompiler: Error no compiler is available for this language.

I wanted to use Node.js as my compiler, but I can't appear to edit the file to add it.

Use close or delay output window

Is there a way to have a delay on the output to the console. SingleCompile is working but the console results are flashing up so quick I can't see them.

Is there a way to put a delay or let the use close the output window?

SCCompileRun issues displaying stdout whilst scanf executed

Hey,

When I compile & run my binary that executes scanf, the terminal does not display the printf statements executed previously. Example code in C is as follows:

include "stdlib.h"

include "stdio.h"

int main(int argc, char *argv[])
{
char *char_array;

printf("Type in a string\n");
scanf("%s", char_array);

return 0;
}

If I run externally as in:
!gcc -o example4 example4.c && ./example4

The terminal displays output correctly.

How to run Python3 program

I write a program in python 3.2, but when I run it using this plugn, it use python instead of python3. I wonder how to change it.

Can not work when the path contain chinese ?

My system is win7 x86.when I press F10 to excute a python script, the command window will display some error and i can see the chinese parts is messy code if the path contain chinese.

the quickfix is incorrect

Program can be compiled,
but the :cope are incorrect( syntastic also has this problem)
picture is this
http://i.imgur.com/hYCTs.png
I'm using gcc
_vimrc is
set fenc=utf-8
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
language messages zh_CN.utf-8

cannot use python2 interpreter on Arch Linux

Arch linux uses python3 as the default python interpreter (i.e. if you type python on a terminal it opens the python3 interpreter). So when I choose python from SCChooseCompiler it executes the program with python3.

Maybe python option should change to python2?

Input and output statements problem

HI,many thanks for the SingleCompile.I just found a problem but I couldn't determine whether it's a bug or just my fault.The problem is if there're some output statements(such as printf ) before input statements(such as scanf),then while I exucte :SCCompileRun,the contents of output statements won't be displayed until I've input some data(the scanf).I don't know why.

Problem with bash scripts

The following script runs OK directly from the shell:

#!/bin/bash

echo $$
ps ax | grep sh

source_dir=(/data/abc \
            /data/cde \
            /net/fgh)


for i in ${source_dir[*]}; do
    echo "Entering directory $i/.."
done

But it fails with :SCCompileRun:

temp.sh: 10: /home/mmontu/temp.sh: Syntax error: "(" unexpected

From the output before the error message it can be seen that it is being run with the following line:

13361 pts/16   S+     0:00 /bin/bash -c (sh  /home/mmontu/temp.sh; echo $? >/tmp/vESldod/386) 2>&1| tee /tmp/vESldod/387

Thus the problem is that despite the shebang indicates bash, the script is being run by sh. But it is unclear why this plugin needs to run the script in a separate shell.

LaTeX Windows support

Does SingleComplie support LaTeX on Windows?

After :SCCompileRun there is a command prompt saying:

C:\Windows\system32\cmd.exe /c (open ^"document.pdf^" 2^>^&1 ^| tee C:\Users\Nag
el\AppData\Local\Temp\VIBF1CC.tmp)
shell returned 255
Hit any key to close this window...

How to add flag '-lm'?

When using flag '-lm', it should be
gcc a.c -lm -o a
But if I use
SCCompileAF -lm
the running command is
gcc -lm a.c -o a
It is wrong.

[Feature Request] Use Job API to do Asynchronous Compiling

Thank you @xuhdev for this awesome plugin!

Would you consider using the job API provided by both Vim8 and Neovim to do Asynchronous Compiling? Compared with the current asynchronous implement, it's much more convenient and simpler, also more robust.

How do you think about that?

Handling errors in interpreted languages.

At the moment, it appears that interpreted languages don't have any real error handling and worse, don't indicate whether or not they had nonzero return values.

Example: Make a haskell/python file. Stick a bug in it on purpose. Run it.

It appears to run, but there is no indication that the interpreter failed. Quickfix window is empty as well. The errors do appear if you ViewResultAfterRun, but this isn't the default behavior and is almost certainly not how you'd want to discover errors anyway.

This is particularly annoying with runhaskell, as it produces an error list identical to ghc and works fine as a "compiler" too.

Seems to me like we should catch the error from the interpreter and treat it as a failed "compile", then clear the result buffer. What do you think?

singlecompile with objective-c

I am new to use singlecompile. is there a simple way to link objc framework such as Foundation.framework to the source file? for example, I write simple.m

#import <Foundation/Foundation.h>

int main(int argc, char *argv[]) {
    @autoreleasepool {
        NSLog(@"hello world");
    }
}

and in vim I run :SCCompile , and it occurs to these:

Undefined symbols for architecture x86_64:
  "_NSLog", referenced from:
      _main in sample-c42ea1.o
  "___CFConstantStringClassReference", referenced from:
      CFString in sample-c42ea1.o
  "_objc_autoreleasePoolPop", referenced from:
      _main in sample-c42ea1.o
  "_objc_autoreleasePoolPush", referenced from:
      _main in sample-c42ea1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I think it is the Foundation.framework is not link in link time, so I wanna know how to solve it with SingleCompile

example that calls a vimL function as compiler_command in a template

I wrote an xmlrpc service on a remote host that allows me to compile an item in dir as a vim embedded python script. That way I can easily grab the dir and filename from the current buffer when I press F9.

I am not sure of the scoping rules for vimL, can I reference a function from my .vimrc?

Cargo support

I would like to be able to set Cargo as a rust compiler.

The problem is, that cargo does not accept a filename as parameter, cargo is run using cargo build, without any file name. Using call SingleCompile#SetCompilerTemplate('rust', 'cargo', 'cargo', 'cargo', 'build', 'cargo run') therefore does not work, since it will append the current file name.

Is there a way to instruct SingleCompile to not append the filename to the build-command?

(Sorry about the empty message at first...)

Better integration with Syntastic?

I will quote myself at vim-syntastic/syntastic#779:

Ok, I think I have more clue about this problem, it happens when I have both
SingleCompile and Syntastic enabled and I compile a sample file. After compilation
with error, the errors get listed in the quickfix window and SingleCompile provide error
signs in the offending lines. Syntastic also does the same thing at the same time,
so two error sign reports happen at the same line, and this double signaling
prevents, somehow, the signs from getting cleared by both plugins.

feature request: add compiler template for vim filetype.

I find SingleCompile plugin does not support run vim script source. Even run it is not that diffcult, it can be as simple as :source %.

But I hope add into SingleCompile.
Here is what I found.
ONE: execute whole file buffer.

  • :source %
  • noremap <silent><buffer> <F9> :exec 'source '.bufname('%')<CR>

TWO: execute visual selected text. (This is awesome)

function! SourceRange() range
let tmpsofile = tempname() 
 call writefile(getline(a:firstline, a:lastline), l:tmpsofile)
execute "call delete(l:tmpsofile)
source " . l:tmpsofile
endfunction
command! -range Source <line1>,<line2>call SourceRange()

Then, for sourcing a selection:
:'<,'>Source

http://learnvimscriptthehardway.stevelosh.com/chapters/28.html

Adding compilation flags

When compiling a cpp or c file, it executes with a basic default flags for compilation. Is there any way, I can add manual compilation flags to the input?

a new source code buffer open when run finished

Here is my setting related to SingleCompile

let g:SingleCompile_showquickfixiferror = 1
let g:SingleCompile_showquickfixifwarning = 1
autocmd FileType c nmap  <F5> :SingleCompileRun <CR>
call SingleCompile#ChooseCompiler('c', 'clang')
let g:SingleCompile_showresultafterrun = 1
"Ignore messy output messages
let g:SingleCompile_silentcompileifshowquickfix = 1

The weired thing is ,when SingleCompileRun executed,the quickfix window shows the result automatically,also and a new source code buffer open horizontally .
How to disable this new -open buffer?

Close quickfix window when there are no errors

I like to use the plugin with the option g:SingleCompile_showquickfixiferror
set, which makes the quickfix window to open automatically.

But in its current form it never closes that window. I prefer to have it
closing the quickfix window when there are no more errors to display.

I've included an else clause to function s:CompileInternal(arg_list, async) on
autoload/SingleCompile.vim to get this behavior:

" show the quickfix window if error occurs, quickfix is used and
" g:SingleCompile_showquickfixiferror is set to nonzero
if (l:toret == 1 || l:toret == 3) &&
            \ g:SingleCompile_showquickfixiferror && 
            \ s:ShouldQuickfixBeUsed()
    cope
else
    ccl
endif

Probable there are some better solutions, as using some flag to indicate if the
quickfix was opened by this plugin, in order to avoid closing unrelated
content on quickfix window.

Maybe this could be add (or using an additional option) if you think it can be
useful for other people.

Thank you very much for sharing this great plugin!!

How do I compile with arguments with this plugin

Hi,
I'm using single compile for now 2 days. I'm a C programer, and so I'm programing with mains using arguments after the name of the exec (example : ./a.out "Bonjour"). But I don't know how to compile with arguments with single compile. Maybe I missed something. Can someone tell me how to do it ?

"modeline" style SCCompileAF.

It would be really helpful if there were a way to specify file-specific compiler flags. We already kind of do this with the auto detection for -lm, but it's a common case that I need to link against some random library, -lgsl -lgslcblas or -lcusparse etc and it's not worth making an entirely new compiler setting with special parameters for this one file. It also gets a bit annoying to remap keys :map <F12> <ESC>:SCCompileRunAF -lwhatever <CR> every time I open vim for a quick test of something.

What if we use a magic comment or something like vim's modelines to acheive this?

/*  SCCompileAF: -lwhatever */

Then we can just grep the file and the settings are carried between sessions automagically?

ccache Support?

I want to use ccache gcc xxx.cpp to compile my code, but still now I can't find any way to support ccache. Is there any solution to this problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.