DEV Community

nozomi-iida
nozomi-iida

Posted on • Updated on

Journey to Becoming a Vimmer Vol2 ~Custom Editor~

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
  • 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

git clone --depth 1 https://github.com/wbthomason/packer.nvim\
 ~/.local/share/nvim/site/pack/packer/start/packer.nvim
Enter fullscreen mode Exit fullscreen mode

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

cd .config && mkdir nvim && cd nvim
mkdir lua
nvim lua/plugins.lua
Enter fullscreen mode Exit fullscreen mode
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)
Enter fullscreen mode Exit fullscreen mode

Create ~/.config/nvim/init.vim

require "plugins"
Enter fullscreen mode Exit fullscreen mode

~/.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

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)
Enter fullscreen mode Exit fullscreen mode

'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.

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

Add plugin in ~/.config/lua/plugins.lua

packer.startup(function(use)
  use 'wbthomason/packer.nvim'
  -- Your plugins go here
  use 'svrana/neosolarized.nvim'
end)
Enter fullscreen mode Exit fullscreen mode

Run :PackerInstall

Setup Lualine in ~/.config/after/plugin/lualine.lua
I copied this code.

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

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>', {})
Enter fullscreen mode Exit fullscreen mode

In this file, I set vim keymap to change tab.

Image description

Summarize

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

Image description

references

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

Top comments (0)