From 102d51fb836eb3b9d29c52627ad0406c9dec7f81 Mon Sep 17 00:00:00 2001 From: cool-mist Date: Fri, 16 Feb 2024 15:23:47 +0530 Subject: [PATCH] Add rust-tools, toggleterm and neovide configs --- .pre-commit-config.yaml | 8 ++++++++ init.lua | 45 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ec7ec92 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +# .pre-commit-config.yaml +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: mixed-line-ending + args: [--fix=lf] + diff --git a/init.lua b/init.lua index 176181e..0d60c7a 100644 --- a/init.lua +++ b/init.lua @@ -12,7 +12,9 @@ O.shiftwidth=2 O.expandtab=true O.preserveindent=true O.termguicolors=true + -- If running on WSL + Arch, uncomment this for faster startup +-- before setting the clipbard to unnamedplus -- V.g.clipboard = { -- name = 'win32yank', -- copy = { @@ -26,7 +28,8 @@ O.termguicolors=true -- cache_enabled = 0, --} O.clipboard='unnamedplus' -V.cmd("colorscheme habamax") + +V.cmd("colorscheme lunaperche") -------------------------- ---- Config Section ----- @@ -86,12 +89,16 @@ packer.startup({function(u) u 'hrsh7th/cmp-path' u 'L3MON4D3/LuaSnip' u 'Sirver/ultisnips' + u 'simrat39/rust-tools.nvim' u 'honza/vim-snippets' u { 'VonHeikemen/lsp-zero.nvim', branch = 'v2.x' } + -- Debugging + u 'puremourning/vimspector' + -- Markdown u 'godlygeek/tabular' u 'elzr/vim-json' @@ -99,6 +106,9 @@ packer.startup({function(u) u 'vim-pandoc/vim-pandoc-syntax' u 'itchyny/calendar.vim' + -- Terminal + u 'akinsho/toggleterm.nvim' + -- File tree, telescope u 'nvim-lua/plenary.nvim' u 'nvim-tree/nvim-web-devicons' @@ -160,7 +170,7 @@ lsp.ensure_installed({ 'lua_ls', 'tsserver', 'eslint', - 'rust_analyzer' + 'rust_analyzer', }) lsp.setup(); @@ -199,6 +209,11 @@ lualine.setup({ local whichkey = require('which-key') whichkey.setup() +local toggleterm = require('toggleterm') +toggleterm.setup({ + direction = 'float', +}) + -- vim-markdown V.cmd('let g:vim_markdown_folding_disabled = 1') V.cmd('let g:vim_markdown_conceal = 0') @@ -220,6 +235,21 @@ V.cmd([[ augroup END ]]) + +-------------------------- +---- Config Section ----- +--- x --- Neovide -------- +-------------------------- + +if V.g.neovide then + -- V.g.neovide_fullscreen = true + V.g.neovide_cursor_animation_length = 0.05 + V.g.neovide_transparency = 0.85 + V.g.neovide_refresh_rate_idle = 5 + V.g.neovide_cursor_trail_size = 0.2 + V.g.neovide_cursor_vfx_mode = "railgun" +end + -------------------------- ---- Config Section ----- --- x --- Keybindings ---- @@ -263,6 +293,12 @@ keymap("x", "K", ":move '<-2gv-gv", opts) keymap("x", "", ":move '>+1gv-gv", opts) keymap("x", "", ":move '<-2gv-gv", opts) +-- terminal +keymap("t", "", "", opts) +keymap("n", "tt", ":ToggleTerm", opts) +keymap("x", "tt", ":ToggleTerm", opts) + + -- Notes keymap('n', 'tf', ':TableFormat', opts) keymap('n', 'tc', ':Toc', opts) @@ -273,6 +309,11 @@ keymap('n', 'fy', ':let @+=@%', opts) keymap('n', 'gn', 'yi[:e *', opts) keymap('n', 'gm', ':e main.md', opts) +-- Neovide +if V.g.neovide then + keymap('n', 'ff', ':lua V.g.neovide_fullscreen = true', opts) +end + -- Misc keymap('n', '', ':red', opts) keymap('n', ';', ':nohl', opts)