Migrated to lua

This commit is contained in:
Јован Ђокић-Шумарац 2023-07-29 15:00:35 +02:00
parent a3ff157958
commit e071cec83e
18 changed files with 554 additions and 166 deletions

2
init.lua Normal file
View file

@ -0,0 +1,2 @@
require("trixy")

148
init.vim
View file

@ -1,148 +0,0 @@
" ███ ▄████████ ▄█ ▀████ ▐████▀ ▄██ ▄
" ▀█████████▄ ███ ███ ███ ███▌ ████▀ ███ ██▄
" ▀███▀▀██ ███ ███ ███▌ ███ ▐███ ███▄▄▄███
" ███ ▀ ▄███▄▄▄▄██▀ ███▌ ▀███▄███▀ ▀▀▀▀▀▀███
" ███ ▀▀███▀▀▀▀▀ ███▌ ████▀██▄ ▄██ ███
" ███ ▀███████████ ███ ▐███ ▀███ ███ ███
" ███ ███ ███ ███ ▄███ ███▄ ███ ███
" ▄████▀ ███ ███ █▀ ████ ███▄ ▀█████▀
" ███ ███
" __ ___ ___ __
" / _` |__ |\ | |__ |__) /\ |
" \__> |___ | \| |___ | \ /~~\ |___
set nocompatible
set showmatch
set hlsearch
set incsearch
set tabstop=16
set softtabstop=4
set shiftwidth=4
set autoindent
set number relativenumber
set wildmode=longest,list
" set cc=80
filetype off
let &runtimepath.=',~/.vim/bundle/neoterm'
filetype plugin on
filetype plugin indent on
syntax on
set mouse=v
set mouse=a
set clipboard=unnamedplus
set ttyfast
set cursorline
set splitbelow
set undofile
set autochdir
set signcolumn=yes:1
" __ __ __
" |__) | | | / _` | |\ | /__`
" | |___ \__/ \__> | | \| .__/
lua require('init')
" __ __ __ ___ ___ __
" /__` |\ | | |__) |__) |__ | /__`
" .__/ | \| | | | |___ | .__/
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="jk"
let g:UltiSnipsJumpBackwardTrigger="kj"
let g:UltiSnipsSnippetDirectories = [$HOME.'/.config/nvim/UltiSnips']
let g:UltiSnipsEditSplit = 'context'
" __ __ __ __ __ __ ___ ___
" / ` / \ | / \ |__) /__` / ` |__| |__ |\/| |__
" \__, \__/ |___ \__/ | \ .__/ \__, | | |___ | | |___
set termguicolors
set background=dark
let g:onedark_config = {
\ 'style': 'darker',
\}
colorscheme onedark
" ___ __ __ __
" |__/ |__ \ / |__) | |\ | | \ /__`
" | \ |___ | |__) | | \| |__/ .__/
let mapleader=" "
nnoremap <leader>tw <cmd>lua MiniTrailspace.trim()<CR>
nnoremap <leader>ff <cmd>Telescope find_files<CR>
nnoremap <leader>fm <cmd>NERDTree<CR>
nnoremap <leader>fc <cmd>NERDTreeClose<CR>
nnoremap <leader>tt <cmd>12 split <CR><cmd>Tnew<CR>
nnoremap <leader>sc <cmd>TSEnable highlight<CR>
nnoremap <leader>zt <cmd>Twilight<CR>
nnoremap <leader>zz <cmd>ZenMode<CR>
nnoremap <leader>v :vsplit ~/.config/nvim/init.vim<CR>
nnoremap <leader>V :source ~/.config/nvim/init.vim<CR>
" nnoremap <leader>s :UltiSnipsEdit<CR>
" nnoremap <leader>S :call UltiSnips#RefreshSnippets() <CR>
map <silent> w <Plug>CamelCaseMotion_w
map <silent> b <Plug>CamelCaseMotion_b
map <silent> e <Plug>CamelCaseMotion_e
map <silent> ge <Plug>CamelCaseMotion_ge
sunmap w
sunmap b
sunmap e
sunmap ge

View file

@ -32,7 +32,6 @@ require("lazy").setup({
"navarasu/onedark.nvim", "navarasu/onedark.nvim",
"HiPhish/nvim-ts-rainbow2", "HiPhish/nvim-ts-rainbow2",
"NvChad/nvim-colorizer.lua", "NvChad/nvim-colorizer.lua",
"folke/noice.nvim",
"gen740/SmoothCursor.nvim", "gen740/SmoothCursor.nvim",
"folke/twilight.nvim", "folke/twilight.nvim",
"folke/zen-mode.nvim", "folke/zen-mode.nvim",
@ -40,25 +39,88 @@ require("lazy").setup({
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
"tamton-aquib/staline.nvim", "tamton-aquib/staline.nvim",
"willothy/veil.nvim",
{ 'echasnovski/mini.nvim', version = false },
"kassio/neoterm", "kassio/neoterm",
{"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"}, "willothy/veil.nvim",
{ "SirVer/ultisnips", lazy = true },
{ "lervag/vimtex", lazy = true },
"bkad/camelcasemotion", "bkad/camelcasemotion",
"ggandor/lightspeed.nvim", "ggandor/lightspeed.nvim",
"chentoast/marks.nvim", "chentoast/marks.nvim",
{ "nvim-neorg/neorg", lazy = true },
"nvim-lua/plenary.nvim",
"tpope/vim-commentary", "tpope/vim-commentary",
"preservim/nerdtree", "preservim/nerdtree",
"nvim-telescope/telescope.nvim",
"nvim-telescope/telescope-file-browser.nvim",
{
"m4xshen/hardtime.nvim",
opts = {}
},
{
"folke/noice.nvim",
config = true,
},
{
"willothy/veil.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-file-browser.nvim"
},
config = true,
},
-- size does not matter
{
'echasnovski/mini.nvim',
version = false
},
-- need that syntax highlight amirite
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate"
},
-- the name says it all
{
"SirVer/ultisnips",
lazy = true
},
-- That shmexy latex plugin
{
"lervag/vimtex",
lazy = true
},
-- DAMN, org mode?
{
"nvim-neorg/neorg",
lazy = true
},
-- Cool screensaver !!
{
"folke/drop.nvim",
event = "VimEnter",
config = function()
require('drop').setup
{
---@type DropTheme|string
theme = "leaves", -- can be one of rhe default themes, or a custom theme
max = 15, -- maximum number of drops on the screen
interval = 100, -- every 150ms we update the drops
screensaver = 1000 * 60 * 1, -- show after 5 minutes. Set to false, to disable
filetypes = { "veil" }, -- will enable/disable automatically for the following filetypes
}
end,
},
}) })
@ -73,8 +135,6 @@ require('mini.pairs').setup()
require('mini.trailspace').setup() require('mini.trailspace').setup()
require('mini.hipatterns').setup() require('mini.hipatterns').setup()
require('mini.indentscope').setup() require('mini.indentscope').setup()
require('noice').setup()
require('veil').setup()
-- require('mason').setup() -- require('mason').setup()
-- require('mini.files').setup() -- require('mini.files').setup()
-- require('mini.statusline').setup() -- require('mini.statusline').setup()
@ -98,6 +158,11 @@ vim.keymap.set('i', '<S-Tab>', [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]], { expr
--} --}
require('neorg').setup { require('neorg').setup {
load = { load = {
["core.defaults"] = {}, -- Loads default behaviour ["core.defaults"] = {}, -- Loads default behaviour

6
lua/trixy/colors.lua Normal file
View file

@ -0,0 +1,6 @@
vim.opt.termguicolors = true
vim.opt.background = "dark"
vim.g.onedark_config = { style = 'darker' }
vim.cmd("colorscheme onedark")

9
lua/trixy/drop.lua Normal file
View file

@ -0,0 +1,9 @@
require('drop').setup
{
---@type DropTheme|string
theme = "leaves", -- can be one of rhe default themes, or a custom theme
max = 15, -- maximum number of drops on the screen
interval = 100, -- every 150ms we update the drops
screensaver = 1000 * 60 * 1, -- show after 5 minutes. Set to false, to disable
filetypes = { "veil" }, -- will enable/disable automatically for the following filetypes
}

10
lua/trixy/harpoon.lua Normal file
View file

@ -0,0 +1,10 @@
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
vim.keymap.set("n", "<leader>ma", mark.add_file)
vim.keymap.set("n", "<leader>mm", ui.toggle_quick_menu)
vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end)
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)

13
lua/trixy/init.lua Normal file
View file

@ -0,0 +1,13 @@
require("trixy.lazy")
require("trixy.neorg")
require("trixy.smoothcursor")
require("trixy.staline")
require("trixy.opts")
require("trixy.colors")
require("trixy.keybind")
require("trixy.treesitter")
require("trixy.harpoon")
require("trixy.drop")
require("trixy.mini")
require("trixy.lsp-zero")
--require("trixy.marks")

44
lua/trixy/keybind.lua Normal file
View file

@ -0,0 +1,44 @@
local map = vim.api.nvim_set_keymap
local cmap = vim.keymap.set
local options = { noremap = true }
local cmd_options = { noremap = true, silent = true }
local tele = require('telescope.builtin')
vim.g.mapleader = " "
-- TELESCOPE
cmap("n", "<leader>ff", tele.find_files, options)
cmap("n", "<leader>fg", tele.git_files, options)
cmap("n", "<leader>fg", tele.git_files, options)
cmap("n", "<leader>fs", function()
tele.grep_string({ search = vim.fn.input("Grep > ") });
end)
map("n", "<leader>tw", "<cmd>lua MiniTrailspace.trim()<CR>", options)
map("n", "<leader>fm", "<cmd>NERDTree<CR>", options)
map("n", "<leader>fc", "<cmd>NERDTreeClose<CR>", options)
map("n", "<leader>tt", "<cmd>12 split <CR><cmd>Tnew<CR>", options)
map("n", "<leader>sc", "<cmd>TSEnable highlight<CR>", options)
map("n", "<leader>zt", "<cmd>Twilight<CR>", options)
map("n", "<leader>zz", "<cmd>ZenMode<CR>", options)
map("n", "<leader>v", "<cmd>vsplit ~/.config/nvim/init.lua<CR>", options)
map("n", "<leader>V", "<cmd>source ~/.config/nvim/init.lua<CR>", options)
map("n", "w", "<Plug>CamelCaseMotion_w", cmd_options)
map("n", "b", "<Plug>CamelCaseMotion_b", cmd_options)
map("n", "e", "<Plug>CamelCaseMotion_e", cmd_options)
map("n", "ge", "<Plug>CamelCaseMotion_ge", cmd_options)

151
lua/trixy/lazy.lua Normal file
View file

@ -0,0 +1,151 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- require("lazy").setup(plugins, opts)
require("lazy").setup({
"navarasu/onedark.nvim",
"HiPhish/nvim-ts-rainbow2",
"gen740/SmoothCursor.nvim",
"folke/twilight.nvim",
"folke/zen-mode.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons",
"tamton-aquib/staline.nvim",
"kassio/neoterm",
"willothy/veil.nvim",
"bkad/camelcasemotion",
"ggandor/lightspeed.nvim",
"tpope/vim-commentary",
"preservim/nerdtree",
"ThePrimeagen/harpoon",
{
"NvChad/nvim-colorizer.lua",
config = function()
require('colorizer').setup()
end,
},
{
"m4xshen/hardtime.nvim",
lazy = true,
opts = {}
},
{
"folke/noice.nvim",
config = true,
},
{
"willothy/veil.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-file-browser.nvim"
},
config = true,
},
-- size does not matter
{
'echasnovski/mini.nvim',
version = false,
},
-- need that syntax highlight amirite
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate"
},
-- the name says it all
{
"SirVer/ultisnips",
lazy = true
},
-- That shmexy latex plugin
{
"lervag/vimtex",
lazy = true
},
-- DAMN, org mode?
{
"nvim-neorg/neorg",
lazy = true
},
-- Cool screensaver !!
{
"folke/drop.nvim",
event = "VimEnter",
},
{
'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x',
dependencies = {
-- LSP Support
{'neovim/nvim-lspconfig'}, -- Required
{'williamboman/mason.nvim'}, -- Optional
{'williamboman/mason-lspconfig.nvim'}, -- Optional
-- Autocompletion
{'hrsh7th/nvim-cmp'}, -- Required
{'hrsh7th/cmp-nvim-lsp'}, -- Required
{'L3MON4D3/LuaSnip'}, -- Required
}
},
})
vim.opt.laststatus=2
vim.keymap.set('i', '<Tab>', [[pumvisible() ? "\<C-n>" : "\<Tab>"]], { expr = true })
vim.keymap.set('i', '<S-Tab>', [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]], { expr = true })

54
lua/trixy/lsp-zero.lua Normal file
View file

@ -0,0 +1,54 @@
local lsp = require('lsp-zero').preset({})
lsp.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp.default_keymaps({buffer = bufnr})
end)
-- (Optional) Configure lua language server for neovim
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
lsp.setup()
-- You need to setup `cmp` after lsp-zero
local cmp = require('cmp')
local cmp_action = require('lsp-zero').cmp_action()
cmp.setup({
mapping = {
-- `Enter` key to confirm completion
['<CR>'] = cmp.mapping.confirm({select = true}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, {"i", "s"}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, {"i", "s"}),
-- Ctrl+Space to trigger completion menu
['<C-Space>'] = cmp.mapping.complete(),
-- Navigate between snippet placeholder
['<C-f>'] = cmp_action.luasnip_jump_forward(),
['<C-b>'] = cmp_action.luasnip_jump_backward(),
}
})

20
lua/trixy/marks.lua Normal file
View file

@ -0,0 +1,20 @@
require'marks'.setup {
default_mappings = true,
builtin_marks = { ".", "<", ">", "^" },
cyclic = true,
force_write_shada = false,
refresh_interval = 250,
sign_priority = { lower=10, upper=15, builtin=8, bookmark=20 },
excluded_filetypes = {},
bookmark_0 = {
sign = "",
virt_text = "hello world",
-- defaults to false.
annotate = false,
},
mappings = {}
}

5
lua/trixy/mini.lua Normal file
View file

@ -0,0 +1,5 @@
require('mini.cursorword').setup()
require('mini.pairs').setup()
require('mini.trailspace').setup()
require('mini.hipatterns').setup()
require('mini.indentscope').setup()

13
lua/trixy/neorg.lua Normal file
View file

@ -0,0 +1,13 @@
require('neorg').setup {
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {}, -- Adds pretty icons to your documents
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
notes = "~/notes",
},
},
},
},
}

43
lua/trixy/opts.lua Normal file
View file

@ -0,0 +1,43 @@
local o = vim.opt
o.number = true -- enable line number
o.relativenumber = true -- enable relative line number
o.undofile = true -- persistent undo
o.backup = false -- disable backup
o.autowrite = true -- auto write buffer when it's not focused
o.ignorecase = true -- case insensitive on search..
o.list = true -- display listchars
o.smartindent = true -- smarter indentation
o.smarttab = true -- make tab behaviour smarter
o.splitright = true -- split right instead of left
o.splitkeep = "screen" -- stabilize split
o.startofline = false -- don't go to the start of the line when moving to another file
o.swapfile = false -- disable swapfile
o.termguicolors = true -- true colours for better experience
o.wrap = false -- don't wrap lines
o.backupcopy = "yes" -- fix weirdness for stuff that replaces the entire file when hot reloading
o.compatible = false
o.showmatch = true
o.hlsearch = true
o.incsearch = true
o.tabstop = 16
o.softtabstop = 4
o.shiftwidth = 4
o.autoindent = true
o.wildmode = "longest,list"
o.mouse = "v"
o.mouse = "a"
o.clipboard = "unnamedplus"
o.ttyfast = true
o.cursorline = true
o.splitbelow = true
o.autochdir = true
o.signcolumn="yes:1"
vim.api.nvim_command("filetype off")
vim.api.nvim_command("let &runtimepath.=',~/.vim/bundle/neoterm'")
vim.api.nvim_command("filetype plugin on")
vim.api.nvim_command("filetype plugin indent on")
vim.api.nvim_command("syntax on")

View file

@ -0,0 +1,35 @@
require('smoothcursor').setup({
autostart = true,
cursor = "", -- cursor shape (need nerd font)
texthl = "SmoothCursor", -- highlight group, default is { bg = nil, fg = "#FFD400" }
linehl = nil, -- highlight sub-cursor line like 'cursorline', "CursorLine" recommended
type = "default", -- define cursor movement calculate function, "default" or "exp" (exponential).
fancy = {
enable = true, -- enable fancy mode
head = { cursor = "", texthl = "SmoothCursor", linehl = nil },
body = {
{ cursor = "", texthl = "SmoothCursorYellow" },
{ cursor = "", texthl = "SmoothCursorYellow" },
{ cursor = "", texthl = "SmoothCursorYellow" },
{ cursor = "", texthl = "SmoothCursorYellow" },
{ cursor = "", texthl = "SmoothCursorYellow" },
{ cursor = ".", texthl = "SmoothCursorYellow" },
{ cursor = ".", texthl = "SmoothCursorYellow" },
},
tail = { cursor = nil, texthl = "SmoothCursor" }
},
flyin_effect = nil, -- "bottom" or "top"
speed = 50, -- max is 100 to stick to your current position
intervals = 25, -- tick interval
priority = 10, -- set marker priority
timeout = 1500, -- timout for animation
threshold = 3, -- animate if threshold lines jump
disable_float_win = false, -- disable on float window
enabled_filetypes = nil, -- example: { "lua", "vim" }
disabled_filetypes = nil, -- this option will be skipped if enabled_filetypes is set. example: { "TelescopePrompt", "NvimTree" }
})

56
lua/trixy/staline.lua Normal file
View file

@ -0,0 +1,56 @@
require('staline').setup {
defaults = {
expand_null_ls = false, -- This expands out all the null-ls sources to be shown
left_separator = "",
right_separator = "",
full_path = false,
line_column = "[%l/%L] 並%p%% ", -- `:h stl` to see all flags.
fg = "#000000", -- Foreground text color.
bg = "none", -- Default background is transparent.
inactive_color = "#303030",
inactive_bgcolor = "none",
true_colors = true, -- true lsp colors.
font_active = "none", -- "bold", "italic", "bold,italic", etc
mod_symbol = "",
lsp_client_symbol = "",
lsp_client_character_length = 12, -- Shorten LSP client names.
branch_symbol = "",
cool_symbol = "", -- Change this to override default OS icon.
null_ls_symbol = "", -- A symbol to indicate that a source is coming from null-ls
},
mode_colors = {
n = "#4799eb",
i = "#986fec",
c = "#e27d60",
v = "#2bbb4f", -- etc..
},
mode_icons = {
n = " Normal",
i = " Insert",
c = " Command",
v = " Visual", -- etc..
},
sections = {
left = { '- ', '-mode', 'left_sep_double', ' ', 'branch' },
mid = { 'file_name' },
right = { 'cool_symbol','right_sep_double', '-line_column' },
},
inactive_sections = {
left = { 'branch' },
mid = { 'file_name' },
right = { 'line_column' }
},
lsp_symbols = {
Error="",
Info="",
Warn="",
Hint="",
},
}

15
lua/trixy/treesitter.lua Normal file
View file

@ -0,0 +1,15 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "haskell", "go", "bash" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
enable = true,
},
}

View file

@ -1,10 +1,5 @@
#!/bin/sh #!/bin/sh
# INSTALL PLUG
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
# INSTALL CONFIG # INSTALL CONFIG
nvim +PlugInstall +"TSInstall c haskell bash go python" #+"MasonInstall bash-language-server clangd gopls texlab" nvim +"Lazy sync" +"TSInstall c haskell bash go python" #+"MasonInstall bash-language-server clangd gopls texlab"