From 8ea7367442e6e6c4c7ade0e9fe8de9d079b88763 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Mon, 7 Feb 2022 12:47:03 +0200 Subject: [PATCH] feat: worked on nvim config more --- dotfiles/neovim/lua/my/plugins/comment.lua | 16 ++++++++++++ dotfiles/neovim/lua/my/plugins/init.lua | 2 +- dotfiles/neovim/lua/my/plugins/lspconfig.lua | 9 ++----- modules/applications/alacritty.nix | 5 ++-- modules/theme/fonts.nix | 26 ++++++++++++++------ prettierd | 1 + 6 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 dotfiles/neovim/lua/my/plugins/comment.lua create mode 100644 prettierd diff --git a/dotfiles/neovim/lua/my/plugins/comment.lua b/dotfiles/neovim/lua/my/plugins/comment.lua new file mode 100644 index 0000000..48afb2e --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/comment.lua @@ -0,0 +1,16 @@ +local M = {} + +-- Update comments for certain languages +local function setCommentString(extension, commentString) + vim.cmd('autocmd BufEnter '.. extension .. ' :lua vim.api.nvim_buf_set_option(0, "commentstring", "' .. commentString .. '")') + vim.cmd('autocmd BufFilePost '.. extension .. ' :lua vim.api.nvim_buf_set_option(0, "commentstring", "' .. commentString ..'")') +end + +function M.setup() + require('nvim_comment').setup() + + setCommentString(".nix", "# %s") +end + + +return M diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index 505b4d2..aeafd3b 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -4,10 +4,10 @@ function M.setup() require("my.plugins.lspconfig").setup() require("my.plugins.fzf-lua").setup() require("my.plugins.treesitter").setup() + require("my.plugins.comment").setup() -- Other unconfigured plugins require('nvim-autopairs').setup() - require('nvim_comment').setup() require("startup").setup({theme = "dashboard"}) end diff --git a/dotfiles/neovim/lua/my/plugins/lspconfig.lua b/dotfiles/neovim/lua/my/plugins/lspconfig.lua index e9378d8..bf8e8c9 100644 --- a/dotfiles/neovim/lua/my/plugins/lspconfig.lua +++ b/dotfiles/neovim/lua/my/plugins/lspconfig.lua @@ -92,22 +92,17 @@ function M.setup() end local efmLanguages = { - typescript = { - formatCommand = 'prettierd "${INPUT}"', - formatStdin = true, - env = {string.format('PRETTIERD_DEFAULT_CONFIG=%s', vim.fn.expand('~/.config/nvim/utils/linter-config/.prettierrc.json'))} - }, lua = {{formatCommand = formatLua, formatStdin = true}} } -- Setup auto-formatting require"lspconfig".efm.setup { init_options = {documentFormatting = true}, - filetypes = {"lua", "ts", "js", "tsx", "jsx"}, + filetypes = {"lua"}, settings = {rootMarkers = {".git/"}, languages = efmLanguages} } - local autoFormatOn = {lua = 100, purs = 1000, nix = 100, js = 100, ts = 100, tsx = 100, jsx = 100} + local autoFormatOn = {lua = 200, purs = 1000, nix = 200, js = 300, ts = 300, tsx = 300, jsx = 300} -- Auto format for extension, timeout in pairs(autoFormatOn) do diff --git a/modules/applications/alacritty.nix b/modules/applications/alacritty.nix index 29cfd92..1b9e798 100644 --- a/modules/applications/alacritty.nix +++ b/modules/applications/alacritty.nix @@ -3,7 +3,8 @@ let githubAlacrittyTheme = "${pkgs.githubNvimTheme}/terminal/alacritty/github_light.yml"; -in { +in +{ home-manager.users.adrielus.programs.alacritty = { enable = true; @@ -22,7 +23,7 @@ in { }; # transparent bg:) - background_opacity = 0.6; + # background_opacity = 0.6; fonts.normal.family = "Source Code Pro"; }; }; diff --git a/modules/theme/fonts.nix b/modules/theme/fonts.nix index b580662..9b2d080 100644 --- a/modules/theme/fonts.nix +++ b/modules/theme/fonts.nix @@ -1,8 +1,20 @@ -{ pkgs, ... }: { - home-manager.users.adrielus.home.packages = with pkgs; [ - fira-code - fira-code-symbols - source-code-pro - corefonts - ]; +{ pkgs, ... }: +let + nerdfonts = + (pkgs.nerdfonts.override { + fonts = [ "FiraCode" "SourceCodePro" ]; + }); +in +{ + home-manager.users.adrielus = { + fonts.fontconfig.enable = true; + + home.packages = with pkgs; [ + # fira-code + # fira-code-symbols + # source-code-pro + corefonts + nerdfonts + ]; + }; } diff --git a/prettierd b/prettierd new file mode 100644 index 0000000..a04db0b --- /dev/null +++ b/prettierd @@ -0,0 +1 @@ +const a = 3