chore(config): use lua for neovim config

main
sudo pacman -Syu 2022-05-27 13:35:52 +07:00
parent ab2668d04e
commit 5a1ca907b2
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
4 changed files with 87 additions and 104 deletions

View File

@ -9,4 +9,3 @@ font:
family: APL385 Unicode
style: Regular
size: 18.0

View File

@ -3,8 +3,8 @@
"nvim": {
"paths": [
{
"internal": "data/nvim/init.vim",
"external": "~/.config/nvim/init.vim"
"internal": "data/nvim/init.lua",
"external": "~/.config/nvim/init.lua"
}
]
},

85
data/nvim/init.lua Normal file
View File

@ -0,0 +1,85 @@
-- https://neovim.io/doc/user/lua.html#lua-vim-options
vim.opt.breakindent = true
vim.opt.completeopt = { "menuone", "noinsert", "noselect" }
vim.opt.swapfile = false
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.scrolloff = 4
vim.opt.whichwrap = "<,>,[,]"
-- Clipboard support
-- https://neovim.io/doc/user/options.html#'clipboard'
vim.opt.clipboard:append({ "unnamedplus" })
-- Mouse support
-- https://neovim.io/doc/user/options.html#'mouse'
vim.opt.mouse = "a"
-- GUI support
vim.opt.guifont = {
"APL385 Unicode:h18",
"Agave:h18",
"Victor Mono:h18",
"Rec Mono Casual:h18",
"Cascadia Code:h18",
"JetBrains Mono:h18",
"Iosevka:h18",
"Fira Code:h18",
}
-- https://neovim.io/doc/user/lua.html#lua-vim-variables
-- https://github.com/mvdan/gofumpt#vim-go
vim.g.go_gopls_gofumpt = 1
-- https://github.com/neovide/neovide/wiki/Configuration
vim.g.neovide_transparency = 0.8
vim.g.neovide_cursor_vfx_mode = "railgun"
-- https://github.com/wbthomason/packer.nvim
require("packer").startup(function()
-- Manage itself
use("wbthomason/packer.nvim")
-- https://github.com/tpope/vim-surround
use("tpope/vim-surround")
-- https://github.com/axelf4/vim-strip-trailing-whitespace
use("axelf4/vim-strip-trailing-whitespace")
-- https://github.com/nvim-lualine/lualine.nvim
use("nvim-lualine/lualine.nvim")
-- Colorschemes
-- https://github.com/cocopon/iceberg.vim
use("cocopon/iceberg.vim")
-- https://github.com/catppuccin/nvim
use({ "catppuccin/nvim", as = "catppuccin" })
-- Programming languages
-- https://github.com/sbdchd/neoformat
use("sbdchd/neoformat")
-- https://github.com/fatih/vim-go
use("fatih/vim-go")
end)
require("lualine").setup({
options = {
icons_enabled = false,
theme = "catppuccin",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
})
require("catppuccin").setup({
transparent_background = true,
})
if vim.fn.getenv("COLORTERM") == "truecolor" then
vim.opt.termguicolors = true
vim.cmd([[ colorscheme catppuccin ]])
else
vim.cmd([[ colorscheme iceberg ]])
end

View File

@ -1,101 +0,0 @@
set breakindent
set completeopt=menuone,noinsert,noselect
set noswapfile
set number
set relativenumber
set scrolloff=4
set virtualedit=block
set whichwrap=<,>,[,]
" tabstop
" https://www.reddit.com/r/vim/wiki/tabstop
set tabstop=8
set softtabstop=4
set shiftwidth=4
set expandtab
" Clipboard support
set clipboard+=unnamedplus
" Mouse support
set mouse=a
" FZF
set rtp+=~/.fzf
" GUI
" Same as VSCode
set guifont=APL385\ Unicode:h18,Agave:h18,Victor\ Mono:h18,Rec\ Mono\ Casual:h18,Cascadia\ Code:h18,JetBrains\ Mono:h18,Iosevka:h18,Fira\ Code:h18
" Plugins config
let g:go_gopls_gofumpt=1
let g:nvim_tree_highlight_opened_files=1
let g:nvim_tree_show_icons={
\ 'git': 0,
\ 'folders': 0,
\ 'files': 0,
\ 'folder_arrows': 0,
\ }
nnoremap <C-n> :NvimTreeToggle<CR>
" https://prettier.io/docs/en/vim.html
let g:neoformat_try_node_exe=1
" https://github.com/neovide/neovide/wiki/Configuration
let g:neovide_transparency=0.8
let g:neovide_input_use_logo=v:true
let g:neovide_cursor_vfx_mode="railgun"
" vim-plug
" https://github.com/junegunn/vim-plug
call plug#begin()
Plug 'kyazdani42/nvim-tree.lua'
Plug 'nvim-lualine/lualine.nvim'
Plug 'tpope/vim-surround'
Plug 'axelf4/vim-strip-trailing-whitespace'
" Colorschemes
Plug 'cocopon/iceberg.vim'
Plug 'joshdick/onedark.vim'
Plug 'projekt0n/github-nvim-theme'
Plug 'catppuccin/nvim', {'as': 'catppuccin'}
" Languages
Plug 'sbdchd/neoformat'
Plug 'fatih/vim-go'
call plug#end()
lua << EOF
local lualine = require("lualine")
local catppuccin = require("catppuccin")
local tree = require("nvim-tree")
lualine.setup({
options = {
icons_enabled = false,
-- theme = 'onedark',
-- theme = 'github',
theme = "catppuccin",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
})
catppuccin.setup({
transparent_background = true,
})
tree.setup({})
EOF
set background=dark
if $TERM == 'xterm-kitty' || $COLORTERM == 'truecolor'
set termguicolors
" colorscheme onedark
" colorscheme github_dark
colorscheme catppuccin
else
colorscheme iceberg
endif