feat: update remapping, fix formatting

This commit is contained in:
2023-05-10 18:05:04 +03:00
parent 6c6161828d
commit 1adc861041
5 changed files with 1361 additions and 405 deletions

View File

@@ -8,7 +8,11 @@ null_ls.setup({
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.keymap.set("n", "<Leader>f", function()
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
if vim.bo.filetype == "dart" then
vim.cmd("silent !dart format --line-length 120 %:p")
else
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
end
end, { buffer = bufnr, desc = "[lsp] format" })
-- format on save

0
.config/nvim/after/plugin/trouble.lua Executable file → Normal file
View File

View File

@@ -18,7 +18,7 @@ vim.keymap.set("n", "J", "mzJ`z", { desc = "Join line" })
-- insert newlines without insert mode
vim.keymap.set("n", "<S-CR>", "m`o<Esc>k``", { desc = "Insert newline below" })
vim.keymap.set("n", "<CR>", "m`O<Esc>j``", { desc = "Insert newline above" })
vim.keymap.set("n", "<CR>", "m`O<Esc>j``", { desc = "Insert newline above" })
-- redo
vim.keymap.set("n", "U", "<C-r>", { desc = "Redo" })
@@ -45,10 +45,13 @@ vim.keymap.set("x", "<leader>p", [["_dP]], { desc = "Paste over selection, keep
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]], { desc = "Yank selection to system clipboard" })
vim.keymap.set("n", "<leader>Y", [["+Y]], { desc = "Yank line to system clipboard" })
-- surround with parens
vim.keymap.set("v", "<leader>(", [[:s/\%V\(.*\)\%V/\(\1\)/g<Left><Left><CR>]], { desc = "Surround selection with parens" })
vim.keymap.set("v", "<leader>[[", [[:s/\%V\(.*\)\%V/\[\1\]/g<Left><Left><CR>]], { desc = "Surround selection with brackets" })
vim.keymap.set("v", "<leader>(", [[:s/\%V\(.*\)\%V/\(\1\)/g<Left><Left><CR>]],
{ desc = "Surround selection with parens" })
vim.keymap.set("v", "<leader>[[", [[:s/\%V\(.*\)\%V/\[\1\]/g<Left><Left><CR>]],
{ desc = "Surround selection with brackets" })
vim.keymap.set("v", "<leader>{", [[:s/\%V\(.*\)\%V/{\1}/g<Left><Left><CR>]], { desc = "Surround selection with braces" })
vim.keymap.set("v", "<leader><", [[:s/\%V\(.*\)\%V/<\1>/g<Left><Left><CR>]], { desc = "Surround selection with angle brackets" })
vim.keymap.set("v", "<leader><", [[:s/\%V\(.*\)\%V/<\1>/g<Left><Left><CR>]],
{ desc = "Surround selection with angle brackets" })
-- comment line
vim.keymap.set("n", "<leader>/", ":CommentToggle<CR>", { desc = "Comment line" })
@@ -64,6 +67,7 @@ vim.keymap.set("n", "Q", "<nop>", { desc = "No Q" })
-- file formatting
-- TODO: move to lsp.lua?
vim.keymap.set("n", "<leader>f", function()
-- print(vim.bo.filetype)
if vim.bo.filetype == "dart" then
vim.cmd("silent !dart format --line-length 120 %:p")
else
@@ -81,8 +85,13 @@ vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz", { desc = "Previous quickfix" })
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz", { desc = "Next location list" })
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz", { desc = "Previous location list" })
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
-- search and replace current word
vim.keymap.set( "n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
{ desc = "Search and replace current word" })
-- search and replace current selection
vim.keymap.set("v", "<leader>s", [["hy:%s/<C-r>h/<C-r>h/gI<Left><Left><Left>]],
{ desc = "Search and replace current selection" })
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true, desc = "Make file executable" })
vim.keymap.set("n", "<leader>X", "<cmd>!chmod -x %<CR>", { silent = true, desc = "Make file not executable" })

View File

@@ -13,8 +13,6 @@ brew "apr-util"
brew "automake"
# Interpreted, interactive, object-oriented programming language
brew "python@3.11"
# Text processing system for reStructuredText
brew "docutils"
# Official Amazon AWS command-line interface
brew "awscli"
# Bourne-Again SHell, a UNIX command interpreter
@@ -23,10 +21,12 @@ brew "bash"
brew "bison"
# Get/set bluetooth power and discoverable state
brew "blueutil"
# Open source suite of directory software
brew "openldap"
# Get a file from an HTTP, HTTPS or FTP server
brew "curl"
# C/C++ and Java libraries for Unicode and globalization
brew "icu4c"
# Versatile and fast Unicode/ASCII/ANSI graphics renderer
brew "chafa"
# Console Matrix
brew "cmatrix"
# Select default apps for documents and URL schemes on macOS
brew "duti"
# Validating, recursive, caching DNS resolver
@@ -45,8 +45,12 @@ brew "freetds"
brew "fzf"
# GNU compiler collection
brew "gcc"
# GNU database manager
brew "gdbm"
# Git extension for versioning large files
brew "git-lfs"
# Open-source GitLab command-line tool
brew "glab"
# Render markdown on the CLI
brew "glow"
# GNU Pretty Good Privacy (PGP) package
@@ -59,16 +63,18 @@ brew "pkg-config"
brew "guile"
# Lightweight and flexible command-line JSON processor
brew "jq"
# Network authentication protocol
brew "krb5"
# Portable Foreign Function Interface library
brew "libffi"
# Postgres C API library
brew "libpq"
# YAML Parser
brew "libyaml"
# Rainbows and unicorns in your console!
brew "lolcat"
# Utility for directing compilation
brew "make"
# Platform built on V8 to build network applications
brew "node@16"
# MongoDB Shell to connect, configure, query, and work with your MongoDB database
brew "mongosh"
# Ambitious Vim-fork focused on extensibility and agility
@@ -83,6 +89,8 @@ brew "nvm"
brew "php", restart_service: true, link: false
# Execute binaries from Python packages in isolated environments
brew "pipx"
# Python version management
brew "pyenv"
# Generic syntax highlighter
brew "pygments"
# Interpreted, interactive, object-oriented programming language
@@ -105,6 +113,8 @@ brew "tree"
brew "trunk"
# Executes a program periodically, showing output fullscreen
brew "watch"
# SDK
brew "dart-lang/dart/dart", link: false
# Beta SDK
brew "dart-lang/dart/dart-beta"
# High-performance, schema-free, document-oriented database
@@ -115,3 +125,5 @@ cask "android-platform-tools"
cask "android-sdk"
# Simple application that will prevent iTunes or Apple Music from launching
cask "notunes"
# QuickLook plugin for plaintext files without an extension
cask "qlstephen"

File diff suppressed because it is too large Load Diff