Compare commits

...

3 commits

Author SHA1 Message Date
17d2889387 change backlight backend 2025-02-04 23:12:21 +01:00
d498021fd4 fix syntax 2025-02-04 23:10:12 +01:00
bc3d990481 revamped nvim config with lazy.nvim 2025-02-04 23:08:59 +01:00
15 changed files with 223 additions and 317 deletions

View file

@ -1,4 +1,3 @@
import = ["colors.toml"]
[font]
size = 16.0
@ -8,3 +7,6 @@ family = "JetBrainsMono Nerd Font"
[window]
opacity = 0.8
[general]
import = ["colors.toml"]

View file

@ -1,69 +1,11 @@
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
----------------------
-- general settings --
----------------------
local set = vim.opt
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
set.foldmethod = 'marker'
require("config.options")
require("config.lazy")
set.wrap = true
set.linebreak = true
set.breakindent = true
set.breakindentopt = {'shift:2', 'sbr'}
set.showbreak = ' >'
set.number = true
set.relativenumber = true
set.encoding = "utf-8"
-- search
set.hlsearch = true
set.ignorecase = true
set.smartcase = true
-- indentation
set.smarttab = true
set.expandtab = false
set.copyindent = true
set.preserveindent = true
set.tabstop = 4
set.shiftwidth = 4
set.softtabstop = 0
local mdgroup = vim.api.nvim_create_augroup("WrapMarkdown", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown,txt",
callback = function()
vim.opt_local.colorcolumn = "85"
vim.opt_local.textwidth = 85
end,
group = WrapMarkdown,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "latex,tex",
callback = function()
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
end,
})
vim.api.nvim_create_autocmd("TextYankPost", {
command = "silent! lua vim.highlight.on_yank()",
})
vim.cmd [[
let g:vim_markdown_folding_disabled=1
]]
-- removes the background color to have it transparent
vim.api.nvim_create_autocmd({"ColorScheme"}, {
pattern = {"*"},
command = "hi Normal ctermbg=none guibg=none",
})
vim.cmd("colorscheme kanagawa")
require('plugins')
--require('core.colors')
require('core.mappings')
-- mappings
vim.keymap.set("n", "<leader><leader>", "/<++><CR>ca>")
vim.keymap.set("n", "s", "<Nop>")
vim.cmd[[colorscheme tokyonight]]

View file

@ -0,0 +1,37 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ "folke/which-key.nvim", lazy = true },
{
'windwp/nvim-autopairs',
event = "InsertEnter",
config = true
-- use opts = {} for passing setup options
-- this is equivalent to setup({}) function
},
{ "christoomey/vim-tmux-navigator" },
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "tokyonight" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

View file

@ -0,0 +1,32 @@
vim.opt.wrap = true
vim.opt.linebreak = true
vim.opt.breakindent = true
vim.opt.breakindentopt = {'shift:2', 'sbr'}
vim.opt.showbreak = ' >'
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.encoding = "utf-8"
-- search
vim.opt.hlsearch = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- indentation
vim.opt.smarttab = true
vim.opt.expandtab = false
vim.opt.copyindent = true
vim.opt.preserveindent = true
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 0
vim.api.nvim_create_autocmd('FileType', {
pattern = { "*.py" },
callback = function()
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
end
})

View file

@ -1,14 +0,0 @@
--------------
-- mappings --
--------------
local map = vim.api.nvim_set_keymap
vim.g.mapleader = ' '
map('n', '<Space>', '', {})
map('n', '<Leader>n', '<cmd>:bnext<CR>', {})
map('n', '<Leader>p', '<cmd>:bprevious<CR>', {})
map('n', '<Leader>h', '<cmd>:nohlsearch<CR>', {})
-- nvim-tree mappings
map('n', '<Leader>t', '<cmd>:NvimTreeToggle<CR>', {})
map('n', '<Leader>z', '<cmd>:ZenMode<CR>', {})

View file

@ -0,0 +1,15 @@
return {
-- the colorscheme should be available when starting Neovim
{
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
opts = {
transparent = true,
styles = {
sidebars = "transparent",
floats = "transparent",
},
}
}
}

View file

@ -1,95 +0,0 @@
-------------
-- plugins --
-------------
require "paq" {
"savq/paq-nvim"; -- Let Paq manage itself
-- general plugins
"nvim-lualine/lualine.nvim";
--{ 'nvim-tree/nvim-web-devicons', opt=true };
'nvim-tree/nvim-web-devicons';
'romgrk/barbar.nvim';
'ggandor/lightspeed.nvim';
'L3MON4D3/LuaSnip'; -- Snippets plugin
'saadparwaiz1/cmp_luasnip'; -- Snippets source for nvim-cmp
-- colorschemes --
'rebelot/kanagawa.nvim';
'folke/tokyonight.nvim';
-- code related --
'neovim/nvim-lspconfig'; -- Configs for Nvim LSP
'hrsh7th/nvim-cmp'; -- Autocompletion plugin
'hrsh7th/cmp-nvim-lsp'; -- LSP source for nvim-cmp
'nvim-lua/plenary.nvim'; -- Dependency for telescope
'nvim-telescope/telescope.nvim'; -- Fuzzy finder
{'nvim-telescope/telescope-fzf-native.nvim', run='make' };
'nvim-treesitter/nvim-treesitter'; -- Better syntax highlighting
'nvim-tree/nvim-tree.lua'; -- File Explorer
'numToStr/Comment.nvim'; -- Quickly comment lines
'windwp/nvim-autopairs';
'tpope/vim-surround';
'lukas-reineke/indent-blankline.nvim';
'ap/vim-css-color';
-- writing
'dhruvasagar/vim-table-mode';
'folke/zen-mode.nvim';
'folke/twilight.nvim';
}
-- looks like tablemode for vim-table-mode in markdown
vim.cmd [[
function! s:isAtStartOfLine(mapping)
let text_before_cursor = getline('.')[0 : col('.')-1]
let mapping_pattern = '\V' . escape(a:mapping, '\')
let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\')
return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$')
endfunction
inoreabbrev <expr> <bar><bar>
\ <SID>isAtStartOfLine('\|\|') ?
\ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>'
inoreabbrev <expr> __
\ <SID>isAtStartOfLine('__') ?
\ '<c-o>:silent! TableModeDisable<cr>' : '__'
]]
require'plugins.lualine'
require'plugins.nvim-treesitter'
require'plugins.nvim-cmp'
require'plugins.telescope'
require'Comment'.setup()
require'nvim-tree'.setup()
require'indent_blankline'.setup{
show_current_context = true,
}
require'nvim-web-devicons'.setup{
color_icons = true;
default = true;
}
-- setup barbar
require'bufferline'.setup{
icons = true,
}
require'zen-mode'.setup{
window = {
width = 85,
},
plugins = {
options = {
enabled = true,
},
kitty = {
enabled = true,
font = "+4",
},
},
}
require'twilight'.setup{
dimming = {
alpha = 0.80,
},
}

View file

@ -1,28 +0,0 @@
require'lualine'.setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {},
always_divide_middle = true,
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
extensions = {}
}

View file

@ -0,0 +1,21 @@
return{
{'echasnovski/mini.nvim', version = '*'},
{
'echasnovski/mini.surround',
version = '*',
opts = {
mappings = {
add = 'sa', -- Add surrounding in Normal and Visual modes
delete = 'sd', -- Delete surrounding
find = 'sf', -- Find surrounding (to the right)
find_left = 'sF', -- Find surrounding (to the left)
highlight = 'sh', -- Highlight surrounding
replace = 'sr', -- Replace surrounding
update_n_lines = 'sn', -- Update `n_lines`
suffix_last = 'l', -- Suffix to search with "prev" method
suffix_next = 'n', -- Suffix to search with "next" method
},
},
},
}

View file

@ -1,74 +0,0 @@
local luasnip = require 'luasnip'
local cmp = require 'cmp'
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,
},
sources = {
{ name = 'path'},
{ name = 'nvim_lsp', keywordlength=3 },
{ name = 'buffer', keywordlength=3 },
{ name = 'luasnip', keywordlength=2 },
},
}
require('nvim-autopairs').setup{}
cmp.event:on(
'confirm_done',
require('nvim-autopairs.completion.cmp').on_confirm_done({
map_char = { tex = '' }
})
)
--------------------
-- Configure LSPs --
--------------------
-- require'lspconfig'.pylsp.setup{}
-- Add additional capabilities supported by nvim-cmp
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
local lspconfig = require('lspconfig')
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'clangd', 'rust_analyzer', 'pylsp', 'tsserver', 'jdtls' }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
capabilities = capabilities,
}
end
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}

View file

@ -1,15 +0,0 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = { "lua", "python", "java" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
highlight = {
-- `false` will disable the whole extension
enable = true,
-- Using this option may slow down your editor, and you may see some duplicate highlights.
additional_vim_regex_highlighting = false,
},
}

View file

@ -0,0 +1,43 @@
return {
{
'abecodes/tabout.nvim',
lazy = false,
config = function()
require('tabout').setup {
tabkey = '<Tab>', -- key to trigger tabout, set to an empty string to disable
backwards_tabkey = '<S-Tab>', -- key to trigger backwards tabout, set to an empty string to disable
act_as_tab = true, -- shift content if tab out is not possible
act_as_shift_tab = false, -- reverse shift content if tab out is not possible (if your keyboard/terminal supports <S-Tab>)
default_tab = '<C-t>', -- shift default action (only at the beginning of a line, otherwise <TAB> is used)
default_shift_tab = '<C-d>', -- reverse shift default action,
enable_backwards = true, -- well ...
completion = false, -- if the tabkey is used in a completion pum
tabouts = {
{ open = "'", close = "'" },
{ open = '"', close = '"' },
{ open = '`', close = '`' },
{ open = '(', close = ')' },
{ open = '[', close = ']' },
{ open = '{', close = '}' }
},
ignore_beginning = true, --[[ if the cursor is at the beginning of a filled element it will rather tab out than shift the content ]]
exclude = {} -- tabout will ignore these filetypes
}
end,
dependencies = { -- These are optional
"nvim-treesitter/nvim-treesitter",
-- "L3MON4D3/LuaSnip",
-- "hrsh7th/nvim-cmp"
},
opt = true, -- Set this to true if the plugin is optional
event = 'InsertCharPre', -- Set the event to 'InsertCharPre' for better compatibility
priority = 1000,
},
-- {
-- "L3MON4D3/LuaSnip",
-- keys = function()
-- -- Disable default tab keybinding in LuaSnip
-- return {}
-- end,
-- },
}

View file

@ -1,22 +1,16 @@
require('telescope').setup{
defaults = {
-- Default configuration for telescope goes here:
-- config_key = value,
mappings = {
i = {
-- map actions.which_key to <C-h> (default: <C-/>)
-- actions.which_key shows the mappings for your picker,
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
["<C-h>"] = "which_key"
}
}
},
return { -- fuzzy find
{
"nvim-telescope/telescope.nvim",
dependencies = {
{"nvim-lua/plenary.nvim"},
{"nvim-tree/nvim-web-devicons"}
},
config = function()
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
end,
},
}
require('telescope').load_extension('fzf')
-- mappings --
local builtin = require('telescope.builtin')
vim.keymap.set('n', 'ff', builtin.find_files, {})
vim.keymap.set('n', 'fg', builtin.live_grep, {})
vim.keymap.set('n', 'fb', builtin.buffers, {})
vim.keymap.set('n', 'fh', builtin.help_tags, {})

View file

@ -0,0 +1,46 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = { "BufReadPre", "BufNewFile" },
lazy = vim.fn.argc(-1) == 0,
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
keys = {
{ "<c-space>", desc = "Increment Selection" },
{ "<bs>", desc = "Decrement Selection", mode = "x" },
},
opts_extend = { "ensure_installed" },
---@type TSConfig
---@diagnostic disable-next-line: missing-fields
opts = {
highlight = { enable = true },
indent = { enable = true },
ensure_installed = {
"bash",
"c",
"diff",
"html",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"vim",
"vimdoc",
"yaml"
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
}
}

View file

@ -75,8 +75,8 @@ input "type:keyboard" {
bindsym --locked XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
# Control Brightness
bindsym --locked XF86MonBrightnessDown exec light -T 0.72
bindsym --locked XF86MonBrightnessUp exec light -T 1.4
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 10%-
bindsym --locked XF86MonBrightnessUp exec brightnessctl set +10%
# Take a screenshot
bindsym $mod+p exec grim -g "$(slurp)" - | swappy -f -
@ -154,7 +154,7 @@ input "type:keyboard" {
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show