Skip to content

Commit

Permalink
feat(prince): add save-the-world quest
Browse files Browse the repository at this point in the history
prince discovers an ancient prophecy foretelling a great evil
prince must embark on a long and perilous journey to stop the evil
travels through treacherous mountains, dark forests, and hostile kingdoms
faces numerous challenges and obstacles along the way
makes new allies and faces formidable foes
finally reaches the source of the evil and confronts the dark lord
uses cunning, bravery, and the power of friendship to defeat the evil
saves the world from destruction
people celebrate the prince's heroic deeds

BREAKING CHANGE: world is now safe from destruction
  • Loading branch information
marco-zan committed May 23, 2024
1 parent 194249e commit f6f4bb7
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 19 deletions.
74 changes: 56 additions & 18 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ if not vim.loop.fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)

local function getWords()
return tostring(vim.fn.wordcount().words)
end
-- NOTE: Here is where you install your plugins.
-- You can configure plugins using the `config` key.
--
Expand Down Expand Up @@ -88,6 +91,10 @@ require('lazy').setup({
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!).
-- build = "make install_jsregexp"
config = function()
require("luasnip.loaders.from_snipmate").load()
require('luasnip').setup()
end,
},

-- Useful plugin to show you pending keybinds.
Expand Down Expand Up @@ -115,6 +122,14 @@ require('lazy').setup({
}
},

{ "catppuccin/nvim",
name = "catppuccin",
priority = 1000,
opts = {
flavour = "latte",
}
},

{ -- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
Expand All @@ -135,7 +150,7 @@ require('lazy').setup({
lualine_x = {'encoding', 'fileformat'},
lualine_y = {
"location",
-- { getWords }
{ getWords }
},
lualine_z = { "mode" }
},
Expand Down Expand Up @@ -217,6 +232,39 @@ require('lazy').setup({
-- require 'kickstart.plugins.autoformat',
-- require 'kickstart.plugins.debug',

-- To highlight the color in css files. It is sooooo handy
{
'norcalli/nvim-colorizer.lua',
config = function()
require('colorizer').setup {
css = { rgb_fn = true; hsl_fn = true; names = true; RGB = true; RRGGBB = true;};
scss ={ rgb_fn = true; hsl_fn = true; names = true; RGB = true; RRGGBB = true;};
sass = { rgb_fn = true; hsl_fn = true; names = true; RGB = true; RRGGBB = true;};
html = { rgb_fn = true; hsl_fn = true; names = true; RGB = true; RRGGBB = true;};
htmldjango = { rgb_fn = true; hsl_fn = true; names = true; RGB = true; RRGGBB = true;};
'javascript';
'javascriptreact';
'typescript';
'typescriptreact';
'vue';
'svelte';
'lua';
}
end,

},

{
url = 'https://tpope.io/vim/abolish.git',
},
{
"ahmedkhalf/project.nvim",
config = function()
require("project_nvim").setup {}
end,

},

{ import = 'custom.plugins' }
}, {})

Expand Down Expand Up @@ -259,19 +307,8 @@ require('telescope').setup {

-- The real magic: automatically identify the project root based on git files or
-- lsp active in the current buffer
local project_root = function()
local cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1]

-- if not git then active lsp client root
if vim.v.shell_error ~= 0 and vim.lsp.get_active_clients()[1] ~= nil then
-- will get the configured root directory of the first attached lsp. You will have problems if you are using multiple lsps
cwd = vim.lsp.get_active_clients()[1].config.root_dir

-- if not lsp, then the cwd
else
cwd = vim.loop.cwd()
end
return cwd
function PROJECT_ROOT()
return vim.loop.cwd()
end

-- Enable telescope fzf native, if installed
Expand All @@ -283,14 +320,14 @@ vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc =
vim.keymap.set('n', '<leader><space>',
function ()
local opts = {}
opts.cwd = project_root()
opts.cwd = PROJECT_ROOT()
require('telescope.builtin').find_files(opts)
end, { desc = 'Project find files' })

vim.keymap.set('n', '<leader>/',
function ()
local opts = {}
opts.cwd = project_root()
opts.cwd = PROJECT_ROOT()
require('telescope.builtin').live_grep( opts )
end, { desc = '[/] Grep search in current project' })

Expand Down Expand Up @@ -384,14 +421,15 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnos
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })


require("luasnip.loaders.from_snipmate").lazy_load()
require('reymerk.lsp')
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

-- Scelta del colorscheme
-- vim.cmd([[colorscheme monokai-pro]])auto
--
vim.cmd[[colorscheme tokyonight]]
vim.api.nvim_set_hl(0, 'LineNr', { fg = "#9baeff"} )

-- vim.cmd.colorscheme "catppuccin"
require("reymerk.remap")
39 changes: 38 additions & 1 deletion lua/reymerk/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ local on_attach = function(_, bufnr)
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })

end

-- Enable the following language servers
Expand All @@ -57,14 +58,31 @@ local servers = {
pyright = {},
tsserver = {},

html = {
filetypes = { 'html', 'htmldjango' },
},
htmx = {
filetypes = { 'html', 'htmldjango' },
},

jinja_lsp = {
cmd = { '/home/reymerk/.cargo/bin/jinja-lsp'},
filetypes = {'htmldjango', 'html', 'jinja', 'py', 'rs'},
root_dir = PROJECT_ROOT,
init_options = {
templates = './app/templates',
backend = {'./app'},
lang = "python"
}
},
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
}

-- vim.lsp.set_log_level("debug")
-- Setup neovim lua configuration
require('neodev').setup()

Expand All @@ -75,6 +93,7 @@ capabilities.textDocument.foldingRange = {
lineFoldingOnly = true
}
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
capabilities.offsetEncoding = "utf-8"

-- Setup mason so it can manage external tooling
require('mason').setup()
Expand Down Expand Up @@ -106,6 +125,8 @@ local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}

local compare = cmp.config.compare

cmp.setup {
snippet = {
expand = function(args)
Expand Down Expand Up @@ -152,4 +173,20 @@ cmp.setup {
{ name = 'luasnip' },
{ name = 'path' },
},
sorting = {
priority_weight = 1.0,
comparators = {
-- compare.score_offset, -- not good at all
compare.locality,
compare.recently_used,
compare.score, -- based on : score = score + ((#sources - (source_index - 1)) * sorting.priority_weight)
compare.offset,
compare.order,
-- compare.scopes, -- what?
-- compare.sort_text,
-- compare.exact,
-- compare.kind,
-- compare.length, -- useless
}
},
}

0 comments on commit f6f4bb7

Please sign in to comment.