Skip to content
21 changes: 18 additions & 3 deletions .config/nvim/lua/config/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ vim.opt.signcolumn = "yes" -- always show the signcolumn to minimize distraction
-- vim.cmd(":autocmd InsertLeave * set nocul") -- Remove color upon existing insert mode
-- vim.cmd("set guicursor=i:block") -- Always use block cursor. In some terminals and fonts (like iTerm), it can be hard to see the cursor when it changes to a line.

-- Copy all yanked/deleted lines to the "+" buffer. Useful when you want to use
-- the OS clipboard.
vim.cmd("set clipboard=unnamedplus")
-- Use osc52 as clipboard provider
local function paste()
return {vim.fn.split(vim.fn.getreg(''), '\n'), vim.fn.getregtype('')}
end
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
['+'] = paste,
['*'] = paste,
},
}
-- To ALWAYS use the clipboard for ALL operations
-- (instead of interacting with the "+" and/or "*" registers explicitly):
vim.opt.clipboard = "unnamedplus"
43 changes: 43 additions & 0 deletions .config/nvim/lua/plugins/r.nvim.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
return {
"R-nvim/R.nvim",

-- Still in experimental mode.
-- enabled = false,

lazy = false,
config = function()
local opts = {

-- Disable highlighting of R in the terminal
hl_term = false,

-- Use default pdf viewer (or none)
pdfviewer = "",

-- This is intended to be used with tmux. Viewing a dataframe with
-- <localleader>rv will save the dataframe to file, open a new tmux
-- pane, and run visidata on that file. Quitting visidata will close that
-- pane.
view_df = {
open_app = "tmux split-window -v vd",
},

-- Override some of the built-in commands to match historical commands in
-- these dotfiles.
hook = {
on_filetype = function()
vim.api.nvim_buf_set_keymap(0, "n", "gxx", "<Plug>RDSendLine", {})
vim.api.nvim_buf_set_keymap(0, "v", "gx", "<Plug>RSendSelection", {})
vim.api.nvim_buf_set_keymap(0, "n", "<leader>k", "<Plug>RMakeHTML", {})
vim.api.nvim_buf_set_keymap(0, "n", "<leader>cd", "<Plug>RSendChunk<CR><Plug>RNextRChunk", {})
end,
-- Optional notification of which nvimcom is being used
-- after_R_start = function()
-- require('r.send').cmd('paste("r.nvim plugin is using this nvimcom:", system.file(package="nvimcom"))')
-- end,
},
R_args = { "--no-save" },
}
require("r").setup(opts)
end,
}
50 changes: 44 additions & 6 deletions .config/nvim/lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ return {
version = false,
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
require("nvim-treesitter.configs").setup({
highlight = {
enable = true,
},
indent = {
enable = true,
-- Let vim-python-pep8-indent handle the python and snakemake indentation;
-- disable markdown indentation because it prevents bulleted lists from wrapping correctly with `gq`.

-- Disable markdown indentation because it prevents bulleted lists
-- from wrapping correctly with `gq`.
disable = { "markdown" },
},
-- --------------------------------------------------------------------
-- CONFIGURE ADDITIONAL PARSERS HERE
-- These will be attempted to be installed automatically, but you'll need a C compiler installed.
-- These will be attempted to be installed automatically, but you'll
-- need a C compiler installed.
ensure_installed = {
"bash",
"css",
Expand All @@ -29,13 +34,17 @@ return {
"markdown",
"markdown_inline",
"python",
"vim",
"vimdoc",
"yaml",
"r",
"rnoweb",
"rst",
"snakemake",
"vim",
"vimdoc",
"yaml",
},

-- Starting from the current line, use Tab or Shift-Tab to increase or
-- decrease the selection depending on scope.
incremental_selection = {
enable = true,
keymaps = {
Expand All @@ -45,6 +54,35 @@ return {
node_decremental = "<S-Tab>",
},
},

-- Support selecting objects based on parser. E.g., vaf to visually
-- select a function, or cip to change inside a parameter. More can be
-- added, see
-- https://github.com/nvim-treesitter/nvim-treesitter-textobjects
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = { query = "@function.outer", desc = "Select function (outer)" },
["if"] = { query = "@function.inner", desc = "Select function (inner)" },
["ap"] = { query = "@parameter.outer", desc = "Select parameter (outer)" },
["ip"] = { query = "@parameter.inner", desc = "Select parameter (inner)" },
},

-- use the entire line V) or just characters (v (default)) when
-- selecting
selection_modes = {
["@parameter.inner"] = "v", -- charwise
["@parameter.outer"] = "v", -- charwise
["@function.inner"] = "V", -- linewise
["@function.outer"] = "V", -- linewise
["@class.inner"] = "V", -- linewise
["@class.outer"] = "V", -- linewise
["@scope"] = "v",
},
},
},
})
vim.cmd("set foldmethod=expr")
vim.cmd("set foldexpr=nvim_treesitter#foldexpr()")
Expand Down
3 changes: 3 additions & 0 deletions .tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ bind % split-window -h -c "#{pane_current_path}"
unbind -T copy-mode-vi MouseDragEnd1Pane
bind -T copy-mode-vi MouseDragEnd1Pane send -X stop-dragging-selection
bind -T copy-mode-vi MouseDown1Pane select-pane \; send-keys -X clear-selection

set-option -s set-clipboard on
set -g allow-passthrough on
Binary file added docs/images/iterm2_clipboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading