backport some dwm patches and add new neovim configuration

This commit is contained in:
hippoz 2022-05-15 11:04:50 +03:00
parent 693bed1a0b
commit 0085d43366
No known key found for this signature in database
GPG key ID: 7C52899193467641
4 changed files with 109 additions and 51 deletions

View file

@ -1,54 +1,52 @@
local base16 = require "base16"
require "plugins"
-- thanks nvchad for the telescope config
require("telescope").setup {
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "absolute" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
use_less = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
}
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "absolute" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
use_less = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
}
}
require("nvim-treesitter.configs").setup {
@ -68,7 +66,55 @@ require("nvim-treesitter.configs").setup {
"css",
"c",
"cpp",
"rust"
"rust",
"lua"
},
}
-- Add additional capabilities supported by nvim-cmp
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
-- Language servers
require"lspconfig".clangd.setup{
capabilities = capabilities
}
local luasnip = require "luasnip"
local cmp = require "cmp"
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.confirm({ select = true })
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = "nvim_lsp" },
},
}
@ -88,7 +134,11 @@ local init = {
"nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr>",
"nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr>",
"nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>",
"nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>"
"nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>",
"let g:gruvbox_material_palette = 'material'",
"let g:gruvbox_material_background = 'soft'",
"let g:gruvbox_material_better_performance = '1'",
"colorscheme gruvbox-material"
}
for k, v in pairs(options) do
@ -99,5 +149,4 @@ for i, v in pairs(init) do
vim.cmd(v)
end
base16.apply_theme(base16.themes["tomorrow-night"], true)

View file

@ -12,5 +12,13 @@ return packer.startup(function(use)
branch = "0.5-compat",
run = ":TSUpdate"
}
use {
"sainnhe/gruvbox-material"
}
use "neovim/nvim-lspconfig"
use "hrsh7th/nvim-cmp"
use "hrsh7th/cmp-nvim-lsp"
use "saadparwaiz1/cmp_luasnip"
use "L3MON4D3/LuaSnip"
end)

View file

@ -27,7 +27,7 @@ static char *colors[][3] = {
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
static const unsigned int ulinestroke = 0; /* thickness / height of the underline */
static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */

View file

@ -535,6 +535,7 @@ cleanup(void)
drw_cur_free(drw, cursor[i]);
for (i = 0; i < LENGTH(colors) + 1; i++)
free(scheme[i]);
free(scheme); /* backported from https://git.suckless.org/dwm/commit/60e9a14998bfe8666c641f7c27fec18e85ac7494.html */
XDestroyWindow(dpy, wmcheckwin);
drw_free(drw);
XSync(dpy, False);