Nextvi - Small and Simple Editor

vi๋Š” ๋ฐฐ์šฐ๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ๋ชธ์œผ๋กœ ์ตํžˆ๋Š” ๊ฒƒ์ด๋‹ค. vi๋Š” ๋‹จ์ˆœํ•˜๊ณ  ์ผ๊ด€์„ฑ์ด ์žˆ๋‹ค. Intro ์žฅ์  vi์˜ ๊ธฐ๋ณธ ๋ช…๋ น์„ ์ œ๊ณตํ•œ๋‹ค. ๋‹จ์ˆœํ•˜๊ณ  ์šฉ๋Ÿ‰์ด ์ž‘์•„ ์ž„๋ฒ ๋””๋“œ ํ™˜๊ฒฝ ๋ฐ ์›๊ฒฉ์ง€์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ์— ์ข‹๋‹ค. neatvi๋กœ ๋ถ€ํ„ฐ ์—ฌ๋Ÿฌ ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋˜์—ˆ๋‹ค. vim, nvim๊ณผ๋Š” ๋‹ค๋ฅด๊ฒŒ ๊ฐ„๋‹จํ•œ ์„ค์ •๊ณผ ๋น ๋ฅธ ๋™์ž‘์ด ์žฅ์ ์ด๋‹ค. utf-8์„ ์ง€์›ํ•œ๋‹ค. ํ•œ๊ธ€ ์ž…์ถœ๋ ฅ ๊ฐ€๋Šฅ. ์‰˜๋ช…๋ น ์ถœ๋ ฅ์„ ex-mode(๋ช…๋ น๋ผ์ธ)์—์„œ ํ„ฐ๋ฏธ๋„ ๊นจ์ง ์—†์ด ๋ถˆ๋Ÿฌ์˜ฌ ์ˆ˜ ์žˆ๋‹ค. ๊ฐ์ข… ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ์—†๋Š” ๋Œ€์‹  ex-mode์—์„œ ํ„ฐ๋ฏธ๋„ ํˆด๊ณผ ์ƒํ˜ธ ์ž‘์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ฐœ์ธ์ ์œผ๋กœ vim๋ณด๋‹ค๋Š” nvim์„ ๋” ์„ ํ˜ธํ•œ๋‹ค. lua์™€ ๊ฒฐํ•ฉ๋œ ํ”Œ๋Ÿฌ๊ทธ์ธ๊ณผ์˜ ์—ฐ๊ฒฐ์ด ์ •๋ง ์ข‹๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ํ•˜์ง€๋งŒ ๋‹จ์ ๋„ ๋งŽ๋‹ค. lua๋ฅผ ๊ณต๋ถ€ํ•ด์•ผํ•˜๊ณ  ๋˜ ์„ค์ •์— ์ ์‘ํ•˜๋ ค๋ฉด ๋งŽ์€ ์‹œ๊ฐ„๊ณผ ๋…ธ๋ ฅ์ด ํ•„์š”ํ•˜๋‹ค. ๋”๊ตฐ๋‹ค๋‚˜ ์ˆ˜๋งŽ์€ ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์žฅ์ฐฉํ•˜๊ฒŒ ๋˜๋ฉด ๋А๋ ค์ง€๊ณ  ๋ฌด๊ฑฐ์›Œ์ง„๋‹ค. ์„ค์ •์ด ์ž˜ ๋ชป ๋˜๋ฉด ๋ฐ”๋กœ ์žก๋А๋ผ ์‚ฝ์งˆ์„ ํ•ด์•ผํ•œ๋‹ค. ๋ฌผ๋ก  ์ž์‹ ๋งŒ์˜ ์„ค์ •์„ ์ž˜ ๋งŒ๋“ค์–ด์„œ ๋ฐฑ์—…ํ•ด ๋‘์—ˆ๋‹ค๊ฐ€ ์žฌ์‚ฌ์šฉํ•˜๋ฉด ์ข‹๋‹ค. ํ•˜์ง€๋งŒ nvim ์ž์ฒด์˜ ํŒจํ‚ค์ง€ ์‚ฌ์ด์ฆˆ์™€ ์ˆ˜ ๋งŽ์€ ํ”Œ๋Ÿฌ๊ทธ์ธ์˜ ์‚ฌ์ด์ฆˆ๋ฅผ ์ƒ๊ฐํ•˜๋ฉด ์ž‘๊ณ  ๊ฐ€๋ณ๊ฒŒ๋ผ๋Š” ๋ง์ด ๋ฌด์ƒ‰ํ•ด์ง„๋‹ค. ...

2024-04-19 ยท (updated 2025-06-14) ยท 1767 words

Zig๋กœ gcc/clang ์ปดํŒŒ์ผ๋Ÿฌ ๋Œ€์ฒดํ•˜๊ธฐ

last updated: {{ โ€œ1712680347โ€ | date: โ€œ%Y-%m-%d %H:%Mโ€ }} Intro zig๋กœ c ์†Œ์Šค๋ฅผ ์ปดํŒŒ์ผํ•  ์ˆ˜ ์žˆ๋‹ค. zig์˜ ์žฅ์ ์€ ์—ฌ๋Ÿฌ ํ”Œ๋žซํผ๊ณผ ์•„ํ‚คํ…์ฒ˜์šฉ ์ปดํŒŒ์ผ์ด ๊ฐ€๋Šฅํ•˜๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. static, dynamic ๋ชจ๋‘ ๊ฐ€๋Šฅํ•˜๋‹ค. Linux, iOS, Windows ๋“ฑ ์—ฌ๋Ÿฌ OS ํ™˜๊ฒฝ ์ง€์›. x86, , x86-64, aarch64 ๋“ฑ ์•„ํ‚คํ…์ฒ˜ ์ง€์› Target List ๋‹ค์Œ ๋ฐฉ๋ฒ•์œผ๋กœ ์›ํ•˜๋Š” ํ”Œ๋žซํผ, ์•„ํ‚คํ…์ณ๋ฅผ ๋จผ์ € ์ฐพ๋Š”๋‹ค. $ zig targets $ zig targets | grep x86 $ zig targets | grep x86-64 $ zig targets | grep aarch64 $ zig targets | grep linux $ zig targets | grep windows $ zig targets | grep macos x86, x86_64 - intel ๊ณ„์—ด aarch64 - arm ๊ณ„์—ด (raspberrypi) linux - Linux windows - Ms Windows macos - Mac OS Local Compile dynamic: Alpine Linux (x86_64) $ zig cc -o hello_dynamic hello.c $ file hello_dynamic hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, with debug_info, not stripped $ ./hello Hello World! static: Alpine Linux (x86_64) $ zig cc -o hello hello.c -target x86_64-linux-musl $ file hello ./hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped $ ./hello Hello World! Cross Compile For windows $ zig cc -o hello.exe hello.c -target x86_64-windows-gnu $ file ./hello.exe hello: PE32+ executable (console) x86-64, for MS Windows, 7 sections Windows c:> .\hello.exe Hello World! For Linux dynamic with Gnu Libs $ zig cc -o hello hello.c -target x86_64-linux-gnu $ file ./hello.exe ./hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.0.0, with debug_info, not stripped gnu-linux$ ./hello Hello World! For Linux Static with musl $ zig cc -o hello.exe hello.c -target x86_64-linux-gnu $ file ./hello.exe ./hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped any-linux$ ./hello Hello World! Makefile or Build.sh ํ•ด๋‹น ํŒŒ์ผ์—์„œ gcc, clang ๋ถ€๋ถ„์„ zig cc๋กœ ์ˆ˜์ •ํ•œ๋‹ค. make ๋˜๋Š” ./Build.sh ์‹คํ–‰ Links zig cc: a Powerful Drop-In Replacement for GCC/Clang https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html

2024-04-03 ยท 313 words

Zig + Nvim ์„ค์ •

last updated: {{ โ€œ1710903265โ€ | date: โ€œ%Y-%m-%d %H:%Mโ€ }} Intro neovim์—์„œ zig ์„ค์ • ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•œ๋‹ค. Install on Alpine ์„ค์น˜ํ•˜๊ธฐ $ doas apk add zig zls neovim $ nvim ~/.local/nvim/init.lua require 'lspconfig'.zls.setup{} ๋‹ค๋ฅธ ์–ด๋–ค ์–ธ์–ด๋ณด๋‹ค๋„ ์„ค์ •์ด ๊ฐ„๋‹จํ•˜๋‹ค. zls๋Š” zig language server lspconfig๋Š” neovim์— ๋‚ด์žฅ๋œ LSP ์„ค์ •์„ ๋งํ•œ๋‹ค. nvim ์„ค์ • ํ›„ zigํŒŒ์ผ์„ ์—ด๊ณ  ์ฝ”๋”ฉํ•˜๋ฉด ๋„์›€๋ง์ด ๋‚˜ํƒ€๋‚œ๋‹ค. tab์œผ๋กœ ์ด๋™ํ•˜๊ณ  Enter๋กœ ์„ ํƒํ•œ๋‹ค. Install zls from Source ์†Œ์Šค๋ฅผ ์ปดํŒŒ์ผํ•˜๋Š” ๋ฐฉ๋ฒ•. ์ตœ์‹  ๋ฒ„์ „์˜ zig(ํ˜„์žฌ 0.12)์ด์–ด์•ผ git ์†Œ์Šค๋กœ ์ปดํŒŒ์ผ ๋œ๋‹ค. zig ์ตœ์‹  ๋ฒ„์ „์€ zig ํ™ˆ์—์„œ ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜ ์žˆ๋‹ค. ๋‹ค์Œ ์ ˆ์ฐจ์— ๋”ฐ๋ผ ๋นŒ๋“œํ•œ๋‹ค. $ git clone https://github.com/zigtools/zls $ cd zls $ zig build -Doptimize=ReleaseSafe $ mkdir ~/bin && cp zig-out/bin/zls ~/bin $ echo 'export PATH=$HOME/bin:$PATH' >> ~/.bash_profile $ source ~/.bash_profile $ zls --version Links Neovim setup for Zig https://terminalprogrammer.com/neovim-setup-for-zig

2024-03-12 ยท 121 words

Zig Programming Language

last updated: {{ โ€œ1712202776โ€ | date: โ€œ%Y-%m-%d %H:%Mโ€ }} Intro a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software. Install Debian/Ubuntu $ sudo apt install zig Alpine Linux $ doas apk add zig ์ตœ์‹  ๋ฆฌ๋ˆ…์Šค ๋ฒ„์ „ ์„ค์น˜ https://ziglang.org/download/ os์™€ ์•„ํ‚คํ…์ณ์— ๋งž๋Š” ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œํ•œ๋‹ค. ์••์ถ•์„ ํ‘ผ ํ›„ PATH๋ฅผ ์„ค์ •ํ•ด์ฃผ๋ฉด ๋ฐ”๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋‹ค. ํ˜„์žฌ ์‚ฌ์šฉ ๋ฒ„์ „: 0.12 $ tar xJf zig-linux-x86_64-0.12.0-dev.3212+40e64245f.tar.xz $ ln -s zig-linux-x86_64-0.12.0-dev.3212+40e64245f/ zig $ cd zig; ls $ ./zig version $ ./zig help Hello World hello-world.zig const std = @import("std"); pub fn main() !void { std.debug.print("Hello, World!\n", .{}); } run / test $ zig run hello-world.zig $ zig test hello-world.zig build (default=debug, small, fast, safe) $ zig build-exe hello.zig $ ./hello $ zig build-exe --name hello-small -O ReleaseSmall hello.zig $ zig build-exe --name hello-fast -O ReleaseFast hello.zig $ zig build-exe --name hello-safe -O ReleaseSafe hello.zig $ zig build-exe --name hello-debug -O Debug hello.zig $ ls -l $ ./hello-small More Docs zig-nvim - neovim์— zig ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ค์ •ํ•˜๊ธฐ zig-cc - Zig๋กœ gcc/clang ์ปดํŒŒ์ผ๋Ÿฌ ๋Œ€์ฒดํ•˜๊ธฐ Links home - https://ziglang.org/ awesome zig - https://www.trackawesomelist.com/catdevnull/awesome-zig/readme/ Study and Docs zig-guide - https://zig.guide/ reference - https://ziglang.org/documentation/0.11.0/ zig-by-example - https://zig-by-example.com/ zig std - https://ziglang.org/documentation/master/std/ exercises - https://exercism.org/tracks/zig/exercises learn x in y minutes - https://learnxinyminutes.com/docs/zig/ Compile and Build zig-cc - https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html Zig Build System Internals - https://mitchellh.com/zig/build-internals

2024-03-12 ยท 214 words

์•„๋ผ์ง€ ๋งˆ์„ธ์š” - ๋‚˜ํƒœ์ฃผ

์•„๋ผ์ง€ ๋งˆ์„ธ์š”/ ๋‚˜ํƒœ์ฃผ ์ข‹์€ ๊ฒƒ ์•„๋ผ์ง€ ๋งˆ์„ธ์š” ์˜ท์žฅ ์†์— ๋“ค์–ด ์žˆ๋Š” ์ƒˆ๋กœ์šด ์˜ท ์˜ˆ์œ ์˜ท ์ž”์นซ๋‚  ๊ฐ„๋‹ค๊ณ  ๊ฒฐํ˜ผ์‹์žฅ ๊ฐ„๋‹ค๊ณ  ์•„๋ผ์ง€ ๋งˆ์„ธ์š” ๊ทธ๋Ÿฌ๋‹ค ๊ทธ๋Ÿฌ๋‹ค๊ฐ€ ์ฒ ์ง€๋‚˜๋ฉด ํ—Œ์˜ท ๋˜์ง€์š” ๋งˆ์Œ ๋˜ํ•œ ์•„๋ผ์ง€ ๋งˆ์„ธ์š” ๋งˆ์Œ์†์— ๋“ค์–ด ์žˆ๋Š” ์‚ฌ๋ž‘์Šค๋Ÿฐ ๋งˆ์Œ ๊ทธ๋ฆฌ์šด ๋งˆ์Œ ์ •๋ง๋กœ ์ข‹์€ ์‚ฌ๋žŒ ์ƒ๊ธฐ๋ฉด ์ค€๋‹ค๊ณ  ์•„๋ผ์ง€ ๋งˆ์„ธ์š” ๊ทธ๋Ÿฌ๋‹ค ๊ทธ๋Ÿฌ๋‹ค๊ฐ€ ๋งˆ์Œ์˜ ๋ฌผ๊ธฐ ๋งˆ๋ฅด๋ฉด ๋…ธ์ธ์ด ๋˜์ง€์š” ์ข‹์€ ์˜ท ์žˆ์œผ๋ฉด ์ƒ๊ฐ๋‚  ๋•Œ ์ž…๊ณ  ์ข‹์€ ์Œ์‹ ์žˆ์œผ๋ฉด ๋จน๊ณ  ์‹ถ์€ ๋•Œ ๋จน๊ณ  ์ข‹์€ ์Œ์•… ์žˆ์œผ๋ฉด ๋“ฃ๊ณ  ์‹ถ์€ ๋•Œ ๋“ค์œผ์„ธ์š” ๋”๊ตฌ๋‚˜ ์ข‹์€ ์‚ฌ๋žŒ ์žˆ์œผ๋ฉด ๋งˆ์Œ์†์— ์ˆจ๊ฒจ๋‘์ง€ ๋ง๊ณ  ๋งˆ์Œ๊ป ์ข‹์•„ํ•˜๊ณ  ๋งˆ์Œ๊ป ๊ทธ๋ฆฌ์›Œํ•˜์„ธ์š” ๊ทธ๋ฆฌํ•˜์—ฌ ๋•Œ๋กœ๋Š” ์–ผ๊ตด ๋ถ‰ํž ์ผ ๋ˆˆ๋ฌผ ๊ธ€์ฝ์ผ ์ผ ์žˆ๋‹คํ•œ๋“ค ๊ทธ๊ฒŒ ๋ฌด์Šจ ๋Œ€์ˆ˜๊ฒ ์–ด์š”! ์ง€๊ธˆ๋„ ๊ทธ๋Œ€ ์•ž์— ๊ฝƒ์ด ์žˆ๊ณ  ์ข‹์€ ์‚ฌ๋žŒ์ด ์žˆ์ง€ ์•Š๋‚˜์š” ๊ทธ ๊ฝƒ์„ ๋งˆ์Œ๊ป ์ข‹์•„ํ•˜๊ณ  ๊ทธ ์‚ฌ๋žŒ์„ ๋งˆ์Œ๊ป ๊ทธ๋ฆฌ์›Œํ•˜์„ธ์š”. (2012)

2024-03-01 ยท 112 words