Compare commits
12 Commits
f5db7c3f5a
...
nvim-plugi
| Author | SHA1 | Date | |
|---|---|---|---|
| 76bdd7b9fe | |||
| a24380f314 | |||
| 3394778b23 | |||
| fbf6e9929e | |||
| 8eadabe7d8 | |||
|
|
a02af94bd2 | ||
|
|
f667533913 | ||
|
|
1e1163bfd5 | ||
| 66e7b048a0 | |||
|
|
04521bddb2 | ||
| 8d22b74c44 | |||
| 0c9c6182ce |
3
.bashrc
3
.bashrc
@@ -13,6 +13,8 @@ alias ll='ls -alF'
|
|||||||
alias la='ls -A'
|
alias la='ls -A'
|
||||||
alias l='ls -CF'
|
alias l='ls -CF'
|
||||||
alias vi='vim'
|
alias vi='vim'
|
||||||
|
alias vim='nvim'
|
||||||
|
alias vi='nvim'
|
||||||
|
|
||||||
# PS1="[\[\e[01;32m\]\u@\h \[\e[00;33m\]\W\[\e[00m\]]\$ "
|
# PS1="[\[\e[01;32m\]\u@\h \[\e[00;33m\]\W\[\e[00m\]]\$ "
|
||||||
PS1="[\[\e[00;33m\]\w\[\e[00m\]]\$ "
|
PS1="[\[\e[00;33m\]\w\[\e[00m\]]\$ "
|
||||||
@@ -21,3 +23,4 @@ PS1="[\[\e[00;33m\]\w\[\e[00m\]]\$ "
|
|||||||
# PS1='[\u@\h \W]\$ '
|
# PS1='[\u@\h \W]\$ '
|
||||||
|
|
||||||
PATH=$PATH:/home/dhanus/.myscripts:/home/dhanus/.local/bin:/home/dhanus/.myexes
|
PATH=$PATH:/home/dhanus/.myscripts:/home/dhanus/.local/bin:/home/dhanus/.myexes
|
||||||
|
. "$HOME/.cargo/env"
|
||||||
|
|||||||
1
nvim/.gitignore
vendored
Normal file
1
nvim/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
lazy-lock.json
|
||||||
88
nvim/bindings.lua
Normal file
88
nvim/bindings.lua
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
-- bindings
|
||||||
|
|
||||||
|
local function invert_hl ()
|
||||||
|
vim.opt.hlsearch = not vim.opt.hlsearch._value
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function launch_file_tree()
|
||||||
|
vim.cmd('20Lexplore')
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Normal mode
|
||||||
|
vim.keymap.set('n', '<leader>l', '<c-w>l')
|
||||||
|
vim.keymap.set('n', '<leader>h', '<c-w>h')
|
||||||
|
vim.keymap.set('n', '<leader>j', '<c-w>j')
|
||||||
|
vim.keymap.set('n', '<leader>k', '<c-w>k')
|
||||||
|
vim.keymap.set('n', '<leader>sv', ':source $MYVIMRC<cr>')
|
||||||
|
vim.keymap.set('n', '<leader>ev', ':edit $MYVIMRC<cr>')
|
||||||
|
vim.keymap.set('n', '<leader>n', invert_hl)
|
||||||
|
vim.keymap.set('n', '<leader>.', ':bnext<cr>')
|
||||||
|
vim.keymap.set('n', '<leader>,', ':bprevious<cr>')
|
||||||
|
vim.keymap.set('n', '<leader>f', launch_file_tree)
|
||||||
|
|
||||||
|
-- Insert mode
|
||||||
|
vim.keymap.set('i', 'jk', '<esc>')
|
||||||
|
|
||||||
|
-- Terminal mode
|
||||||
|
vim.keymap.set('t', '<c-\\>', '<c-\\><c-n>')
|
||||||
|
|
||||||
|
-- Autocorrect
|
||||||
|
vim.cmd('inoreabbrev paht path')
|
||||||
|
vim.cmd('inoreabbrev taht that')
|
||||||
|
vim.cmd('inoreabbrev classificaton classification')
|
||||||
|
vim.cmd('inoreabbrev compnents components')
|
||||||
|
vim.cmd('inoreabbrev compnent component')
|
||||||
|
vim.cmd('inoreabbrev pythone python')
|
||||||
|
vim.cmd('inoreabbrev smaples samples')
|
||||||
|
vim.cmd('inoreabbrev sover solver')
|
||||||
|
vim.cmd('inoreabbrev souce source')
|
||||||
|
|
||||||
|
-- Autocmds
|
||||||
|
local common_group = vim.api.nvim_create_augroup('common', {clear = true})
|
||||||
|
local spec_group = vim.api.nvim_create_augroup('lang_spec', {clear = true})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "python", "make", "sh", "cmake", "yaml", "toml" },
|
||||||
|
callback = function(args)
|
||||||
|
vim.keymap.set('v', '<leader>#', ':normal 0i#<esc>', { buffer = args.buf })
|
||||||
|
end,
|
||||||
|
group = 'lang_spec',
|
||||||
|
desc = "comment multiple lines for python source file"
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "scheme" },
|
||||||
|
callback = function(args)
|
||||||
|
vim.keymap.set('v', '<leader>;', ':normal 0i;<esc>', { buffer = args.buf })
|
||||||
|
end,
|
||||||
|
group = 'lang_spec',
|
||||||
|
desc = "comment multiple lines for scheme source"
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { 'c', 'cpp', 'go', 'rust' },
|
||||||
|
callback = function(args)
|
||||||
|
vim.keymap.set('v', '<leader>//', ':normal 0i//<esc>', { buffer = args.buf })
|
||||||
|
end,
|
||||||
|
group = 'lang_spec',
|
||||||
|
desc = 'comment multiple lines for c/c++'
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { 'c', 'cpp', 'rust' },
|
||||||
|
callback = function(args)
|
||||||
|
vim.keymap.set('v', '<leader>/*', '<esc>`<i/*<esc>`>i*/<esc>', { buffer = args.buf })
|
||||||
|
end,
|
||||||
|
group = 'lang_spec',
|
||||||
|
desc = 'comment multiple lines for c/c++'
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
|
callback = function() vim.highlight.on_yank({ timeout = 1000 }) end,
|
||||||
|
group = 'common',
|
||||||
|
desc = "briefly highlight yanked text"
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_command([[autocmd TermOpen * setlocal nonu]])
|
||||||
|
vim.api.nvim_command([[autocmd TermOpen * setlocal nornu]])
|
||||||
6
nvim/init.lua
Normal file
6
nvim/init.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package.path = package.path .. ";/home/dhanus/.config/nvim/?.lua"
|
||||||
|
|
||||||
|
require('settings')
|
||||||
|
require('bindings')
|
||||||
|
require('packconf.lazy')
|
||||||
|
|
||||||
23
nvim/lua/plugins/init.lua
Normal file
23
nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"tpope/vim-fugitive",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
config = function()
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>tf', builtin.find_files, { desc = 'Telescope find files' })
|
||||||
|
vim.keymap.set('n', '<leader>gr', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||||
|
vim.keymap.set('n', '<leader>tb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
config = function()
|
||||||
|
vim.lsp.enable('rust_analyzer')
|
||||||
|
vim.lsp.enable('clangd')
|
||||||
|
vim.lsp.enable('lua_ls')
|
||||||
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
}
|
||||||
25
nvim/packconf/lazy.lua
Normal file
25
nvim/packconf/lazy.lua
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
{import = "plugins"}
|
||||||
|
},
|
||||||
|
install = { colorscheme = { "habamax" } },
|
||||||
|
checker = { enabled = true },
|
||||||
|
})
|
||||||
22
nvim/settings.lua
Normal file
22
nvim/settings.lua
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
-- global settings
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
vim.cmd.colorscheme('habamax')
|
||||||
|
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.softtabstop = 2
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
|
vim.opt.hlsearch = false
|
||||||
|
|
||||||
|
vim.opt.autoindent = true
|
||||||
|
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
vim.opt.mouse = ""
|
||||||
|
|
||||||
|
vim.opt.statusline = '%f %m %y %= C:%c L:%l/%L %p%%'
|
||||||
|
|
||||||
|
vim.g.netrw_banner = 0
|
||||||
|
vim.g.netrw_liststyle = 3
|
||||||
@@ -20,6 +20,3 @@ set -g mode-keys vi
|
|||||||
|
|
||||||
|
|
||||||
#set -g default-terminal "screen-256color"
|
#set -g default-terminal "screen-256color"
|
||||||
|
|
||||||
#set -g status-bg black
|
|
||||||
#set -g status-fg white
|
|
||||||
Reference in New Issue
Block a user