Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function map(m, k, v)
- vim.keymap.set(m, k, v, { silent = true })
- end
- local o = vim.opt
- --fix indenting with F6
- local function indent()
- vim.g.tabstop = 2
- vim.g.shiftwidth = 2
- local line = vim.api.nvim_win_get_cursor(0)
- vim.cmd[[
- normal gg=G
- ]]
- vim.api.nvim_win_set_cursor(0,line)
- end
- map("n","<F5>", indent)
- --remember the last line you where on in a while at open
- vim.cmd[[
- if has("autocmd")
- au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
- endif
- ]]
- --quit commands
- vim.cmd[[
- command! Wq :wq
- command! W :w
- command! Q :q
- :cmap Q! q!
- :cmap q1 q!
- ]]
- --run template search
- map("i", "<C-t>", "<ESC>:read !$HOME/.vim/vim_templates.sh<CR>mqgg=G'qzzi")
- --load templates
- map("n", "<leader>html", ":-1read $HOME/.vim/skeleton/html/index.html<CR>3j2f<i")
- map("n", "<leader>bash", ":-1read $HOME/.vim/skeleton/sh/bash_header.sh<CR>Gi")
- --show relative line number
- vim.o.relativenumber = true
- --load default templates on new files
- vim.cmd[[autocmd BufNewFile *.html 0r ~/.vim/skeleton/html/index.html]]
- vim.cmd[[autocmd BufNewFile *.sh 0r ~/.vim/skeleton/sh/bash_header.sh]]
- --local x = require('telescope.builtin').find_files(require('telescope.actions.state').get_selected_entry())
- --print(x)
- o.expandtab = true
- o.tabstop=2
- o.shiftwidth=2
- o.hlsearch = true
- o.incsearch = true
- o.scrolloff = 10
- --move selected lines up and down when in Visual Mode
- map("v","J",":m '>+1<CR>gv=gv")
- map("v","K",":m '<-2<CR>gv=gv")
- --keep cursor centered while searching
- map("n","n","nzzzv")
- map("n","N","Nzzzv")
- --yank/copy into system clipboard
- map("v", "<leader>y", "\"+y")
- map("n", "<leader>y", "\"+y")
- --replace every instance of current word
- map("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
- --make current file executable
- map("n", "<leader>x", "<cmd>!chmod +x %<CR>")
- map('n', '<leader>fs', '<cmd>lua require("telescope.builtin").find_files()<CR>', opts)
- map('n', '<leader>ff', '<cmd>lua require("telescope.builtin").find_files()<CR>', opts)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement