> For the complete documentation index, see [llms.txt](https://dorian.gitbook.io/devops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dorian.gitbook.io/devops/setting/neovim/lazyvim/lazyvim.md).

# install & 활용방법

> astronvim에서 lazyvim 으로 옮겼다. 써본 결과 오류도 없고 꽤 빠른속도로 작동 하는것 같아 neovim에서 이것으로 갈아타기로 결정 하였다.

### nvim 추가 연구 목록

* 클립보드에 이미지 저장해서 md 에 붙여넣을 경우 바로 파일로 만들어주기(vscode에서는 가능하나 아직 nvim에서는 안됨)
* 한/영 자동 변환
* 편집창에서 바로 code 실행 쉘스크립트나 python code (주피터 노트북처럼)
* lazygit을 활용 하여 merge, diff 작업 해보기
* image 파일 열기

## install

[lazyvim link](https://www.lazyvim.org/installation)

```bash
# required
mv ~/.config/nvim{,.bak}

# optional but recommended
mv ~/.local/share/nvim{,.bak}
mv ~/.local/state/nvim{,.bak}
mv ~/.cache/nvim{,.bak}

git clone https://github.com/LazyVim/starter ~/.config/nvim

rm -rf ~/.config/nvim/.git

nvim
```

### plugins add

* \~/.config/nvim/lua/config/lazy.lua 을 수정 하자
* makrdown 과 fzf를 추가 하였다.

```bash
require("lazy").setup({
  spec = {
    -- add LazyVim and import its plugins
    { "LazyVim/LazyVim", import = "lazyvim.plugins" },
    { import = "lazyvim.plugins.extras.lang.markdown" },
    { import = "lazyvim.plugins.extras.editor.fzf" },
    -- import/override with your plugins
    { import = "plugins" },
  },

원하는 플러그인을 찾아서 중간에 import 구문을 추가하면 자동으로 load 된다
```

### lazygit

#### install

> 파일을 수정 하고 터미널을 열고 디렉토리를 이동하면서 git add , commit ,push를 치는것도 이제 지겨워졌다. 이제 바로 파일을 github에 push 하자

vim 내에서 git을 사용 하기 위해서는 lazyvim을 설치해야 한다.

* 참조 : [lazygit github](https://github.com/jesseduffield/lazygit)

```bash
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin
```

저렇게 하고 바로 설치를 하면 오류가 날건데 아래 config를 추가 하여주자

vi \~/.config/lazygit/config.yml

```yml
     gui:
       showIcons: true
     git:
       paging:
         useConfig: true
       log:
          showGraph: always
```

#### lazygit used

먼저 git 폴더로 이동해서 nvim을 열자 (markdown preview 처럼 md파일이 아니면 작동하지 않는다)\
git 폴더가 아니라면 작동하지 않는데 .git 디렉토리가 있는지 확인하자

1. lazygit 실행: \[space] - \[gg] \\

![alt text](/files/KHfoQBde8eZU7SlGwQvN)

1 , 2 , 3 ,4 등 번호를 누르면 각 세션으로 이동한다.

2. 도움말은 ? 누르면 나온다.

![alt text](/files/bZ088VOzp9JtcPXPXV1o)

3. git pull : \[p] 누르면 된다.
4. git add : \[a] (전체선택) or [space](https://github.com/kimutae1/gitbook/blob/main/setting/vim/lazyvim/단일선택/README.md) : 전체 디렉토리 선택 이후 stage

![alt text](/files/yGJT9jwLaFL83SfFf6fY)

5. git commit : \[c] 누르고 나오는 창에서 메시지 입력 후 \[enter]

![alt text](/files/8QwX8jK6YbQlZmrK5DRM)

6. git push : \[P]

![alt text](/files/zV8a5pavhXdA0OBkOlYq)

## 후기

> 이로써 나는 5시간 정도 들여서 연구하고 글을 쓰면서 vim에서 github push 까지 하는 방법을 습득했다. \[space] - \[gg] - \[a] - \[c] - commit message - \[P] 정도로 바로 push를 해보니 생각보다 쓸만 했다.

#### chatgpt

```lua
return {
  "jackMort/ChatGPT.nvim",
  event = "VeryLazy",
  config = function()
    require("chatgpt").setup()
  end,
  dependencies = {
    "MunifTanjim/nui.nvim",
    "nvim-lua/plenary.nvim",
    "nvim-telescope/telescope.nvim"
  }
}
```

#### add setting

```
sudo apt install -y liblua5.1-dev ripgrep fd-find sqlite3 golang ruby-dev ruby php

cd /tmp/

#luarocks
wget https://luarocks.org/releases/luarocks-3.11.1.tar.gz
tar zxpf luarocks-3.11.1.tar.gz
cd luarocks-3.11.1
./configure && make && sudo make install
sudo luarocks install luasocket ruby
lua

#latex
 wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
zcat < install-tl-unx.tar.gz | tar xf - # note final - on that command line
cd install-tl-*
perl ./install-tl --no-interaction # as root or with writable destination
# may take several hours to run
Finally, prepend /usr/local/texlive/YYYY/bin/PLATFORM to your PATH,
e.g., /usr/local/texlive/2025/bin/x86_64-linux



npm install -g markview

#cpan  install
cpan
cpan Neovim::Ext


#kitty
curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin \
    installer=nightly



```

```lua
-- init.lua
require("lazy").setup {
    {
        "lukas-reineke/headlines.nvim",
        dependencies = "nvim-treesitter/nvim-treesitter",
        config = true, -- or `opts = {}`
    },
}
```
