Last active
March 21, 2022 13:14
-
-
Save zoomlogo/72d54efb89b4f23e93484089746a4648 to your computer and use it in GitHub Desktop.
my neovim lua config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- vim settings | |
vim.cmd([[ | |
set guifont=Iosevka\ Kalki,agave\ NF\ r:h13 | |
]]) | |
vim.o.expandtab = true | |
vim.o.tabstop = 4 | |
vim.o.shiftwidth = 4 | |
vim.o.number = true | |
vim.o.relativenumber = true | |
vim.cmd("filetype plugin indent on") | |
vim.o.signcolumn = "yes" | |
vim.o.hlsearch = false | |
vim.o.showtabline = 2 | |
vim.o.clipboard = "unnamedplus" | |
vim.o.swapfile = false | |
vim.o.backup = false | |
vim.o.writebackup = false | |
vim.o.autoread = true | |
vim.o.termguicolors = true | |
vim.o.scrolloff = 1 | |
vim.o.laststatus = 3 | |
vim.o.showcmd = true | |
vim.o.showmode = false | |
vim.o.shortmess = "filnxtToOFc" | |
vim.o.encoding = "utf-8" | |
vim.o.completeopt = "menuone,noselect" | |
vim.cmd([[ | |
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
inoremap <expr> <C-n> pumvisible() ? '<C-n>' : | |
\ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>' | |
inoremap <expr> <M-,> pumvisible() ? '<C-n>' : | |
\ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>' | |
]]) | |
vim.o.wrap = false | |
-- mapping functions | |
function map(mode, shortcut, command) | |
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true }) | |
end | |
function nmap(shortcut, command) | |
map('n', shortcut, command) | |
end | |
function imap(shortcut, command) | |
map('i', shortcut, command) | |
end | |
nmap("<space>", "<nop>") | |
vim.g.mapleader = " " | |
vim.cmd([[ | |
autocmd VimLeave * set guicursor=a:ver25 | |
autocmd BufReadPost * silent! normal! g`"zv | |
autocmd TextYankPost * lua vim.highlight.on_yank{higroup="IncSearch", timeout=150, on_visual=true} | |
]]) | |
nmap("Q", "@q") | |
nmap("<leader>w", ":w<CR>") | |
nmap("<leader>t", ":tabnew<CR>") | |
nmap("<c-p>", ":tabnext<CR>") | |
nmap("<leader>h", ":vsplit<CR>") | |
nmap("<leader>v", ":split<CR>") | |
nmap("<leader>cd", ":cd %/..<CR>") | |
nmap("*", "<Plug>(asterisk-z*)") | |
nmap("#", "<Plug>(asterisk-z#)") | |
nmap("g*", "<Plug>(asterisk-gz*)") | |
nmap("g#", "<Plug>(asterisk-gz#)") | |
local Plug = vim.fn['plug#'] | |
vim.call('plug#begin', '~/AppData/Local/nvim/plugged') | |
Plug "PyGamer0/defined.nvim" | |
Plug "rktjmp/lush.nvim" | |
Plug "andreasvc/vim-256noir" | |
Plug "Yggdroot/indentLine" | |
Plug "yegappan/mru" | |
Plug "airblade/vim-rooter" | |
Plug "norcalli/nvim-colorizer.lua" | |
Plug "lewis6991/gitsigns.nvim" | |
Plug "Kethku/golden-ratio" | |
Plug "mg979/vim-visual-multi" | |
Plug "tpope/vim-commentary" | |
Plug "skywind3000/vim-terminal-help" | |
Plug "PyGamer0/vim-apl" | |
Plug "PyGamer0/font_changer.vim" | |
Plug "PyGamer0/colorscheme_changer.vim" | |
Plug "danilo-augusto/vim-afterglow" | |
Plug "nvim-telescope/telescope.nvim" | |
Plug "nvim-lua/popup.nvim" | |
Plug "tpope/vim-abolish" | |
Plug "tpope/vim-surround" | |
Plug "nvim-lua/plenary.nvim" | |
Plug "tversteeg/registers.nvim" | |
Plug "winston0410/range-highlight.nvim" | |
Plug "rcarriga/nvim-notify" | |
Plug "NTBBloodbath/galaxyline.nvim" | |
Plug "junegunn/rainbow_parentheses.vim" | |
Plug("psf/black", {branch = "stable"}) | |
Plug "nathom/filetype.nvim" | |
Plug "junegunn/vim-easy-align" | |
Plug("https://codeberg.org/ngn/k", {rtp = "vim-k"}) | |
Plug "haya14busa/vim-asterisk" | |
vim.call('plug#end') | |
vim.cmd("colorscheme defined") | |
vim.cmd([[ | |
autocmd FileType python,c,cpp,javascript execute ':RainbowParentheses' | |
let g:rainbow#pairs = [['(', ')'], ['[', ']'], ['{', '}'] ] | |
]]) | |
if vim.api.nvim_eval("has('win32')") then | |
vim.g.terminal_shell = "zsh" | |
end | |
vim.g.indentLine_char = "▏" | |
vim.g.font_changer_fonts = {'Courier\\ Prime,Agave\\ NF\\ r:h12', 'Iosevka\\ Kalki,Agave\\ NF\\ r:h13', 'SAX2,Agave\\ NF\\ r:h14', 'BQN386\\ Unicode,Agave\\ NF\\ r:h14', 'IBM\\ 3270,Agave\\ NF\\ r:h14', 'Agave\\ NF\\ r:h14'} | |
nmap("<leader>cf", "<cmd>ChangeFont<cr>") | |
vim.g.colorscheme_changer_colors={'defined', 'afterglow', 'slate', 'cemant'} | |
nmap("<leader>cc", "<cmd>ChangeColor<cr>") | |
vim.g.rooter_patterns = {".git", "Makefile", "*.sln", "build/env.sh", "src", "CMakeLists.txt", "build.sh", "Cargo.toml", "setup.py"} | |
nmap("<leader>ff", "<cmd>Telescope find_files<cr>") | |
nmap("<leader>fg", "<cmd>Telescope live_grep<cr>") | |
nmap("<leader>fb", "<cmd>Telescope buffers<cr>") | |
nmap("<leader>fh", "<cmd>Telescope help_tags<cr>") | |
nmap("<leader>m", "<cmd>MRU<CR>") | |
require("notify").setup({ | |
stages = "slide", | |
icons = { | |
ERROR = "", | |
WARN = "", | |
INFO = "", | |
DEBUG = "d", | |
TRACE = "t", | |
}, | |
}) | |
vim.notify = require("notify") | |
require 'colorizer'.setup() | |
require 'gitsigns'.setup() | |
-- other | |
local signs = { Error = " ", Warning = " ", Hint = " ", Information = " " } | |
for type, icon in pairs(signs) do | |
local hl = "LspDiagnosticsSign" .. type | |
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) | |
end | |
-- galaxyline config | |
local gl = require "galaxyline" | |
local colors = require "galaxyline.themes.colors" | |
colors = colors["doom-one"] | |
local condition = require "galaxyline.condition" | |
local gls = gl.section | |
gls.left[1] = { | |
RainbowRed = { | |
provider = function() | |
return "▊ " | |
end, | |
highlight = { colors.blue, colors.bg }, | |
}, | |
} | |
gls.left[2] = { | |
ViMode = { | |
provider = function() | |
local mode_color = { | |
n = colors.red, | |
i = colors.green, | |
v = colors.blue, | |
[""] = colors.blue, | |
V = colors.blue, | |
c = colors.magenta, | |
no = colors.red, | |
s = colors.orange, | |
S = colors.orange, | |
[""] = colors.orange, | |
ic = colors.yellow, | |
R = colors.violet, | |
Rv = colors.violet, | |
cv = colors.red, | |
ce = colors.red, | |
r = colors.cyan, | |
rm = colors.cyan, | |
["r?"] = colors.cyan, | |
["!"] = colors.red, | |
t = colors.red, | |
} | |
vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()]) | |
return " " | |
end, | |
highlight = { colors.red, colors.bg, "bold" }, | |
}, | |
} | |
gls.left[3] = { | |
FileName = { | |
provider = "FileName", | |
condition = condition.buffer_not_empty, | |
highlight = { colors.magenta, colors.bg, "bold" } | |
} | |
} | |
gls.right[1] = { | |
FileEncode = { | |
provider = "FileEncode", | |
condition = condition.hide_in_width, | |
separator = " ", | |
separator_highlight = { "NONE", colors.bg }, | |
highlight = { colors.green, colors.bg, "bold" }, | |
}, | |
} | |
gls.right[2] = { | |
GitIcon = { | |
provider = function() | |
return " " | |
end, | |
condition = condition.check_git_workspace, | |
separator = " ", | |
separator_highlight = { "NONE", colors.bg }, | |
highlight = { colors.violet, colors.bg, "bold" }, | |
}, | |
} | |
gls.right[3] = { | |
GitBranch = { | |
provider = "GitBranch", | |
condition = condition.check_git_workspace, | |
highlight = { colors.violet, colors.bg, "bold" }, | |
}, | |
} | |
gls.right[4] = { | |
RainbowBlue = { | |
provider = function() | |
return " ▊" | |
end, | |
highlight = { colors.blue, colors.bg }, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment