Git Product home page Git Product logo

ved's Introduction

Ved

A small and fast text editor written in V

Screenshot of the editor

Patreon-badge GitHub Workflow Status (event)

This is pre-alpha software.

I've been using Ved as my main editor since June 2017 (it was re-written in V in June 2018).

It may not work for everyone. There are currently limitations that must be worked around. We are working on slowly improving the ved stability and user experience.

To configure the editor, please see the configuration section.

Building from source

First you need to install V. This will take a couple of seconds.

git clone https://github.com/vlang/ved
cd ved
v .
./ved

Ved should build in under a second.

By default V's built-in font rendering is used, but there's an option to use freetype, which may provide better rendering for some users:

v -d use_freetype .

To use freetype, it must first be installed on your system. Follow the steps for your platform below.

Ubuntu:

sudo apt install libfreetype6-dev libx11-dev libxrandr-dev mesa-common-dev libxi-dev libxcursor-dev

Fedora:

sudo dnf install freetype-devel libXcursor-devel libXi-devel

Arch:

pacman -S freetype2

macOS:

brew install freetype

Windows:

v setup-freetype

Communities:

Discord (primary community): https://discord.gg/vlang. Join the #ved channel.

Main features

  • Small size (~ 1 MB binary, builds in <1s)
  • Hardware accelerated text rendering
  • High performance (scrolling through 300k lines with syntax highlighting without any lag)
  • WIP Vim mode
  • Easy integration with any compiler/build system
  • Go to definition
  • Fuzzy file finder
  • Fast search
  • Integration with git
  • Built-in time management system (based on Pomodoro)
  • Global bring-to-front key
  • Split view
  • Workspaces
  • Cross-platform (Windows, macOS, GNU/Linux)

Planned features

  • True vim mode (current implementation only implements a small subset of vim's features)
  • Emacs keybindings
  • Nano keybindings
  • Word wrap
  • Better syntax highlighting

Configuration

Ved creates a settings directory in $HOME/.ved where it stores workspaces, sessions, tasks, and the configuration file. The configuration file is simply a TOML file called conf.toml. It provides a way to change some basic settings and the editor colors.

If you don't want to touch the config file, you never have to! Ved does not create it by itself and it provides sensible defaults to get you started. If you are more adventurous, here is an example configuration file that contains all of the possible settings:

# To get started, create a file called "conf.toml" in $HOME/.ved
# Most of the settings are contained inside this "editor" table.
[editor]
dark_mode = false       # Ved comes with a light and dark mode built-in.
cursor = 'variable'     # Ved has three variants: Variable, block, and beam. You are probably used to "variable" or "beam".
text_size = 18          # ┌───────────────────────────────────────────────────┐
line_height = 20        # │ These *can* be edited, but you probably shouldn't │
char_width = 8          # └───────────────────────────────────────────────────┘
tab_size = 4            # Ved uses tab characters (\t). This settings changes how many spaces a tab should be displayed as
backspace_go_up = true  # If set to true, hitting the backspace doesn't do anything when you reach the beginning of the line

# If you do not like ved's default colorscheme, or you just want
# something new, edit the "colors" table. Ved uses a form of base16
# to control syntax and editor highlighting. Please note that due
# to ved's very minimal highlighting, base16 themes copied off of
# the internet are not going to look like very much like their
# screenshots.
[colors]
base00 = "efecf4"
base01 = "e2dfe7"
base02 = "8b8792"
base03 = "7e7887"
base04 = "655f6d"
base05 = "585260"
base06 = "26232a"
base07 = "19171c"
base08 = "be4678"
base09 = "aa573c"
base0A = "a06e3b"
base0B = "2a9292"
base0C = "398bc6"
base0D = "576ddb"
base0E = "955ae7"
base0F = "bf40bf"

Basic usage

Ved works best with workspaces (directories with code). You can have multiple workspaces and quickly switch between them with C [ and C ].

To open multiple workspaces, run

ved path/to/project1 path/to/project2

Key bindings:

C is on macOS, Ctrl on all other systems.

C q q  exit the editor
C o    open a file
C s    save
C r    reload current file
C p    open ctrlp (fuzzy search)
/      search in current file
C g    copy current file's path to clipboard
t      go to the previous file
gd     go to definition

C c    git commit -am
C -    git diff
?      git grep (search across all files in current workspace)

C u    build current project (build instructions must be located in "build")
C y    alternative build of the current project (build instructions must be located in "build2")
C 1    switch to Ved from any other application (only on macOS for now)

C d    go to the previous split
C e    go to the next split
C [    go to the previous workspace
C ]    go to the next workspace

C a    start a new task
C t    show the Timer/Pomodoro window


Supported vim bindings:

j k h l         down, up, left, right (moves cursor)
C-F C-B         page down, page up
L H             go to top/bottom of the page
w b             next/previous word
dw de cw ce     delete word
di ci           smart delete
A I             go to start/end of line, insert mode
o O             new line below/above, insert mode
v               selection mode
zz              center current line
y d p J         yank, delete, paste, join lines
.               repeat last action
< >             indent right/left
/ * n           search, search for word under cursor, next occurence
gg G            go to the beginning/end of the file
x r             delete/replace character under cursor
C-n             autocomplete

ved's People

Contributors

btbytes avatar chanbakjsd avatar chaosunity avatar darenliang avatar delta456 avatar gaetgu avatar georgels avatar gladear avatar gromain avatar henrixounez avatar jalonsolov avatar kuplynx avatar lubiedo avatar medvednikov avatar mitjafelicijan avatar mkv27 avatar nikeedev avatar shove70 avatar soonoo avatar spaceface777 avatar spytheman avatar stunxfs avatar tpanj avatar trufae avatar ttytm avatar unknown-v avatar uwekrueger avatar vbrazo avatar wertzui123 avatar yuyi98 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ved's Issues

Can't run VID

v-0.1.29\v\examples\vid-master\vid-master>v run vid.v
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
vid.v:62:2: error: unknown type `View`
   60 |     splits_per_workspace int
   61 |     page_height      int
   62 |     views            []View
      |     ~~~~~~~~~~~~~~~~~~~~~~~
   63 |     cur_split        int
   64 |     view             &View
vid.v:64:2: error: unknown type `View`
   62 |     views            []View
   63 |     cur_split        int
   64 |     view             &View
      |     ~~~~~~~~~~~~~~~~~~~~~~
   65 |     mode             EditorMode
   66 |     just_switched    bool // for keydown/char events to avoid dup keys
vid.v:86:2: error: unknown type `Timer`
   84 |     chunks           []Chunk
   85 |     is_building      bool
   86 |     timer            Timer
      |     ~~~~~~~~~~~~~~~~~~~~~~
   87 |     task_start_unix  u64
   88 |     cur_task         string
vid.v:98:2: error: unknown type `Config`
   96 |     gg_lines         []string
   97 |     gg_pos           int
   98 |     cfg              Config
      |     ~~~~~~~~~~~~~~~~~~~~~~~
   99 | }
  100 |
vid.v:173:10: error: unknown method: `Config.init_colors`
  171 |     }
  172 |     vid.handle_segfault()
  173 |     vid.cfg.init_colors()
      |             ~~~~~~~~~~~~~
  174 |     vid.page_height = size.height / vid.line_height - 1
  175 |     // TODO V keys only
vid.v:198:14: error: unknown function: new_timer
  196 |     })
  197 |         println('FULL SCREEN=${!is_window}')
  198 |     vid.timer = new_timer(vid.vg)
      |                 ~~~~~~~~~~~~~~~~~
  199 |     vid.load_all_tasks()
  200 |
vid.v:199:6: error: unknown method: `Vid.load_all_tasks`
  197 |         println('FULL SCREEN=${!is_window}')
  198 |     vid.timer = new_timer(vid.vg)
  199 |     vid.load_all_tasks()
      |         ~~~~~~~~~~~~~~~~
  200 |
  201 |     // TODO linux and windows
vid.v:223:13: error: unknown method: `View.open_file`
  221 |             vid.add_workspace(workspace)
  222 |             vid.open_workspace(0)
  223 |             vid.view.open_file(path)
      |                      ~~~~~~~~~~~~~~~
  224 |         }
  225 |     }
vid.v:306:19: error: mismatched types `void` and `void`
  304 |     now := time.now()
  305 |     // Coords
  306 |     y := (vid.view.y - vid.view.from) * vid.line_height + vid.line_height
      |                      ^
  307 |     // Cur line
  308 |     line_x := split_width * (vid.cur_split - from) + vid.view.padding_left + 10
vid.v:308:73: error: mismatched types `void` and `any_int`
  306 |     y := (vid.view.y - vid.view.from) * vid.line_height + vid.line_height
  307 |     // Cur line
  308 |     line_x := split_width * (vid.cur_split - from) + vid.view.padding_left + 10
      |                                                                            ^
  309 |     vid.vg.draw_rect(line_x, y - 1, split_width - vid.view.padding_left - 10, vid.line_height, vid.cfg.vcolor)
  310 |     // V selection
vid.v:309:29: error: mismatched types `void` and `any_int`
  307 |     // Cur line
  308 |     line_x := split_width * (vid.cur_split - from) + vid.view.padding_left + 10
  309 |     vid.vg.draw_rect(line_x, y - 1, split_width - vid.view.padding_left - 10, vid.line_height, vid.cfg.vcolor)
      |                                ^
  310 |     // V selection
  311 |     mut v_from := vid.view.vstart + 1
vid.v:311:32: error: mismatched types `void` and `any_int`
  309 |     vid.vg.draw_rect(line_x, y - 1, split_width - vid.view.padding_left - 10, vid.line_height, vid.cfg.vcolor)
  310 |     // V selection
  311 |     mut v_from := vid.view.vstart + 1
      |                                   ^
  312 |     mut v_to := vid.view.vend + 1
  313 |     if view.vend < view.vstart {
vid.v:312:28: error: mismatched types `void` and `any_int`
  310 |     // V selection
  311 |     mut v_from := vid.view.vstart + 1
  312 |     mut v_to := vid.view.vend + 1
      |                               ^
  313 |     if view.vend < view.vstart {
  314 |         // Swap start and end if we go beyond the start
vid.v:315:26: error: mismatched types `void` and `any_int`
  313 |     if view.vend < view.vstart {
  314 |         // Swap start and end if we go beyond the start
  315 |         v_from = vid.view.vend + 1
      |                                ^
  316 |         v_to = vid.view.vstart + 1
  317 |     }
vid.v:316:26: error: mismatched types `void` and `any_int`
  314 |         // Swap start and end if we go beyond the start
  315 |         v_from = vid.view.vend + 1
  316 |         v_to = vid.view.vstart + 1
      |                                ^
  317 |     }
  318 |     for yy := v_from; yy <= v_to; yy++ {
vid.v:318:34: error: invalid operation: ++ (non-numeric type `void`)
  316 |         v_to = vid.view.vstart + 1
  317 |     }
  318 |     for yy := v_from; yy <= v_to; yy++ {
      |                                     ~~
  319 |         vid.vg.draw_rect(line_x, (yy - vid.view.from) * vid.line_height,
  320 |         split_width - vid.view.padding_left, vid.line_height, vid.cfg.vcolor)
vid.v:319:32: error: mismatched types `void` and `void`
  317 |     }
  318 |     for yy := v_from; yy <= v_to; yy++ {
  319 |         vid.vg.draw_rect(line_x, (yy - vid.view.from) * vid.line_height,
      |                                      ^
  320 |         split_width - vid.view.padding_left, vid.line_height, vid.cfg.vcolor)
  321 |     }
vid.v:323:19: error: unknown method: `View.line`
  321 |     }
  322 |     // Tab offset for cursor
  323 |     line := vid.view.line()
      |                      ~~~~~~
  324 |     mut cursor_tab_off := 0
  325 |     for i := 0; i < line.len && i < vid.view.x; i++ {
vid.v:325:23: error: unknown selector expression
  323 |     line := vid.view.line()
  324 |     mut cursor_tab_off := 0
  325 |     for i := 0; i < line.len && i < vid.view.x; i++ {
      |                          ~~~
  326 |         // if rune != '\t' {
  327 |         if int(line[i]) != vid.cfg.tab {
vid.v:327:17: error: type `void` does not support indexing
  325 |     for i := 0; i < line.len && i < vid.view.x; i++ {
  326 |         // if rune != '\t' {
  327 |         if int(line[i]) != vid.cfg.tab {
      |                       ^
  328 |             break
  329 |         }
vid.v:340:19: error: ! operator can only be used with bool types
  338 |         v := vid.views[i]
  339 |         mut name := v.short_path
  340 |         if v.changed && !v.path.ends_with('/out') {
      |                         ^
  341 |             name = '$name [+]'
  342 |         }
vid.v:341:10: error: cannot assign `string` to `name` of type `void`
  339 |         mut name := v.short_path
  340 |         if v.changed && !v.path.ends_with('/out') {
  341 |             name = '$name [+]'
      |                   ~~
  342 |         }
  343 |         vid.vg.draw_text(vid.split_x(i - from) + v.padding_left + 10, 1, name, vid.cfg.file_name_cfg)
vid.v:343:10: error: unknown method: `gg.Context.draw_text`
  341 |             name = '$name [+]'
  342 |         }
  343 |         vid.vg.draw_text(vid.split_x(i - from) + v.padding_left + 10, 1, name, vid.cfg.file_name_cfg)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  344 |     }
  345 |     // Git diff stats
vid.v:347:10: error: unknown method: `gg.Context.draw_text`
  345 |     // Git diff stats
  346 |     if vid.git_diff_plus != '+' {
  347 |         vid.vg.draw_text(vid.win_width - 400, 1, vid.git_diff_plus, vid.cfg.plus_cfg)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  348 |     }
  349 |     if vid.git_diff_minus != '-' {
vid.v:350:10: error: unknown method: `gg.Context.draw_text`
  348 |     }
  349 |     if vid.git_diff_minus != '-' {
  350 |         vid.vg.draw_text(vid.win_width - 350, 1, vid.git_diff_minus, vid.cfg.minus_cfg)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  351 |     }
  352 |     // Workspaces
vid.v:356:9: error: unknown method: `gg.Context.draw_text`
  354 |     cur_space := vid.workspace_idx + 1
  355 |     space_name := short_space(vid.workspace)
  356 |     vid.vg.draw_text(vid.win_width - 220, 1, '[$space_name]', vid.cfg.file_name_cfg)
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  357 |     vid.vg.draw_text(vid.win_width - 150, 1, '$cur_space/$nr_spaces', vid.cfg.file_name_cfg)
  358 |     // Time
vid.v:357:9: error: unknown method: `gg.Context.draw_text`
  355 |     space_name := short_space(vid.workspace)
  356 |     vid.vg.draw_text(vid.win_width - 220, 1, '[$space_name]', vid.cfg.file_name_cfg)
  357 |     vid.vg.draw_text(vid.win_width - 150, 1, '$cur_space/$nr_spaces', vid.cfg.file_name_cfg)
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  358 |     // Time
  359 |     vid.vg.draw_text(vid.win_width - 50, 1, now.hhmm(), vid.cfg.file_name_cfg)
vid.v:359:9: error: unknown method: `gg.Context.draw_text`
  357 |     vid.vg.draw_text(vid.win_width - 150, 1, '$cur_space/$nr_spaces', vid.cfg.file_name_cfg)
  358 |     // Time
  359 |     vid.vg.draw_text(vid.win_width - 50, 1, now.hhmm(), vid.cfg.file_name_cfg)
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  360 |     // vid.vg.draw_text(vid.win_width - 550, 1, now.hhmmss(), file_name_cfg)
  361 |     // vim top right next to current time
vid.v:374:10: error: unknown method: `gg.Context.draw_text`
  372 |         task_x := vid.win_width - split_width - task_text_width - 10
  373 |         // vid.timer.vg.draw_text(task_x, 1, vid.timer.cur_task.to_upper(), file_name_cfg)
  374 |         vid.vg.draw_text(task_x, 1, vid.cur_task, vid.cfg.file_name_cfg)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  375 |         // Draw current task time
  376 |         task_time_x := (vid.nr_splits - 1) * split_width - 50
vid.v:377:10: error: unknown method: `gg.Context.draw_text`
  375 |         // Draw current task time
  376 |         task_time_x := (vid.nr_splits - 1) * split_width - 50
  377 |         vid.vg.draw_text(task_time_x, 1, '${vid.task_minutes()}m',
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  378 |             vid.cfg.file_name_cfg)
  379 |     }
vid.v:392:35: error: mismatched types `void` and `void`
  390 |     }
  391 |     // Cursor
  392 |     cursor_x := line_x + (vid.view.x + cursor_tab_off * vid.cfg.tab_size) * vid.char_width
      |                                      ^
  393 |     vid.vg.draw_empty_rect(cursor_x, y - 1, vid.char_width, vid.line_height, vid.cfg.cursor_color)
  394 |     // query window
vid.v:393:37: error: mismatched types `void` and `any_int`
  391 |     // Cursor
  392 |     cursor_x := line_x + (vid.view.x + cursor_tab_off * vid.cfg.tab_size) * vid.char_width
  393 |     vid.vg.draw_empty_rect(cursor_x, y - 1, vid.char_width, vid.line_height, vid.cfg.cursor_color)
      |                                        ^
  394 |     // query window
  395 |     if vid.mode == .query {
vid.v:396:7: error: unknown method: `Vid.draw_query`
  394 |     // query window
  395 |     if vid.mode == .query {
  396 |         vid.draw_query()
      |             ~~~~~~~~~~~~
  397 |     }
  398 | }
vid.v:413:36: error: mismatched types `void` and `int`
  411 |     // Lines
  412 |     mut line_nr := 1// relative y
  413 |     for j := view.from; j < view.from + vid.page_height && j < view.lines.len; j++ {
      |                                       ^
  414 |         line := view.lines[j]
  415 |         if line.len > 5000 {
vid.v:415:3: error: type `void` does not support indexing
  413 |     for j := view.from; j < view.from + vid.page_height && j < view.lines.len; j++ {
  414 |         line := view.lines[j]
  415 |         if line.len > 5000 {
      |         ~~
  416 |             panic('line len too big! views[$i].lines[$j] ($line.len) path=$vid.view.path')
  417 |         }
vid.v:416:56: error: unknown selector expression
  414 |         line := view.lines[j]
  415 |         if line.len > 5000 {
  416 |             panic('line len too big! views[$i].lines[$j] ($line.len) path=$vid.view.path')
      |                                                                 ~~~
  417 |         }
  418 |         x := split_x + view.padding_left
vid.v:422:23: error: mismatched types `void` and `any_int`
  420 |         // Error bg
  421 |         if view.error_y == j {
  422 |             vid.vg.draw_rect(x + 10, y - 1, split_width - view.padding_left - 10, vid.line_height, vid.cfg.errorbgcolor)
      |                                ^
  423 |         }
  424 |         // Line number
vid.v:425:20: error: mismatched types `void` and `any_int`
  423 |         }
  424 |         // Line number
  425 |         line_number := j + 1
      |                          ^
  426 |         vid.vg.draw_text(x+3, y, '$line_number', vid.cfg.line_nr_cfg)
  427 |         // Tab offset
vid.v:426:10: error: unknown method: `gg.Context.draw_text`
  424 |         // Line number
  425 |         line_number := j + 1
  426 |         vid.vg.draw_text(x+3, y, '$line_number', vid.cfg.line_nr_cfg)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  427 |         // Tab offset
  428 |         mut line_x := x + 10
vid.v:428:19: error: mismatched types `void` and `any_int`
  426 |         vid.vg.draw_text(x+3, y, '$line_number', vid.cfg.line_nr_cfg)
  427 |         // Tab offset
  428 |         mut line_x := x + 10
      |                         ^
  429 |         mut nr_tabs := 0
  430 |         // for k := 0; k < line.len; k++ {
vid.v:437:4: error: operator += not defined on left operand type `void`
  435 |             }
  436 |             nr_tabs++
  437 |             line_x += vid.char_width * vid.cfg.tab_size
      |             ~~~~~~
  438 |         }
  439 |         // Number of chars to display in this view
vid.v:440:11: error: unknown selector expression
  438 |         }
  439 |         // Number of chars to display in this view
  440 |         if line.len > 0 {
      |                 ~~~
  441 |             // mut max := (split_width - view.padding_left - vid.char_width * TAB_SIZE *
  442 |             // nr_tabs) / vid.char_width - 1
vid.v:451:6: error: assignment mismatch: 1 variable(s) but `limit()` returns 0 value(s)
  449 |                 // max = line.len
  450 |             }
  451 |             s := line.limit(max)
      |               ~~
  452 |             if view.hl_on {
  453 |                 vid.draw_line(line_x, y, s)// SYNTAX HL
vid.v:456:12: error: unknown method: `gg.Context.draw_text`
  454 |             }
  455 |             else {
  456 |                 vid.vg.draw_text(line_x, y, line, vid.cfg.txt_cfg)// NO SYNTAX
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  457 |             }
  458 |         }
vid.v:464:88: error: mismatched types `void` and `int`
  462 |
  463 | fn (vid &Vid) max_chars(nr_tabs int) int {
  464 |     width := vid.split_width() -vid.view.padding_left - vid.char_width * vid.cfg.tab_size * nr_tabs
      |                                                                                           ^
  465 |     return width / vid.char_width - 1
  466 | }
vid.v:465:15: error: mismatched types `void` and `int`
  463 | fn (vid &Vid) max_chars(nr_tabs int) int {
  464 |     width := vid.split_width() -vid.view.padding_left - vid.char_width * vid.cfg.tab_size * nr_tabs
  465 |     return width / vid.char_width - 1
      |                  ^
  466 | }
  467 |
vid.v:481:10: error: unknown method: `gg.Context.draw_text`
  479 |     if line.contains('[32m') &&
  480 |     line.contains('PASS') {
  481 |         vid.vg.draw_text(x, y, line[5..], vid.cfg.green_cfg)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  482 |         return
  483 |     }
vid.v:486:10: error: unknown method: `gg.Context.draw_text`
  484 |     else if line.contains('[31m') &&
  485 |     line.contains('FAIL') {
  486 |         vid.vg.draw_text(x, y, line[5..], vid.cfg.red_cfg)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  487 |         return
  488 |     //} else if line[0] == `-` {
vid.v:539:23: error: unknown function: is_alpha_underscore
  537 |         }
  538 |         // Key
  539 |         for i < line.len && is_alpha_underscore(int(line[i])) {
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  540 |             i++
  541 |         }
vid.v:551:10: error: unknown method: `gg.Context.draw_text`
  549 |     }
  550 |     if vid.is_ml_comment {
  551 |         vid.vg.draw_text(x, y, line, vid.cfg.comment_cfg)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  552 |         return
  553 |     }
vid.v:556:10: error: unknown method: `gg.Context.draw_text`
  554 |     if vid.chunks.len == 0 {
  555 |         // println('no chunks')
  556 |         vid.vg.draw_text(x, y, line, vid.cfg.txt_cfg)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  557 |         return
  558 |     }
vid.v:570:11: error: unknown method: `gg.Context.draw_text`
  568 |         if chunk.start > pos + 1 {
  569 |             s := line[pos..chunk.start]
  570 |             vid.vg.draw_text(x + pos * vid.char_width, y, s, vid.cfg.txt_cfg)
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  571 |         }
  572 |         // Keyword string etc
vid.v:574:7: error: assignment mismatch: 1 variable(s) 0 value(s)
  572 |         // Keyword string etc
  573 |         typ := chunk.typ
  574 |         cfg := match typ {
      |             ~~
  575 |             .a_key { vid.cfg.key_cfg }
  576 |             .a_string { vid.cfg.string_cfg }
vid.v:580:10: error: unknown method: `gg.Context.draw_text`
  578 |         }
  579 |         s := line[chunk.start..chunk.end]
  580 |         vid.vg.draw_text(x + chunk.start * vid.char_width, y, s, cfg)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  581 |         pos = chunk.end
  582 |         // Final text chunk
vid.v:585:11: error: unknown method: `gg.Context.draw_text`
  583 |         if i == vid.chunks.len - 1 && chunk.end < line.len {
  584 |             final := line[chunk.end..line.len]
  585 |             vid.vg.draw_text(x + pos * vid.char_width, y, final, vid.cfg.txt_cfg)
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  586 |         }
  587 |     }
vid.v:617:11: error: unexpected symbol `placeholder`
  615 |     }
  616 |     // Reset error line
  617 |     vid.view.error_y = -1
      |              ~~~~~~~
  618 |     match vid.mode {
  619 |         .normal {         vid.key_normal(key, mod) }
vid.v:623:24: error: unknown method: `Timer.key_down`
  621 |         .insert {         vid.key_insert(key, mod) }
  622 |         .query {         vid.key_query(key,  super) }
  623 |         .timer {         vid.timer.key_down(key, super) }
      |                                    ~~~~~~~~~~~~~~~~~~~~~
  624 |     }
  625 | }
vid.v:646:14: error: unknown method: `View.r`
  644 |         if !vid.just_switched && vid.prev_key == .r {
  645 |             if s != 'r' {
  646 |                 vid.view.r(s)
      |                          ~~~~
  647 |                 vid.prev_key = 0
  648 |                 vid.prev_cmd = 'r'
vid.v:678:8: error: unknown method: `Vid.ctrlp_open`
  676 |     .enter {
  677 |         if vid.query_type == .ctrlp {
  678 |             vid.ctrlp_open()
      |                 ~~~~~~~~~~~~
  679 |         }
  680 |         else if vid.query_type == .cam {
vid.v:684:13: error: unknown method: `View.open_file`
  682 |         }
  683 |         else if vid.query_type == .open {
  684 |             vid.view.open_file(vid.query)
      |                      ~~~~~~~~~~~~~~~~~~~~
  685 |         }
  686 |         else if vid.query_type == .task {
vid.v:698:14: error: unknown method: `View.open_file`
  696 |                 path := line.all_before(':')
  697 |                 line_nr := line[path.len+1..].int() -1
  698 |                 vid.view.open_file(vid.workspace + '/' + path)
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  699 |                 vid.view.move_to_line(line_nr)
  700 |                 vid.view.zz()
vid.v:699:14: error: unknown method: `View.move_to_line`
  697 |                 line_nr := line[path.len+1..].int() -1
  698 |                 vid.view.open_file(vid.workspace + '/' + path)
  699 |                 vid.view.move_to_line(line_nr)
      |                          ~~~~~~~~~~~~~~~~~~~~~
  700 |                 vid.view.zz()
  701 |                 vid.mode = .normal
vid.v:700:14: error: unknown method: `View.zz`
  698 |                 vid.view.open_file(vid.workspace + '/' + path)
  699 |                 vid.view.move_to_line(line_nr)
  700 |                 vid.view.zz()
      |                          ~~~~
  701 |                 vid.mode = .normal
  702 |             }
vid.v:705:9: error: unknown method: `Vid.git_grep`
  703 |             else {
  704 |                 // Otherwise just do a git grep on a submitted query
  705 |                 vid.git_grep()
      |                     ~~~~~~~~~~
  706 |             }
  707 |             return
vid.v:710:8: error: unknown method: `Vid.search`
  708 |         }
  709 |         else {
  710 |             vid.search(false)
      |                 ~~~~~~~~~~~~~
  711 |         }
  712 |         vid.mode = .normal
vid.v:751:23: error: cannot use `void` as type `bool` in return argument
  749 |
  750 | fn (vid &Vid) is_in_blog() bool {
  751 |     return vid.view.path.contains('/blog/') && vid.view.path.contains('2020')
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  752 | }
  753 |
vid.v:766:12: error: unknown method: `View.backspace`
  764 |     match key {
  765 |     .backspace {
  766 |         vid.view.backspace(vid.cfg.backspace_go_up)
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  767 |     }
  768 |     .enter {
vid.v:769:12: error: unknown method: `View.enter`
  767 |     }
  768 |     .enter {
  769 |         vid.view.enter()
      |                  ~~~~~~~
  770 |     }
  771 |     .escape {
vid.v:775:12: error: unknown method: `View.insert_text`
  773 |     }
  774 |     .tab {
  775 |         vid.view.insert_text('\t')
      |                  ~~~~~~~~~~~~~~~~~
  776 |     }
  777 |     .left {
vid.v:779:14: error: invalid operation: -- (non-numeric type `void`)
  777 |     .left {
  778 |         if vid.view.x > 0 {
  779 |             vid.view.x--
      |                       ~~
  780 |         }
  781 |     }
vid.v:783:12: error: unknown method: `View.l`
  781 |     }
  782 |     .right {
  783 |         vid.view.l()
      |                  ~~~
  784 |     }
  785 |     .up {
vid.v:786:12: error: unknown method: `View.k`
  784 |     }
  785 |     .up {
  786 |         vid.view.k()
      |                  ~~~
  787 |         //vid.refresh = false
  788 |     }
vid.v:790:12: error: unknown method: `View.j`
  788 |     }
  789 |     .down {
  790 |         vid.view.j()
      |                  ~~~
  791 |         //vid.refresh = false
  792 |     }
vid.v:796:12: error: unknown method: `View.save_file`
  794 |     }
  795 |     if (key == .k || key == .s) && super {
  796 |         vid.view.save_file()
      |                  ~~~~~~~~~~~
  797 |         vid.mode = .normal
  798 |         return
vid.v:807:12: error: unknown method: `View.insert_text`
  805 |     // Insert macro   TODO  customize
  806 |     if super && key == .g {
  807 |         vid.view.insert_text('<code></code>')
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  808 |         vid.view.x -= 7
  809 |     }
vid.v:808:12: error: unexpected symbol `placeholder`
  806 |     if super && key == .g {
  807 |         vid.view.insert_text('<code></code>')
  808 |         vid.view.x -= 7
      |                  ^
  809 |     }
  810 |     // Autocomplete
vid.v:826:19: error: unknown method: `View.line`
  824 |
  825 | fn (mut vid Vid) ctrl_n() {
  826 |     line := vid.view.line()
      |                      ~~~~~~
  827 |     mut i := vid.view.x - 1
  828 |     end := i
vid.v:827:22: error: mismatched types `void` and `any_int`
  825 | fn (mut vid Vid) ctrl_n() {
  826 |     line := vid.view.line()
  827 |     mut i := vid.view.x - 1
      |                         ^
  828 |     end := i
  829 |     for i > 0 && is_alpha_underscore(int(line[i])) {
vid.v:829:15: error: unknown function: is_alpha_underscore
  827 |     mut i := vid.view.x - 1
  828 |     end := i
  829 |     for i > 0 && is_alpha_underscore(int(line[i])) {
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  830 |         i--
  831 |     }
vid.v:830:4: error: invalid operation: -- (non-numeric type `void`)
  828 |     end := i
  829 |     for i > 0 && is_alpha_underscore(int(line[i])) {
  830 |         i--
      |          ~~
  831 |     }
  832 |     if !is_alpha_underscore(int(line[i])) {
vid.v:832:6: error: unknown function: is_alpha_underscore
  830 |         i--
  831 |     }
  832 |     if !is_alpha_underscore(int(line[i])) {
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  833 |         i++
  834 |     }
vid.v:833:4: error: invalid operation: ++ (non-numeric type `void`)
  831 |     }
  832 |     if !is_alpha_underscore(int(line[i])) {
  833 |         i++
      |          ~~
  834 |     }
  835 |     mut word := line[i..end + 1]
vid.v:835:26: error: mismatched types `void` and `any_int`
  833 |         i++
  834 |     }
  835 |     mut word := line[i..end + 1]
      |                             ^
  836 |     word = word.trim_space()
  837 |     // Dont autocomplete if  fewer than 3 chars
vid.v:836:2: error: type `void` does not support indexing
  834 |     }
  835 |     mut word := line[i..end + 1]
  836 |     word = word.trim_space()
      |     ~~~~
  837 |     // Dont autocomplete if  fewer than 3 chars
  838 |     if word.len < 3 {
vid.v:838:10: error: unknown selector expression
  836 |     word = word.trim_space()
  837 |     // Dont autocomplete if  fewer than 3 chars
  838 |     if word.len < 3 {
      |             ~~~
  839 |         return
  840 |     }
vid.v:844:13: error: unknown method: `View.insert_text`
  842 |         // If any word starts with our subword, add the rest
  843 |         if map_word.starts_with(word) {
  844 |             vid.view.insert_text(map_word[word.len..])
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  845 |             return
  846 |         }
vid.v:871:13: error: unknown method: `View.shift_right`
  869 |         if shift {
  870 |             // >
  871 |             vid.view.shift_right()
      |                      ~~~~~~~~~~~~~
  872 |         }
  873 |         else {
vid.v:880:13: error: unknown method: `View.shift_left`
  878 |         if shift {
  879 |             // <
  880 |             vid.view.shift_left()
      |                      ~~~~~~~~~~~~
  881 |         }
  882 |     }
vid.v:927:13: error: unknown method: `View.shift_a`
  925 |     .a {
  926 |         if shift {
  927 |             vid.view.shift_a()
      |                      ~~~~~~~~~
  928 |             vid.prev_cmd = 'A'
  929 |             vid.set_insert()
vid.v:940:31: error: unknown method: `View.shift_c`
  938 |         }
  939 |         if shift {
  940 |             vid.prev_insert = vid.view.shift_c()
      |                                        ~~~~~~~~~
  941 |             vid.set_insert()
  942 |         }
vid.v:950:13: error: unknown method: `View.dd`
  948 |         }
  949 |         if vid.prev_key == .d {
  950 |             vid.view.dd()
      |                      ~~~~
  951 |             return
  952 |         }
vid.v:963:9: error: unknown method: `View.ce`
  961 |         }
  962 |         if vid.prev_key == .c {
  963 |             view.ce()
      |                  ~~~~
  964 |         }
  965 |         else if vid.prev_key == .d {
vid.v:966:9: error: unknown method: `View.de`
  964 |         }
  965 |         else if vid.prev_key == .d {
  966 |             view.de()
      |                  ~~~~
  967 |         }
  968 |     }
vid.v:971:13: error: unknown method: `View.shift_i`
  969 |     .i {
  970 |         if shift {
  971 |             vid.view.shift_i()
      |                      ~~~~~~~~~
  972 |             vid.set_insert()
  973 |             vid.prev_cmd = 'I'
vid.v:981:13: error: unknown method: `View.join`
  979 |     .j {
  980 |         if shift {
  981 |             vid.view.join()
      |                      ~~~~~~
  982 |         }
  983 |         else if super {
vid.v:989:13: error: unknown method: `View.j`
  987 |         else {
  988 |             // println('J isb=$vid.is_building')
  989 |             vid.view.j()
      |                      ~~~
  990 |             // if !vid.is_building {
  991 |             //vid.refresh = false
vid.v:996:12: error: unknown method: `View.k`
  994 |     }
  995 |     .k {
  996 |         vid.view.k()
      |                  ~~~
  997 |         // if !vid.is_building {
  998 |         //vid.refresh = false
vid.v:1004:8: error: unknown method: `Vid.search`
 1002 |         if shift {
 1003 |             // backwards search
 1004 |             vid.search(true)
      |                 ~~~~~~~~~~~~
 1005 |         }
 1006 |         else {
vid.v:1007:8: error: unknown method: `Vid.search`
 1005 |         }
 1006 |         else {
 1007 |             vid.search(false)
      |                 ~~~~~~~~~~~~~
 1008 |         }
 1009 |     }
vid.v:1023:13: error: unknown method: `View.shift_o`
 1021 |         }
 1022 |         else if shift {
 1023 |             vid.view.shift_o()
      |                      ~~~~~~~~~
 1024 |             vid.set_insert()
 1025 |         }
vid.v:1027:13: error: unknown method: `View.o`
 1025 |         }
 1026 |         else {
 1027 |             vid.view.o()
      |                      ~~~
 1028 |             vid.set_insert()
 1029 |         }
vid.v:1035:8: error: unknown method: `Vid.load_git_tree`
 1033 |             vid.mode = .query
 1034 |             vid.query_type = .ctrlp
 1035 |             vid.load_git_tree()
      |                 ~~~~~~~~~~~~~~~
 1036 |             vid.query = ''
 1037 |             vid.just_switched = true
V panic: array.get: index out of range (i == 0, a.len == 0)
print_backtrace_skipping_top_frames is not implemented

vid not working in Manjaro (Arch)

System Information

image
freetype2 and glfw-x11 is installed (couldn't find freetype6 and 'normal' glfw)

Steps to reproduce

  1. Clone and compile
$ git clone https://github.com/vlang/vid
$ cd vid
$ v .
  1. Run
$ ./vid

A fullscreen app opens and closes immediately leaving behind this log:

create window wnd=0x556517844fc0 ptr==0x556517843f10
Trying to load font from RobotoMono-Regular.ttf
Parçalama arızası (çekirdek döküldü) // this says segmentation fault (core halted?)

RobotoMono-Regular.ttf does exists in vid folder. This problem is probably caused from freetype or glfw but not entirely sure.

Vid directory paths prepend an unnecessary path separator

When trying to open a file with vid it fails to open a file due to os.home_dir() appending a path separator, while the constants prepend the same separator. This results in a path such as $home//.vid/tasks -- note the double //.

I would typically not expect a home_dir() function to append the trailing path separator, but I realize that is a decision in the language itself to indicate a folder. Either way, vid, or on a more tedious level os, should probably be updated.

Possible memory leak?

High memory consumption

As I was checking out this editor I noticed what appears to be a slow memory leak. I am on windows 10 fresh install fully updated. It took about 30 minutes or so of just leaving vid up in the background to get to about 500MB. All I did was open up a file, execute a few commands, and let it run in the background while I was working on something else. Here are the screenshots

Console

console

Task Manager

vidmemory

Crash on osx when typing keys

I got following error, when I type a key or two.
V panic: array index out of range: 0 / 0

Please let me know if you need how to get detail of this error.

Compilation error: unknown type: freetype.FreeType

I tried to build vid and the error showed up as follows:

$ v .             
get_type() bad type
        ft &freetype.FreeType
                            ^
/(...)/vid/timer.v:25:22: unknown type `freetype.FreeType`

I use Manjaro Linux and have extra/freetype2 installed.

V panic: array.delete: index out of rang

V 0.1.23 320174b
When use dd delete.

./vid 
create window wnd=0xc2ddd0 ptr==0xc2d160
Trying to load font from RobotoMono-Regular.ttf
new gg text context vao=3
timer.load_tasks()
["./vid"]
add_workspace("/home/server/work/vid")
load session "/home/server/.vid/session"
V panic: array.delete: index out of range (i == 1, a.len == 1)
                                               |       0x41e3cf | ./vid() 
                                               |       0x41d336 | ./vid() 
                                               |       0x43c59f | ./vid() 
                                               |       0x437bc8 | ./vid() 
                                               |       0x436c89 | ./vid() 
                                               | 0x7fa38055d9ea | /usr/lib/x86_64-linux-gnu/libglfw.so.3(+0xd9ea) 
                                               |       0x42ca72 | ./vid() 
                                               |       0x434e37 | ./vid() 
                                               |       0x43ff7e | ./vid() 
                                               | 0x7fa37f7d2830 | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) 
                                               |       0x403079 | ./vid()

glad.o not found

// in the vid directory
v .
warning: use "_windows.v" file name instead of "D:\software\vlang\repo\v\vlib\ui\ui_win.v"
D:\software\vlang\repo\v\thirdparty\glad\glad.o not found

There are glad.c and glad.h in the thirdparty\glad directory,but not glad.o
Is vid supported in windows?

failed build on V 0.1.24 0d93eeb

./timer.v:155:61: wrong number of arguments in call to `gg.GG*.draw_line(f32, f32, f32, f32)`
  153|                          '${hour:02d}', time_cfg)
  154|          }
  155|          t.gg.draw_line(hour_x, hour_y, hour_x + hour_width, hour_y, gx.gray)
                                                                            ^
  156|  }
  157|  // Large left vertical line

Program crashes on edge cases

The program crashes in the following cases (may be more, I'm still trying it, I'm trying to familiarize myself with the project):

When on edit mode:
when you press w on the end of line
when you press l (L) on an empty buffer (haven't loaded any file)
when you press dd on an empty buffer it deletes a line which is supposed to not exist and if
you press it again then it crashes

I've fixed these cases and I'm doing a PR with those fixes.

Build error: incompatible integer to pointer conversion

OS

System Version: macOS 10.15.1 (19B88)
Kernel Version: Darwin 19.0.0

V

$ v --version
V 0.1.24 25e7cee

vid

$ git rev-parse --verify HEAD
f8cb1f3715cf96c0eca834b6273baf26d2a07468

Build

$ v .
/private/var/folders/q3/bf76j42160j2nt4s2tz1_fd40000gn/T/v/vid.tmp.c:4216:7: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversio...
(Use `v -g` to print the entire error message)

V error: C error. This should never happen.
Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose
Full error message
C compiler=cc
/Users/x/git/v/vlib/gl/gl.v:15:7: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
void* ok= gladLoadGL ( ) ;
      ^   ~~~~~~~~~~~~~~
/Users/x/git/v/vlib/gl/gl.v:43:34: warning: incompatible pointer types passing 'byte **' (aka 'unsigned char **') to parameter of type 'const GLchar *const *' (aka 'const char *const *') [-Wincompatible-pointer-types]
 glShaderSource ( shader ,  a ,  & source .str ,  b ) ;
                                 ^~~~~~~~~~~~~
/Users/x/git/v/vlib/gl/gl.v:43:51: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const GLint *' (aka 'const int *'); take the address with & [-Wint-conversion]
 glShaderSource ( shader ,  a ,  & source .str ,  b ) ;
                                                  ^
                                                  &
/Users/x/git/v/vlib/gl/gl.v:77:45: warning: passing 'byte [512]' to parameter of type 'GLchar *' (aka 'char *') converts between pointers to integer types with different sign [-Wpointer-sign]
 glGetShaderInfoLog ( shader ,  512 ,  0 ,  info_log ) ;
                                            ^~~~~~~~
/Users/x/git/v/vlib/gl/gl.v:83:48: warning: passing 'byte [1024]' to parameter of type 'GLchar *' (aka 'char *') converts between pointers to integer types with different sign [-Wpointer-sign]
 glGetProgramInfoLog ( program ,  1024 ,  0 ,  info_log ) ;
                                               ^~~~~~~~
/Users/x/git/v/vlib/gl/gl.v:147:43: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion]
 glDrawElements ( mode ,  count ,  typ ,  indices ) ;
                                          ^~~~~~~
/Users/x/git/v/vlib/gl/gl.v:177:74: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion]
 glVertexAttribPointer ( index ,  size ,  typ ,  normalized ,  stride ,  ptr ) ;
                                                                         ^~~
/Users/x/git/v/vlib/stbi/stbi.v:52:39: warning: passing 'char *' to parameter of type 'const stbi_uc *' (aka 'const unsigned char *') converts between pointers to integer types with different sign [-Wpointer-sign]
 res .data  =  stbi_load_from_memory ((char*) buf ,  3812 ,  & res .width ,  & res .height ,  & res .nr_channels ,  flag ) ;
                                      ^~~~~~~~~~~
/Users/x/git/v/thirdparty/stb_image/stb_image.h:1287:55: note: passing argument to parameter 'buffer' here
STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
                                                      ^
/Users/x/git/v/vlib/uiold/ui_darwin.v:28:2: warning: incompatible function pointer types passing 'void (*)(void *, void *, void *)' to parameter of type 'EventHandlerUPP' (aka 'int (*)(struct OpaqueEventHandlerCallRef *, struct OpaqueEventRef *, void *)') [-Wincompatible-function-pointer-types]
 InstallApplicationEventHandler(&uiold__focus_app, 1, &eventType, NULL, NULL);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/CarbonEvents.h:15098:57: note: expanded from macro 'InstallApplicationEventHandler'
      InstallEventHandler( GetApplicationEventTarget(), (handler), (numTypes), (list), (userData), (outHandlerRef) )
                                                        ^~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/CarbonEventsCore.h:2594:26: note: passing argument to parameter 'inHandler' here
  EventHandlerUPP        inHandler,
                         ^
/Users/x/git/v/vlib/glfw/glfw.v:247:23: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'GLFWcursor *' (aka 'struct GLFWcursor *') [-Wint-conversion]
 glfwSetCursor ( 0 ,  GLFW_IBEAM_CURSOR ) ;
                      ^~~~~~~~~~~~~~~~~
/Users/x/git/v/thirdparty/glfw/GLFW/glfw3.h:1051:37: note: expanded from macro 'GLFW_IBEAM_CURSOR'
#define GLFW_IBEAM_CURSOR           0x00036002
                                    ^~~~~~~~~~
/Users/x/git/v/thirdparty/glfw/GLFW/glfw3.h:4329:60: note: passing argument to parameter 'cursor' here
GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
                                                           ^
/Users/x/git/v/vlib/glfw/glfw.v:252:30: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'GLFWcursor *' (aka 'struct GLFWcursor *') [-Wint-conversion]
 glfwSetCursor ( w ->data ,  GLFW_IBEAM_CURSOR ) ;
                             ^~~~~~~~~~~~~~~~~
/Users/x/git/v/thirdparty/glfw/GLFW/glfw3.h:1051:37: note: expanded from macro 'GLFW_IBEAM_CURSOR'
#define GLFW_IBEAM_CURSOR           0x00036002
                                    ^~~~~~~~~~
/Users/x/git/v/thirdparty/glfw/GLFW/glfw3.h:4329:60: note: passing argument to parameter 'cursor' here
GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
                                                           ^
/Users/x/git/v/vlib/glfw/glfw.v:272:14: warning: initializing 'GLFWvidmode *' (aka 'struct GLFWvidmode *') with an expression of type 'const GLFWvidmode *' (aka 'const struct GLFWvidmode *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
GLFWvidmode* mode= glfwGetVideoMode ( glfwGetPrimaryMonitor ( ) ) ;
             ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/x/git/v/vlib/glm/glm.v:254:31: warning: incompatible integer to pointer conversion assigning to 'f32 *' (aka 'float *') from 'int' [-Wint-conversion]
 res [/*ptr!*/ 0 ]/*rf32 1*/  =  1 ;
                              ^  ~
/Users/x/git/v/vlib/glm/glm.v:255:31: warning: incompatible integer to pointer conversion assigning to 'f32 *' (aka 'float *') from 'int' [-Wint-conversion]
 res [/*ptr!*/ 5 ]/*rf32 1*/  =  1 ;
                              ^  ~
/Users/x/git/v/vlib/glm/glm.v:256:32: warning: incompatible integer to pointer conversion assigning to 'f32 *' (aka 'float *') from 'int' [-Wint-conversion]
 res [/*ptr!*/ 10 ]/*rf32 1*/  =  1 ;
                               ^  ~
/Users/x/git/v/vlib/glm/glm.v:261:32: warning: incompatible integer to pointer conversion assigning to 'f32 *' (aka 'float *') from 'int' [-Wint-conversion]
 res [/*ptr!*/ 15 ]/*rf32 1*/  =  1 ;
                               ^  ~
/Users/x/git/v/vlib/freetype/freetype.v:116:23: warning: passing 'int *' to parameter of type 'GLuint *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
 glGenTextures ( 1 ,  & texture ) ;
                      ^~~~~~~~~
/Users/x/git/v/vlib/freetype/freetype.v:168:7: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'FT_Error' (aka 'int') [-Wint-conversion]
void* ret= FT_Init_FreeType ( & ft ) ;
      ^    ~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/x/git/v/vlib/freetype/freetype.v:188:7: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
 ret  =  ((int)( FT_New_Face ( ft , (char*) font_path .str ,  0 ,  & face ) ) ) ;
      ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 warnings generated.
ld: warning: directory not found for option '-L/opt/local/lib'
ld: library not found for -lglfw
clang: error: linker command failed with exit code 1 (use -v to see invocation)
V error: C error. This should never happen. 
Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose

error: undefined: `glfw.KEY_LEFT_SUPER`

.\vid.v:480:17: error: undefined: glfw.KEY_LEFT_SUPER
478| break
479| }
480| // End of /**/

481| if i > 0 && line[i - 1] == * && line[i] == / {
482| // All before */ is still a comment

Crash when no monitor found.

OS
Windows Subsystem for Linux (Ubuntu)

$ ./vid vid.v
vid: /build/glfw3-KYdbSD/glfw3-3.2.1/src/monitor.c:394: glfwGetVideoMode: Assertion `monitor != NULL' failed.
Aborted (core dumped)

Bug: This crash when enter some keys of keyboard

Hello,

It's a funny project? You need to fix the problems.
Anyway, i find a bug and problem in this, so while are you trying to enter some keys. it will crash.

[max@base vid]$ ./vid config.v

['./vid', 'config.v']
PATH="config.v" cur_dir="/home/max/v/examples/vid"
add_workspace(".")
open file "config.v"
getting words
saving session...
load session "/home/max/.vid/session"
['config.v', '']
open file "config.v"
getting words
saving session...
V panic: substr(1, 0) out of bounds (len=21)
                                               | 0x5629655041c2 | ./vid(+0x161c2) 
                                               | 0x56296551b4ea | ./vid(+0x2d4ea) 
                                               | 0x56296551de74 | ./vid(+0x2fe74) 
                                               | 0x56296551ad54 | ./vid(+0x2cd54) 
                                               | 0x562965519dfa | ./vid(+0x2bdfa) 
                                               | 0x7f4761f4e0b6 | /usr/lib/libglfw.so.3(+0x170b6) 
                                               | 0x562965511e28 | ./vid(+0x23e28) 
                                               | 0x56296552bd65 | ./vid(+0x3dd65) 
                                               | 0x7f4761c2b023 | /usr/lib/libc.so.6(__libc_start_main+0xf3) 
                                               | 0x5629654f19de | ./vid(+0x39de) 

Regards,
Max Base

Build issue

v .
.vid.c:118:10: fatal error: 'ft2build.h' file not found
#include "ft2build.h"
         ^~~~~~~~~~~~
1 error generated.V panic: C error. This should never happen. Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose

brew install freetype is done how do I pass header locations to v during compilation.

 v version
V 0.1.17
osx version
10.14.6

Linux Kernel development

Hi.

I plan to do a PoC of creating a linux kernel driver using V. Could you please save me some time with suggestions about what ti start with? I think it should use a different library that doesn't use system calls, but tue kernel API, right? (Eg kmalloc)

V error: C error. This should never happen

Encountered the following issue when building and filing as advised:
Feel free to rename the issue name.

warning: use "_linux.v" file name instead of "/home/username/sandbox/v_stuff/v/vlib/ui/ui_lin.v"
warning: ./vid.v:5:6: the following imports were never used:

  • gx tcc: arm64-gen.c:1726: gen_cvt_ftof: Assertion `f == VT_FLOAT || f == VT_DOUBLE || f ==VT_LDOUBLE' failed. Aborted
    V error: C error. This should never happen. Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose

Non-Vim mode

Mouse support, etc.

Right now you have to know Vim to use Vid.

Maybe use nvim as backend, or maybe implement LSP, ...

Don't know what are the goals of vid, but when I saw that vid wants to have some configuration (colors, ...), needs undo, wants non-vim controls, then I asked myself why not to save some work and use nvim as backend (as e.g. https://github.com/equalsraf/neovim-qt/ does)?

The performance shall be also very good, there are mature Emacs (or other controls "styles") plugins, etc.

Or vice versa - make vid stay a backend and just implement Language Server Protocol and use any frontend (graphical or console or whatever) you like.

^Just thoughts...

I decided to use the neovim backend

I think the C libnvim library should be used.

This will save a lot of time.

I realized that implementing all Vim's commands, undo, terminal emulation etc is too hard and an unnecessary re-invention of the wheel :)

Slow on raspberry pi

I'm not sure what's causing it, but lack of memory is surely not a problem. I'm on a Pi Zero W, running Arch Linux ARM with 512MB of memory (64MB for GPU), 1.000GHz cpu.

Vid takes about 10 seconds to show up, and takes almost 7 seconds for any action to take place.

Let me know if more information is needed.

Non QWERTY keyboard layout

I use Dvorak keyboard layout, and it seems vid is unable to recognize it. Just to let you know.

Awesome works 👍

Can't compile on linux and windows

No ui module is available for linux (and window).

$ v .
V panic: cannot import module ui (no .v files in "/home/Henrixounez/code/v/vlib/ui").

vid doesn't build on Windows

Command git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries [path to v repo]/thirdparty/freetype/ was executed (of course instead of "[path to v repo]" was inserted absolute path to v repo). Output of v:

["strings", "strconv.ftoa", "strings", "hash.wyhash", "strconv", "os", "gx", "gg", "gx", "os", "time"]
.\timer.v:25:0: error: unknown module `freetype`

segfault

Vid segfaults whenever trying to open a folder with it, no matter how many files there are in that actual folder

Output :

infrandomness@ir-pc vid]$ ./vid lolz/
['./vid', 'lolz/']
PATH="lolz/" cur_dir="/home/infrandomness/sources/vid"
load session "/home/infrandomness/.vid/session"
['lolz/1', '', '']
Segmentation fault (core dumped)

Environment :
OS : Fedora 32 (Thirty Two) with kernel 5.6.13-300.fc32.x86_64
V version : 0.1.27 4af4a8f
Vid version : ad1b74e
(Just tell me if you need more logs or more informations about my environment)

vid doesn't build

On Ubuntu 18.04 (mentioned dependencies installed)
v version: V 0.1.22 be4eaa6
Output of v .:

warning: use "_linux.v" file name instead of "/home/pp/git/v/vlib/ui/ui_lin.v"
./vid.v:1152:34: `vid` is declared as mutable, but it was never changed
 1150| 
 1151| // Find current word under cursor
 1152| fn (vid mut Vid) word_under_cursor() string {
                                        ^
 1153| 	line := vid.view.line()
 1154| 	// First go left

cross compile to window fails

V 0.1.29 c01fd4a
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0

Expected v to cross compile

Got:
v -os windows nbody.v
/home/ghs/v/thirdparty/tcc/lib/openlibm.o not found, building it...
exec failed for thirdparty object build cmd:
x86_64-w64-mingw32-gcc -fPIC -c -o "/home/ghs/v/thirdparty/tcc/lib/openlibm.o" "/home/ghs/v/thirdparty/tcc/lib/openlibm.c"
builder error: sh: 1: x86_64-w64-mingw32-gcc: not found

I can't use Vid

I'm trying to use Vid, by my first time, but it isn't working. When I try to open the program, it crash. So when I type something, the program quits.
vid-error
When I look to console, it appears the message "print_backtrace_skipping_top_frames is not implemented"

Crash when opening README.md

I tried to open vid's README.md in vid, and got this:

$ vid ./vid
create window wnd=0x7fba70d12ea0 ptr==0x7fba70d12990
Trying to load font from RobotoMono-Regular.ttf
new gg text context vao=3
<some cyrillic>
load session "/Users/foo//.vppsession"
[]
open file "README.md"
getting words
saving session...
V panic: substr(131, 73) out of bounds (len=170)

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.