Journey to Becoming a Vimmer Vol2 ~Custom Editor~
Published: 2023-07-04 14:46:58

# Make editor cool
## Introduction
When I saw a YouTube video about live coding where vimmer code, I was amazed at the speed of coding.
This article is a record until I became a Vimmer.

## Prerequisite
- This article was inspired by [this](https://zenn.dev/takuya/articles/4472285edbc132)
- Using Macbook
- Using Iterm2

## Install Packer
### What is Packer
Packer is a plugin manager written by Lua.

### How to set up
**Clone packer in your pc**
```shell
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
 ~/.local/share/nvim/site/pack/packer/start/packer.nvim
```

**Create `~/.config/lua/plugins.lua`**
I write plugins in `~/.config/lua/plugins.lua`.

```shell
cd .config && mkdir nvim && cd nvim
mkdir lua
nvim lua/plugins.lua
```
```lua
local status, packer = pcall(require, "packer")
if (not status) then
  print("Packer is not installed")
  return
end

vim.cmd [[packadd packer.nvim]]

packer.startup(function(use)
  use 'wbthomason/packer.nvim'
  -- Your plugins go here
end)
```

**Create `~/.config/nvim/init.vim`**
```shell
require "plugins"
```
`~/.config/nvim/init.vim` is Neovim configuration file for Neovim(.vimrc in vim).

## Colorschema
I'm using [Neosolarized].(https://github.com/svrana/neosolarized.nvim)
**Add plugin in `~/.config/lua/plugins.lua`**
```lua
require('packer').startup(function(use)
  use 'wbthomason/packer.nvim' -- The packer plugin manager itself
  -- Your plugins go here
  use 'tjdevries/colorbuddy.nvim'
  use 'svrana/neosolarized.nvim'
end)
```
'tjdevries/colorbuddy.nvim' is neseccary to use `Neosolarized`.

**Run `:PackerInstall`**
This command install `Neosolarized`

**Setup `Neosolarized` in `~/.config/after/plugin/neosolarized.lua`**
`after/plugin` directory was loaded after loading specific plugins.
This is useful when we customize plugins.
I copied [this code](https://github.com/craftzdog/dotfiles-public/blob/master/.config/nvim/after/plugin/neosolarized.rc.lua).

**Enable `termguicolors`**
_This is neseccary to use `Neosolarized`._
By default Iterm2 can only use 256 colors, but "Neosolarized" uses more than 256 colors.

## Status line
I'm using [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim)

**Add plugin in `~/.config/lua/plugins.lua`**
```lua
packer.startup(function(use)
  use 'wbthomason/packer.nvim'
  -- Your plugins go here
  use 'svrana/neosolarized.nvim'
end)
```

**Run `:PackerInstall`**

**Setup `Lualine` in `~/.config/after/plugin/lualine.lua`**
I copied [this code](https://github.com/craftzdog/dotfiles-public/blob/63a21e18382a29791e17d8ca30ead0492dc56a3b/.config/nvim/after/plugin/lualine.rc.lua).

## Tab
I'm using [Bufferline].(https://github.com/akinsho/bufferline.nvim)
**Add `akinsho/bufferline.nvim` in `~/.config/lua/plugins.lua`**
**Setup Bufferline in `after/plugin/bufferline.lua`
```lua
local status, bufferline = pcall(require, "bufferline")
if (not status) then return end

bufferline.setup({
  options = {
    mode = "tabs",
    separator_style = 'slant',
    always_show_bufferline = false,
    show_buffer_close_icons = false,
    show_close_icon = false,
    color_icons = true
  },
  highlights = {
    separator = {
      guifg = '#073642',
      guibg = '#002b36',
    },
    separator_selected = {
      guifg = '#073642',
    },
    background = {
      guifg = '#657b83',
      guibg = '#002b36'
    },
    buffer_selected = {
      guifg = '#fdf6e3',
      gui = "bold",
    },
    fill = {
      guibg = '#073642'
    }
  },
})

vim.keymap.set('n', '<Tab>', '<Cmd>BufferLineCycleNext<CR>', {})
vim.keymap.set('n', '<S-Tab>', '<Cmd>BufferLineCyclePrev<CR>', {})
```
In this file, I set vim keymap to change tab.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/98mx3t7kgsgy5o6zs9p9.png)

## Summarize
If you did the above, you should have created a cool editor

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5q8rl31ng9jutakeurcr.png)



## references
https://github.com/wbthomason/packer.nvim
https://github.com/svrana/neosolarized.nvim