Skip to content

Commit

Permalink
up up up
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelgrzybek committed Dec 8, 2024
1 parent f202b97 commit 42247fd
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 95 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# dotfiles

Before doing anything, make sure you know what you're doing! The settings applied by this repository are highly personal and certainly not suitable for everyone. I recommend creating your own set of dotfiles based on this repository.
Before doing anything, make sure you know what you're doing! The settings
applied by this repository are highly personal and certainly not suitable for
everyone. I recommend creating your own set of dotfiles based on this
repository.

1. Install [brew](https://brew.sh).
1. SSH setup.
1. Clone this repo to the hidden `.dotfile` directory in your home directory (`git` comes with brew) - `git clone https://github.com/pawelgrzybek/dotfiles.git ~/.dotfile`
1. Clone this repo to the hidden `.dotfile` directory in your home directory
(`git` comes with brew) -
`git clone https://github.com/pawelgrzybek/dotfiles.git ~/.dotfile`
1. Install brew formulas and casks - `source ~/.dotfiles/setup-brew.sh`
1. Download your fav apps from app store- (Keynote, Ivory, Numbers, Pages, Photomator, Reeder)
1. Download your fav apps from app store- (Keynote, Ivory, Numbers, Pages,
Photomator, Reeder)
1. Setup macOS - `source ~/.dotfiles/setup-macos.sh`
1. Setup symlinks - `source ~/.dotfiles/setup-symlinks.sh`
1. Setup pnpm globals - `source ~/.dotfiles/setup-pnpm.sh`
1 change: 1 addition & 0 deletions nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require("pawelgrzybek.options")
require("pawelgrzybek.keymaps")
require("pawelgrzybek.autocmds")
require("pawelgrzybek.lazy")
10 changes: 10 additions & 0 deletions nvim/lua/pawelgrzybek/autocmds.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
69 changes: 7 additions & 62 deletions nvim/lua/pawelgrzybek/keymaps.lua
Original file line number Diff line number Diff line change
@@ -1,87 +1,32 @@
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")

-- Diagnostic keymaps
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })

-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
-- is not what someone will guess without a bit more experience.
--
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })

-- TIP: Disable arrow keys in normal mode
vim.keymap.set("n", "<left>", '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set("n", "<right>", '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set("n", "<up>", '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set("n", "<down>", '<cmd>echo "Use j to move!!"<CR>')

-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
--
-- See `:help wincmd` for a list of all window commands
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })

-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})

-- before the kickstart adoption
-- -- increment/decrement numbers
-- vim.keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment
-- vim.keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement
--
-- -- window management
-- vim.keymap.set("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
-- vim.keymap.set("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
-- vim.keymap.set("n", "<leader>se", "<C-w>=", { desc = "Make splits equal size" }) -- make split windows equal width & height
-- vim.keymap.set("n", "<leader>sx", "<cmd>close<CR>", { desc = "Close current split" }) -- close current split window
--
-- -- tabs management
-- vim.keymap.set("n", "<leader>to", "<cmd>tabnew<CR>", { desc = "Open new tab" }) -- open new tab
-- vim.keymap.set("n", "<leader>tx", "<cmd>tabclose<CR>", { desc = "Close current tab" }) -- close current tab
-- vim.keymap.set("n", "<leader>tn", "<cmd>tabn<CR>", { desc = "Go to next tab" }) -- go to next tab
-- vim.keymap.set("n", "<leader>tp", "<cmd>tabp<CR>", { desc = "Go to previous tab" }) -- go to previous tab
-- vim.keymap.set("n", "<leader>tf", "<cmd>tabnew %<CR>", { desc = "Open current buffer in new tab" }) -- move current buffer to new tab
--
-- Move/duplicate lines up and down in normal mode
-- Move/duplicate lines up and down (normal mode)
vim.keymap.set("n", "<A-j>", ":m .+1<CR>==")
vim.keymap.set("n", "<A-k>", ":m .-2<CR>==")
vim.keymap.set("n", "<A-J>", ":t.<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<A-K>", ":t-1<CR>", { noremap = true, silent = true })

-- Move/duplicate lines up and down in insert mode
-- Move/duplicate lines up and down (insert mode)
vim.keymap.set("i", "<A-j>", "<Esc>:m .+1<CR>==gi")
vim.keymap.set("i", "<A-k>", "<Esc>:m .-2<CR>==gi")
vim.keymap.set("i", "<A-J>", "<C-o>:t.<CR>", { noremap = true, silent = true })
vim.keymap.set("i", "<A-K>", "<C-o>:t-1<CR>", { noremap = true, silent = true })

-- Move/duplicate lines up and down in visual mode
-- Move/duplicate lines up and down (visual mode)
vim.keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv")
vim.keymap.set("v", "<A-J>", ":t-1<CR>gv", { noremap = true, silent = true })
vim.keymap.set("v", "<A-K>", ":t'><CR>gv", { noremap = true, silent = true })
--
-- -- copy to system clipboard
vim.keymap.set("n", "<leader>y", '"+y')
vim.keymap.set("n", "<leader>p", '"+p')
vim.keymap.set("v", "<leader>y", '"+y')

-- Copy/paste to system clipboard
vim.keymap.set("v", "<leader>y", '"+y')
vim.keymap.set("v", "<leader>p", '"+p')

-- select all
-- Select all
vim.keymap.set("n", "<leader>a", "ggVG")

-- Diagnostic keymaps
Expand Down
59 changes: 41 additions & 18 deletions nvim/lua/pawelgrzybek/plugins/lsp.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
return {
"neovim/nvim-lspconfig",
dependencies = {
{ "williamboman/mason.nvim", config = true },
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
{ "j-hui/fidget.nvim", opts = {} },
"hrsh7th/cmp-nvim-lsp",
Expand All @@ -16,12 +16,6 @@ return {
require("telescope.builtin").lsp_definitions,
{ buffer = event.buf, desc = "[G]o to [d]efinition" }
)
vim.keymap.set(
"n",
"<leader>gD",
vim.lsp.buf.declaration,
{ buffer = event.buf, desc = "[G]o to [d]eclatation" }
)
vim.keymap.set(
"n",
"<leader>gt",
Expand All @@ -43,24 +37,28 @@ return {

vim.keymap.set(
"n",
"<leader>fs",
"<leader>gs",
require("telescope.builtin").lsp_document_symbols,
{ buffer = event.buf, desc = "[F]ind symbols" }
{ buffer = event.buf, desc = "[F]ind symbols (local)" }
)
vim.keymap.set(
"n",
"<leader>fS",
"<leader>gS",
require("telescope.builtin").lsp_dynamic_workspace_symbols,
{ buffer = event.buf, desc = "[F]ind [s]ymbols (global)" }
)

vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, { buffer = event.buf, desc = "[R]ename" })

vim.keymap.set(
{ "n", "x" },
"<leader>ca",
"<leader>ga",
vim.lsp.buf.code_action,
{ buffer = event.buf, desc = "[C]ode [A]ction" }
{ buffer = event.buf, desc = "[G]o to [A]ctions" }
)
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, { buffer = event.buf, desc = "[R]ename member" })
vim.keymap.set(
"n",
"<leader>ss",
vim.lsp.buf.signature_help,
{ buffer = event.buf, desc = "[S]how [s]ignature" }
)

-- The following two autocommands are used to highlight references of the
Expand Down Expand Up @@ -95,10 +93,12 @@ return {
-- The following code creates a keymap to toggle inlay hints in your
-- code, if the language server you are using supports them
-- This may be unwanted, since they displace some of your code
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
vim.keymap.set("n", "<leader>ah", function()
if client and (client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint)) then
vim.lsp.inlay_hint.enable(true)

vim.keymap.set("n", "<leader>sh", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
end, { buffer = event.buf, desc = "Inlay [h]ints" })
end, { buffer = event.buf, desc = "[S]how inlay [h]ints" })
end
end,
})
Expand All @@ -109,6 +109,7 @@ return {

require("mason").setup()
require("mason-lspconfig").setup({
automatic_installation = false,
ensure_installed = { "lua_ls", "rust_analyzer", "ts_ls", "denols" },
})

Expand All @@ -133,6 +134,18 @@ return {
require("lspconfig").ts_ls.setup({
root_dir = require("lspconfig").util.root_pattern("package.json"),
single_file_support = false,
init_options = {
preferences = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayVariableTypeHints = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
importModuleSpecifierPreference = "non-relative",
},
},
capabilities = vim.tbl_deep_extend(
"force",
{},
Expand Down Expand Up @@ -172,5 +185,15 @@ return {
},
},
})

-- rust
require("lspconfig").rust_analyzer.setup({
capabilities = vim.tbl_deep_extend(
"force",
{},
capabilities_extended,
require("lspconfig").rust_analyzer.capabilities or {}
),
})
end,
}
12 changes: 0 additions & 12 deletions nvim/lua/pawelgrzybek/plugins/nvim-cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,6 @@ return {
-- $body
-- end
--
-- <c-l> will move you to the right of each of the expansion locations.
-- <c-h> is similar, except moving you backwards.
["<C-l>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { "i", "s" }),
["<C-h>"] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { "i", "s" }),

-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
Expand Down

0 comments on commit 42247fd

Please sign in to comment.